From eb2f8f7a6f20890ddeae4bc5be6752126ab3a4c2 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 24 Aug 2014 15:21:07 +1700 Subject: [PATCH] Re: [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained "features" --- c1/2f4d4db3c625d39e1833ba498586b85196af35 | 97 +++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 c1/2f4d4db3c625d39e1833ba498586b85196af35 diff --git a/c1/2f4d4db3c625d39e1833ba498586b85196af35 b/c1/2f4d4db3c625d39e1833ba498586b85196af35 new file mode 100644 index 000000000..edf7adb0d --- /dev/null +++ b/c1/2f4d4db3c625d39e1833ba498586b85196af35 @@ -0,0 +1,97 @@ +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 56218431FB6 + for ; Sat, 23 Aug 2014 15:21:25 -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 Tp059WRUnxwx for ; + Sat, 23 Aug 2014 15:21:18 -0700 (PDT) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 3EA37431FAF + for ; Sat, 23 Aug 2014 15:21:18 -0700 (PDT) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1XLJgP-0002Jr-3V; Sat, 23 Aug 2014 19:21:13 -0300 +Received: (nullmailer pid 18176 invoked by uid 1000); Sat, 23 Aug 2014 + 22:21:07 -0000 +From: David Bremner +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained + "features" +In-Reply-To: <1406859003-11561-5-git-send-email-amdragon@mit.edu> +References: <1406859003-11561-1-git-send-email-amdragon@mit.edu> + <1406859003-11561-5-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.18.1+72~g028c560 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Sat, 23 Aug 2014 15:21:07 -0700 +Message-ID: <87ppfqsv8s.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +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: Sat, 23 Aug 2014 22:21:25 -0000 + +Austin Clements writes: +> +> + /* Bit mask of features used by this database. Features are +> + * named, independent aspects of the database schema. This is a +> + * bitwise-OR of NOTMUCH_FEATURE_* values (below). */ +> + unsigned int features; + +Should we be using a fixed size integer (uint_32t or whatever) for +features? iirc the metadata in the database is actually a string, so I +guess arbitrary precision there. + +> +/* Bit masks for _notmuch_database::features. */ +> +enum { +> + /* If set, file names are stored in "file-direntry" terms. If +> + * unset, file names are stored in document data. +> + * +> + * Introduced: version 1. Implementation support: both for read; +> + * required for write. */ +> + NOTMUCH_FEATURE_FILE_TERMS = 1 << 0, + +I agree with Jani that the Implementation support: part is a bit +mystifying without the commit message. Maybe part of the commit message +could migrate here? Or maybe just add a pointer to the comment in database.cc. + +> + if (! *incompat_out) + +Should we support passing NULL for incompat_out? or at least check for +it? + +> @@ -1048,7 +1164,8 @@ notmuch_database_get_version (notmuch_database_t *notmuch) +> notmuch_bool_t +> notmuch_database_needs_upgrade (notmuch_database_t *notmuch) +> { +> - return notmuch->needs_upgrade; +> + return notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE && +> + (NOTMUCH_FEATURES_CURRENT & ~notmuch->features); +> } + +Maybe I'm not thinking hard enough here, but how does this deal with a +feature that is needed to open a database in read only mode? Maybe it +needs a comment for people not as clever as Austin ;). + +d + -- 2.26.2