From 58c4d334857ca318256e5517f2624f3aedbdcfa5 Mon Sep 17 00:00:00 2001 From: Todd Date: Wed, 14 Jan 2015 18:00:25 +1800 Subject: [PATCH] [PATCH v2 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature --- 9b/75bba316134d361d9afb89af78d5df9e9d1e68 | 133 ++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 9b/75bba316134d361d9afb89af78d5df9e9d1e68 diff --git a/9b/75bba316134d361d9afb89af78d5df9e9d1e68 b/9b/75bba316134d361d9afb89af78d5df9e9d1e68 new file mode 100644 index 000000000..62ffb9255 --- /dev/null +++ b/9b/75bba316134d361d9afb89af78d5df9e9d1e68 @@ -0,0 +1,133 @@ +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 2CD13431FDA + for ; Tue, 13 Jan 2015 16:01:05 -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 ftvlcX85AhLO for ; + Tue, 13 Jan 2015 16:01:02 -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 5C5C0431FC9 + for ; Tue, 13 Jan 2015 16:01:02 -0800 (PST) +Received: from user-69-73-37-128.knology.net ([69.73.37.128]:38910 + helo=localhost.localdomain) + by server75.web-hosting.com with esmtpsa (UNKNOWN:AES128-SHA256:128) + (Exim 4.82) (envelope-from ) + id 1YBBOP-001yjE-I8; Tue, 13 Jan 2015 19:01:01 -0500 +From: Todd +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database + feature +Date: Tue, 13 Jan 2015 18:00:25 -0600 +Message-Id: <1421193628-2699-3-git-send-email-todd@electricoding.com> +X-Mailer: git-send-email 1.9.1 +In-Reply-To: <1421193628-2699-1-git-send-email-todd@electricoding.com> +References: <1421193628-2699-1-git-send-email-todd@electricoding.com> +In-Reply-To: <8761ce7s16.fsf@nikula.org> +References: <8761ce7s16.fsf@nikula.org> +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: Wed, 14 Jan 2015 00:01:05 -0000 + +--- + 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..2de60f8 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, ++ "mime-types in database", "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 + -- 2.26.2