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