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