[PATCH v4 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature
authorTodd <todd@electricoding.com>
Thu, 22 Jan 2015 23:43:37 +0000 (17:43 +1800)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:43 +0000 (14:47 -0700)
eb/4ccf81e1327acad59f12789e7f3bda6957d598 [new file with mode: 0644]

diff --git a/eb/4ccf81e1327acad59f12789e7f3bda6957d598 b/eb/4ccf81e1327acad59f12789e7f3bda6957d598
new file mode 100644 (file)
index 0000000..d967517
--- /dev/null
@@ -0,0 +1,137 @@
+Return-Path: <todd@electricoding.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 BFC01431FD9\r
+       for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 15:44:33 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+       tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 qPwwSPIimpKP for <notmuch@notmuchmail.org>;\r
+       Thu, 22 Jan 2015 15:44:31 -0800 (PST)\r
+Received: from s75.web-hosting.com (s75.web-hosting.com [198.187.31.9])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E7E85431FD2\r
+       for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 15:44:24 -0800 (PST)\r
+Received: from user-69-73-37-128.knology.net ([69.73.37.128]:32799\r
+       helo=localhost.localdomain)\r
+       by server75.web-hosting.com with esmtpsa (UNKNOWN:AES128-SHA256:128)\r
+       (Exim 4.82) (envelope-from <todd@electricoding.com>)\r
+       id 1YERQE-0036iE-JF; Thu, 22 Jan 2015 18:44:22 -0500\r
+From: Todd <todd@electricoding.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database\r
+       feature\r
+Date: Thu, 22 Jan 2015 17:43:37 -0600\r
+Message-Id: <1421970220-9019-3-git-send-email-todd@electricoding.com>\r
+X-Mailer: git-send-email 1.9.1\r
+In-Reply-To: <1421970220-9019-1-git-send-email-todd@electricoding.com>\r
+References: <1421970220-9019-1-git-send-email-todd@electricoding.com>\r
+In-Reply-To: <1420849787-4401-1-git-send-email-todd@electricoding.com>\r
+References: <1420849787-4401-1-git-send-email-todd@electricoding.com>\r
+X-AntiAbuse: This header was added to track abuse,\r
+       please include it with any abuse report\r
+X-AntiAbuse: Primary Hostname - server75.web-hosting.com\r
+X-AntiAbuse: Original Domain - notmuchmail.org\r
+X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]\r
+X-AntiAbuse: Sender Address Domain - electricoding.com\r
+X-Get-Message-Sender-Via: server75.web-hosting.com: authenticated_id:\r
+       todd@electricoding.com\r
+X-Source: \r
+X-Source-Args: \r
+X-Source-Dir: \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: Thu, 22 Jan 2015 23:44:34 -0000\r
+\r
+This feature will exist in all newly created databases, but there is\r
+no upgrade provided for it.  If this flag exists, it indicates that\r
+the database was created after the indexed MIME-types feature was\r
+added.\r
+---\r
+ lib/database-private.h | 15 ++++++++++++---\r
+ lib/database.cc        | 10 ++++++++--\r
+ 2 files changed, 20 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/lib/database-private.h b/lib/database-private.h\r
+index 15e03cc..6d6fa2c 100644\r
+--- a/lib/database-private.h\r
++++ b/lib/database-private.h\r
+@@ -92,6 +92,14 @@ enum _notmuch_features {\r
+      *\r
+      * Introduced: version 3. */\r
+     NOTMUCH_FEATURE_GHOSTS = 1 << 4,\r
++\r
++\r
++    /* If set, then the database was created after the introduction of\r
++     * indexed mime types. If unset, then the database may contain a\r
++     * mixture of messages with indexed and non-indexed mime types.\r
++     *\r
++     * Introduced: version 3. */\r
++    NOTMUCH_FEATURE_INDEXED_MIMETYPES = 1 << 5,\r
+ };\r
\r
+ /* In C++, a named enum is its own type, so define bitwise operators\r
+@@ -161,9 +169,10 @@ struct _notmuch_database {\r
\r
+ /* Current database features.  If any of these are missing from a\r
+  * database, request an upgrade.\r
+- * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES is not included because\r
+- * upgrade doesn't currently introduce the feature (though brand new\r
+- * databases will have it). */\r
++ * NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES and\r
++ * NOTMUCH_FEATURE_INDEXED_MIMETYPES are not included because upgrade\r
++ * doesn't currently introduce the features (though brand new databases\r
++ * will have it). */\r
+ #define NOTMUCH_FEATURES_CURRENT \\r
+     (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_DIRECTORY_DOCS | \\r
+      NOTMUCH_FEATURE_BOOL_FOLDER | NOTMUCH_FEATURE_GHOSTS)\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 3601f9d..0d2c417 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -304,6 +304,11 @@ static const struct {\r
+       "exact folder:/path: search", "rw" },\r
+     { NOTMUCH_FEATURE_GHOSTS,\r
+       "mail documents for missing messages", "w"},\r
++    /* Knowledge of the index mime-types are not required for reading\r
++     * a database because a reader will just be unable to query\r
++     * them. */\r
++    { NOTMUCH_FEATURE_INDEXED_MIMETYPES,\r
++      "indexed MIME types", "w"},\r
+ };\r
\r
+ const char *\r
+@@ -646,9 +651,10 @@ notmuch_database_create (const char *path, notmuch_database_t **database)\r
+     if (status)\r
+       goto DONE;\r
\r
+-    /* Upgrade doesn't add this feature to existing databases, but new\r
+-     * databases have it. */\r
++    /* Upgrade doesn't add these feature to existing databases, but\r
++     * new databases have them. */\r
+     notmuch->features |= NOTMUCH_FEATURE_FROM_SUBJECT_ID_VALUES;\r
++    notmuch->features |= NOTMUCH_FEATURE_INDEXED_MIMETYPES;\r
\r
+     status = notmuch_database_upgrade (notmuch, NULL, NULL);\r
+     if (status) {\r
+-- \r
+1.9.1\r
+\r