Re: [PATCH 1/2] Add notmuch_database_flush method
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Wed, 17 Oct 2012 15:53:55 +0000 (11:53 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:49 +0000 (09:49 -0800)
08/43939087823f31d5e0eb4fb1ad554547a8477f [new file with mode: 0644]

diff --git a/08/43939087823f31d5e0eb4fb1ad554547a8477f b/08/43939087823f31d5e0eb4fb1ad554547a8477f
new file mode 100644 (file)
index 0000000..782e51b
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 68C41431FBD\r
+       for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 08:54:02 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 4lbYCv4FilER for <notmuch@notmuchmail.org>;\r
+       Wed, 17 Oct 2012 08:54:01 -0700 (PDT)\r
+Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com\r
+       [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0575B431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 08:54:00 -0700 (PDT)\r
+Received: by mail-qa0-f46.google.com with SMTP id c26so665400qad.5\r
+       for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 08:54:00 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=scqBdlyVz0Od3UtsvmiT1ArikqUwPIbwNnTrluXluaA=;\r
+       b=m38+l0unG9qD+nWRqwX6yJgjpTUnrnIGBWigFmkKlTv9CiAHFOWBUUkGh++B2CKSUp\r
+       sfyvG+BvgUNl6cwFUtBEgf1FToA5tznCFgXYKKroxX8RYo/zT1emuzhIqso5Ngnw4akM\r
+       sofFbgQj9qSTa6UWifkRa/jLU2ZltCYjriD496yjPJ2wW9ZMyoqxDjO24U2xdPCSn4wl\r
+       Ikf2swYMcXjHSwnAixNgKi7BiR+hgQOHv4LWCzxYU6eqao1+d2QukW8v8GVQCfK6vlrT\r
+       zbFIT75cHcIMDs13YJCyldF//jyzHREDbxoss58do+iz7L6ZSeTVA/FuG8MkOjgCzaXb\r
+       k6Cg==\r
+Received: by 10.49.2.200 with SMTP id 8mr44481837qew.20.1350489240142;\r
+       Wed, 17 Oct 2012 08:54:00 -0700 (PDT)\r
+Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])\r
+       by mx.google.com with ESMTPS id j9sm9225164qac.15.2012.10.17.08.53.56\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 17 Oct 2012 08:53:57 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: Adrien Bustany <adrien@bustany.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/2] Add notmuch_database_flush method\r
+In-Reply-To: <1342723401-26103-2-git-send-email-adrien@bustany.org>\r
+References: <1342723401-26103-1-git-send-email-adrien@bustany.org>\r
+       <1342723401-26103-2-git-send-email-adrien@bustany.org>\r
+User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Wed, 17 Oct 2012 11:53:55 -0400\r
+Message-ID: <87d30h857w.fsf@betacantrips.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 17 Oct 2012 15:54:02 -0000\r
+\r
+Adrien Bustany <adrien@bustany.org> writes:\r
+\r
+> This method explicitly flushes the pending modifications to disk. It is\r
+> useful if your program has various threads, each with a read only DB and\r
+> one writer thread with a read/write DB. In that case, you most likely\r
+> want the writer to sync the changes to disk so that the readers can see\r
+> them, without having to close and reopen the database completely.\r
+\r
+These patches are pretty straightforward. But to conform to notmuch style..\r
+\r
+> +notmuch_status_t\r
+> +notmuch_database_flush(notmuch_database_t *notmuch)\r
+> +{\r
+> +    notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;\r
+\r
+Indent is 4 spaces. (You have tabs here, which are 8 spaces, according\r
+to devel/STYLE.)\r
+\r
+> +    try {\r
+> +    if (notmuch->xapian_db != NULL &&\r
+\r
+if should be more indented than try. (So when you pull try back to 4\r
+spaces, leave if at 8 spaces.)\r
+\r
+> +        notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)\r
+> +            (static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db))->flush ();\r
+\r
+This line is 90 characters, and will remain at 86 once you indent using\r
+the in-house style. I'm not sure if it's worth reformatting.\r
+notmuch_database_close calls flush() using exactly the same 86-character\r
+line. I'd say "don't make it worse", but personally I think breaking\r
+this line might be worse.\r
+\r
+Ethan\r