Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 64 / 97e1a3986b6a46c97a9aff7b712392fbe60342
1 Return-Path: <aclements@csail.mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 11A88431FC4\r
6         for <notmuch@notmuchmail.org>; Sun, 12 Oct 2014 23:20:23 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id CpgXZeBr3HDH for <notmuch@notmuchmail.org>;\r
16         Sun, 12 Oct 2014 23:20:17 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
18         [18.7.68.37])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 799C8431FB6\r
22         for <notmuch@notmuchmail.org>; Sun, 12 Oct 2014 23:20:13 -0700 (PDT)\r
23 X-AuditID: 12074425-f79e46d000002583-64-543b6f1bf69b\r
24 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id B0.94.09603.B1F6B345; Mon, 13 Oct 2014 02:20:11 -0400 (EDT)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s9D6K8pR021370; \r
31         Mon, 13 Oct 2014 02:20:08 -0400\r
32 Received: from drake.dyndns.org ([73.162.189.21]) (authenticated bits=0)\r
33         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
34         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s9D6K58Q031971\r
35         (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);\r
36         Mon, 13 Oct 2014 02:20:07 -0400\r
37 Received: from amthrax by drake.dyndns.org with local (Exim 4.84)\r
38         (envelope-from <aclements@csail.mit.edu>)\r
39         id 1XdYzF-0000UG-AX; Mon, 13 Oct 2014 02:20:05 -0400\r
40 From: Austin Clements <aclements@csail.mit.edu>\r
41 To: notmuch@notmuchmail.org\r
42 Subject: [WIP PATCH 3/4] lib: API to retrieve database revision and UUID\r
43 Date: Mon, 13 Oct 2014 02:20:02 -0400\r
44 Message-Id: <1413181203-1676-4-git-send-email-aclements@csail.mit.edu>\r
45 X-Mailer: git-send-email 2.1.0\r
46 In-Reply-To: <1413181203-1676-1-git-send-email-aclements@csail.mit.edu>\r
47 References: <1413181203-1676-1-git-send-email-aclements@csail.mit.edu>\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixCmqrSudbx1i0LxW3OL6zZnMDowez1bd\r
50         Yg5gjOKySUnNySxLLdK3S+DK2LrhClPBDbGKFe9eMTUwzhLqYuTkkBAwkbj5ejkzhC0mceHe\r
51         erYuRi4OIYHZTBK/jl9hhHA2Mkp03N7OClIlJLCcSeLU/1KIxBJGiRuvNjKBJNgE9CVWrJ0E\r
52         ViQiIC2x8+5sIJuDg1lAV6K5XRkkLCzgIfFlZwcLiM0ioCpx8GwDO4jNK+Am0TJ9A9QVchIb\r
53         dv9nBLE5BdwlLk48ywyx103iWNs1lgmM/AsYGVYxyqbkVunmJmbmFKcm6xYnJ+blpRbpWujl\r
54         ZpbopaaUbmIEBQ27i+oOxgmHlA4xCnAwKvHwWvyxChFiTSwrrsw9xCjJwaQkyhuQZh0ixJeU\r
55         n1KZkVicEV9UmpNafIhRgoNZSYT3rQ1QjjclsbIqtSgfJiXNwaIkzrvpB1+IkEB6Yklqdmpq\r
56         QWoRTFaGg0NJgvdENlCjYFFqempFWmZOCUKaiYMTZDgP0HApkBre4oLE3OLMdIj8KUZFKXHe\r
57         q1lACQGQREZpHlwvLKpfMYoDvSLMGwjSzgNMCHDdr4AGMwENPtplDjK4JBEhJdXAuNzSssXr\r
58         yr7yQLf2qf94DQ+8u+OVp/Mquudx78J/7cpbPuvcVbX+WbT8IKtN+azDXzbIrLfnen7WYsOP\r
59         TZecX/ZHz/WZfHHpZptQhY8SR+Ysjz1yJNv48H0V/RM7NJe+/+sTLfOYYYfuV9mA/UVRf1M5\r
60         n+9UCrllfdsoiG1yWsv96bG5hxvlHJRYijMSDbWYi4oTAVlYbiLFAgAA\r
61 Cc: Austin Clements <aclements@csail.mit.edu>\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.13\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66         <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Mon, 13 Oct 2014 06:20:23 -0000\r
75 \r
76 This exposes the committed database revision to library users along\r
77 with a UUID that can be used to detect when revision numbers are no\r
78 longer comparable (e.g., because the database has been replaced).\r
79 ---\r
80  lib/database-private.h |  1 +\r
81  lib/database.cc        | 11 +++++++++++\r
82  lib/notmuch.h          | 18 ++++++++++++++++++\r
83  3 files changed, 30 insertions(+)\r
84 \r
85 diff --git a/lib/database-private.h b/lib/database-private.h\r
86 index 465065d..0977229 100644\r
87 --- a/lib/database-private.h\r
88 +++ b/lib/database-private.h\r
89 @@ -157,6 +157,7 @@ struct _notmuch_database {\r
90       * under a higher revision number, which can be generated with\r
91       * notmuch_database_new_revision. */\r
92      unsigned long revision;\r
93 +    const char *uuid;\r
94  \r
95      Xapian::QueryParser *query_parser;\r
96      Xapian::TermGenerator *term_gen;\r
97 diff --git a/lib/database.cc b/lib/database.cc\r
98 index 45d32ab..9bec170 100644\r
99 --- a/lib/database.cc\r
100 +++ b/lib/database.cc\r
101 @@ -905,6 +905,8 @@ notmuch_database_open (const char *path,\r
102             notmuch->revision = 0;\r
103         else\r
104             notmuch->revision = Xapian::sortable_unserialise (last_mod);\r
105 +       notmuch->uuid = talloc_strdup (\r
106 +           notmuch, notmuch->xapian_db->get_uuid ().c_str ());\r
107  \r
108         notmuch->query_parser = new Xapian::QueryParser;\r
109         notmuch->term_gen = new Xapian::TermGenerator;\r
110 @@ -1562,6 +1564,15 @@ DONE:\r
111      return NOTMUCH_STATUS_SUCCESS;\r
112  }\r
113  \r
114 +unsigned long\r
115 +notmuch_database_get_revisison (notmuch_database_t *notmuch,\r
116 +                               const char **uuid)\r
117 +{\r
118 +    if (*uuid)\r
119 +       *uuid = notmuch->uuid;\r
120 +    return notmuch->revision;\r
121 +}\r
122 +\r
123  /* We allow the user to use arbitrarily long paths for directories. But\r
124   * we have a term-length limit. So if we exceed that, we'll use the\r
125   * SHA-1 of the path for the database term.\r
126 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
127 index 92594b9..898f7b9 100644\r
128 --- a/lib/notmuch.h\r
129 +++ b/lib/notmuch.h\r
130 @@ -433,6 +433,24 @@ notmuch_status_t\r
131  notmuch_database_end_atomic (notmuch_database_t *notmuch);\r
132  \r
133  /**\r
134 + * Return the committed database revision and UUID.\r
135 + *\r
136 + * The database revision number increases monotonically with each\r
137 + * commit to the database.  Hence, all messages and message changes\r
138 + * committed to the database (that is, visible to readers) have a last\r
139 + * modification revision <= the committed database revision.  Any\r
140 + * messages committed in the future will be assigned a modification\r
141 + * revision > the committed database revision.\r
142 + *\r
143 + * The UUID is a NUL-terminated opaque string that uniquely identifies\r
144 + * this database.  Two revision numbers are only comparable if they\r
145 + * have the same database UUID.\r
146 + */\r
147 +unsigned long\r
148 +notmuch_database_get_revisison (notmuch_database_t *notmuch,\r
149 +                               const char **uuid);\r
150 +\r
151 +/**\r
152   * Retrieve a directory object from the database for 'path'.\r
153   *\r
154   * Here, 'path' should be a path relative to the path of 'database'\r
155 -- \r
156 2.1.0\r
157 \r