From: Todd Date: Fri, 16 Jan 2015 00:30:26 +0000 (+1800) Subject: [PATCH v3 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=da79b74aa27dab1973b3690004289b172ea4dfde;p=notmuch-archives.git [PATCH v3 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database feature --- diff --git a/e3/5838c3a1119e2e9fe9de94198b1a9d915254c2 b/e3/5838c3a1119e2e9fe9de94198b1a9d915254c2 new file mode 100644 index 000000000..4e7529eae --- /dev/null +++ b/e3/5838c3a1119e2e9fe9de94198b1a9d915254c2 @@ -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 8E1A0431FDE + for ; Thu, 15 Jan 2015 16:31:07 -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 6II8-nvJtZ8y for ; + Thu, 15 Jan 2015 16:31:04 -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 53753431FD9 + for ; Thu, 15 Jan 2015 16:31:04 -0800 (PST) +Received: from user-69-73-37-128.knology.net ([69.73.37.128]:60097 + helo=localhost.localdomain) + by server75.web-hosting.com with esmtpsa (UNKNOWN:AES128-SHA256:128) + (Exim 4.82) (envelope-from ) + id 1YBuoZ-003S2e-CD; Thu, 15 Jan 2015 19:31:03 -0500 +From: Todd +To: notmuch@notmuchmail.org +Subject: [PATCH v3 2/5] Add the NOTMUCH_FEATURE_INDEXED_MIMETYPES database + feature +Date: Thu, 15 Jan 2015 18:30:26 -0600 +Message-Id: <1421368229-4360-2-git-send-email-todd@electricoding.com> +X-Mailer: git-send-email 1.9.1 +In-Reply-To: <1421368229-4360-1-git-send-email-todd@electricoding.com> +References: <1421368229-4360-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: Fri, 16 Jan 2015 00:31:07 -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..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 +