From: Adrien Bustany Date: Wed, 17 Oct 2012 21:34:08 +0000 (+0300) Subject: Re: [PATCH 1/2] Add notmuch_database_flush method X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=62b45520a615642da4c511e25f7421690eaf811f;p=notmuch-archives.git Re: [PATCH 1/2] Add notmuch_database_flush method --- diff --git a/b3/a735b805c2f6485b3ed87cd6b57d0c47033235 b/b3/a735b805c2f6485b3ed87cd6b57d0c47033235 new file mode 100644 index 000000000..f2fcc4210 --- /dev/null +++ b/b3/a735b805c2f6485b3ed87cd6b57d0c47033235 @@ -0,0 +1,99 @@ +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 16FBA431FBD + for ; Wed, 17 Oct 2012 14:34:14 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 kqvlYETZrCaa for ; + Wed, 17 Oct 2012 14:34:13 -0700 (PDT) +Received: from mail.bustany.org (bustany.org [176.31.244.208]) + by olra.theworths.org (Postfix) with ESMTP id 82C0A431FB6 + for ; Wed, 17 Oct 2012 14:34:13 -0700 (PDT) +Received: from [192.168.1.147] (91-158-5-86.elisa-laajakaista.fi + [91.158.5.86]) by mail.bustany.org (Postfix) with ESMTPSA id 3C8761401ED; + Wed, 17 Oct 2012 23:37:59 +0200 (CEST) +Message-ID: <507F2450.5020005@bustany.org> +Date: Thu, 18 Oct 2012 00:34:08 +0300 +From: Adrien Bustany +User-Agent: Mozilla/5.0 (X11; Linux x86_64; + rv:16.0) Gecko/20121009 Thunderbird/16.0 +MIME-Version: 1.0 +To: Ethan Glasser-Camp +Subject: Re: [PATCH 1/2] Add notmuch_database_flush method +References: <1342723401-26103-1-git-send-email-adrien@bustany.org> + <1342723401-26103-2-git-send-email-adrien@bustany.org> + <87d30h857w.fsf@betacantrips.com> +In-Reply-To: <87d30h857w.fsf@betacantrips.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +Cc: notmuch@notmuchmail.org +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 21:34:14 -0000 + +Le 17/10/2012 18:53, Ethan Glasser-Camp a écrit : +> 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.) + +Sorry about that... I think I copied the style from +notmuch_database_close, but my editor was set to have 4-space tabs, so I +got confused. I'll send a fixed version of the patches. + +> +>> + 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. +> + +Yes, I also think breaking this line will not make things prettier :-/ + +> Ethan +> + +Thanks for the review! + +Adrien