Re: [PATCH] go: add binding for notmuch_message_get_date
[notmuch-archives.git] / cd / 945e6149a26f41366b0db1164b170a7c2af053
1 Return-Path: <amdragon@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 130D9431FAE\r
6         for <notmuch@notmuchmail.org>; Tue, 29 Jul 2014 09:48:51 -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 m-f969yuY3Cj for <notmuch@notmuchmail.org>;\r
16         Tue, 29 Jul 2014 09:48:45 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 3B7DA431FCB\r
20         for <notmuch@notmuchmail.org>; Tue, 29 Jul 2014 09:48:22 -0700 (PDT)\r
21 X-AuditID: 12074422-f79be6d000007518-ee-53d7d053c010\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         (using TLS with cipher AES256-SHA (256/256 bits))\r
24         (Client did not present a certificate)\r
25         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
26         id B7.02.29976.350D7D35; Tue, 29 Jul 2014 12:48:19 -0400 (EDT)\r
27 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
28         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s6TGmIMb003296; \r
29         Tue, 29 Jul 2014 12:48:18 -0400\r
30 Received: from drake.dyndns.org (31-33-71.wireless.csail.mit.edu\r
31         [128.31.33.71]) (authenticated bits=0)\r
32         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
33         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s6TGmF6B030270\r
34         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
35         Tue, 29 Jul 2014 12:48:17 -0400\r
36 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
37         (envelope-from <amdragon@mit.edu>)\r
38         id 1XCAZS-0007H5-VQ; Tue, 29 Jul 2014 12:48:14 -0400\r
39 From: Austin Clements <amdragon@MIT.EDU>\r
40 To: notmuch@notmuchmail.org\r
41 Subject: [PATCH v2 11/14] lib: Report progress for combined upgrade operation\r
42 Date: Tue, 29 Jul 2014 12:48:09 -0400\r
43 Message-Id: <1406652492-27803-12-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 2.0.0\r
45 In-Reply-To: <1406652492-27803-1-git-send-email-amdragon@mit.edu>\r
46 References: <1406652492-27803-1-git-send-email-amdragon@mit.edu>\r
47 X-Brightmail-Tracker:\r
48  H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixG6noht84Xqwwf8GdYvVc3ksrt+cyezA\r
49         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZdzdtJ6p4D5vxaQ1/5kbGP9zdTFyckgImEjs\r
50         af/MAmGLSVy4t56ti5GLQ0hgNpPEutWfmSCcjYwSHbOOQjnHmCSab0yDKpvLKPFo/jZWkH42\r
51         AQ2JbfuXM4LYIgLSEjvvzgaLMws4Snzev4gNxBYW8JU4+3g1M4jNIqAq8XHvGyYQmxeoZueu\r
52         3UwQd8hJNNz4BFbPCRS/de8uWFxIwEHi0KzNLBMY+RcwMqxilE3JrdLNTczMKU5N1i1OTszL\r
53         Sy3SNdXLzSzRS00p3cQIDiUXpR2MPw8qHWIU4GBU4uHdMPdasBBrYllxZe4hRkkOJiVRXr19\r
54         14OF+JLyUyozEosz4otKc1KLDzFKcDArifDynQXK8aYkVlalFuXDpKQ5WJTEed9aWwULCaQn\r
55         lqRmp6YWpBbBZGU4OJQkeI3OAzUKFqWmp1akZeaUIKSZODhBhvMADW8GqeEtLkjMLc5Mh8if\r
56         YlSUEufNPgeUEABJZJTmwfXCYv0VozjQK8K8bSDtPMA0Adf9CmgwE9BgVhewwSWJCCmpBsa5\r
57         SZXnUkpjWp/mLVyveXERw7+D1/ozny9YO/XyksXq4js+RJ1msv4iVm8V/KLzdb7pivXy6/Jn\r
58         yf3fMPtUtuNb2USmQ8whzdpe97+8FImSnBc47yTP34lLHzt36KUfqfb85Jgfd8H223H9y4pF\r
59         YuJxn6IvMORcncoUvmDRZ8fGMrOZqmt5/x9VYinOSDTUYi4qTgQAqD3ZWtACAAA=\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Tue, 29 Jul 2014 16:48:51 -0000\r
73 \r
74 Previously, some parts of upgrade didn't report progress and for\r
75 others it was possible for the progress meter to restart at 0 part way\r
76 through the upgrade because each stage was reported separately.\r
77 \r
78 Fix this by computing the total amount of work that needs to be done\r
79 up-front and updating completed work monotonically.\r
80 ---\r
81  lib/database.cc | 17 +++++++++++++++--\r
82  1 file changed, 15 insertions(+), 2 deletions(-)\r
83 \r
84 diff --git a/lib/database.cc b/lib/database.cc\r
85 index 4940634..987b0a6 100644\r
86 --- a/lib/database.cc\r
87 +++ b/lib/database.cc\r
88 @@ -1234,6 +1234,19 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
89         timer_is_active = TRUE;\r
90      }\r
91  \r
92 +    /* Figure out how much total work we need to do. */\r
93 +    if (new_features &\r
94 +       (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER)) {\r
95 +       notmuch_query_t *query = notmuch_query_create (notmuch, "");\r
96 +       total += notmuch_query_count_messages (query);\r
97 +       notmuch_query_destroy (query);\r
98 +    }\r
99 +    if (new_features & NOTMUCH_FEATURE_DIRECTORY_DOCS) {\r
100 +       t_end = db->allterms_end ("XTIMESTAMP");\r
101 +       for (t = db->allterms_begin ("XTIMESTAMP"); t != t_end; t++)\r
102 +           ++total;\r
103 +    }\r
104 +\r
105      /* Perform the upgrade in a transaction. */\r
106      db->begin_transaction (true);\r
107  \r
108 @@ -1245,8 +1258,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
109         notmuch_message_t *message;\r
110         char *filename;\r
111  \r
112 -       total = notmuch_query_count_messages (query);\r
113 -\r
114         for (messages = notmuch_query_search_messages (query);\r
115              notmuch_messages_valid (messages);\r
116              notmuch_messages_move_to_next (messages))\r
117 @@ -1330,6 +1341,8 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
118  \r
119                 db->delete_document (*p);\r
120             }\r
121 +\r
122 +           ++count;\r
123         }\r
124      }\r
125  \r
126 -- \r
127 2.0.0\r
128 \r