1 Return-Path: <adrien@bustany.org>
\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 13071431FAE
\r
6 for <notmuch@notmuchmail.org>; Thu, 19 Jul 2012 11:43:31 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 XwhKJyHnmNW6 for <notmuch@notmuchmail.org>;
\r
16 Thu, 19 Jul 2012 11:43:30 -0700 (PDT)
\r
17 Received: from mail.bustany.org (bustany.org [176.31.244.208])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 6F3C5431FC2
\r
19 for <notmuch@notmuchmail.org>; Thu, 19 Jul 2012 11:43:27 -0700 (PDT)
\r
20 Received: from localhost.localdomain (91-158-2-79.elisa-laajakaista.fi
\r
22 by mail.bustany.org (Postfix) with ESMTPSA id 53DFF1400C4
\r
23 for <notmuch@notmuchmail.org>; Thu, 19 Jul 2012 20:45:56 +0200 (CEST)
\r
24 From: Adrien Bustany <adrien@bustany.org>
\r
25 To: notmuch@notmuchmail.org
\r
26 Subject: [PATCH 2/2] Add notmuch_database_reopen method
\r
27 Date: Thu, 19 Jul 2012 21:43:21 +0300
\r
28 Message-Id: <1342723401-26103-3-git-send-email-adrien@bustany.org>
\r
29 X-Mailer: git-send-email 1.7.7.6
\r
30 In-Reply-To: <1342723401-26103-1-git-send-email-adrien@bustany.org>
\r
31 References: <1342723401-26103-1-git-send-email-adrien@bustany.org>
\r
32 X-BeenThere: notmuch@notmuchmail.org
\r
33 X-Mailman-Version: 2.1.13
\r
35 List-Id: "Use and development of the notmuch mail system."
\r
36 <notmuch.notmuchmail.org>
\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
38 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
40 List-Post: <mailto:notmuch@notmuchmail.org>
\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
44 X-List-Received-Date: Thu, 19 Jul 2012 18:43:31 -0000
\r
46 Calling notmuch_database_reopen is needed to refresh the database
\r
47 contents when the database on disk was modified by another
\r
48 notmuch_database_t instance, for example in a different thread.
\r
50 lib/database.cc | 17 +++++++++++++++++
\r
51 lib/notmuch.h | 8 ++++++++
\r
52 2 files changed, 25 insertions(+), 0 deletions(-)
\r
54 diff --git a/lib/database.cc b/lib/database.cc
\r
55 index 55bcd17..3be5a30 100644
\r
56 --- a/lib/database.cc
\r
57 +++ b/lib/database.cc
\r
58 @@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)
\r
63 +notmuch_database_reopen(notmuch_database_t *notmuch)
\r
65 + notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
\r
68 + if (notmuch->xapian_db != NULL)
\r
69 + (notmuch->xapian_db)->reopen ();
\r
70 + } catch (const Xapian::Error &error) {
\r
71 + fprintf(stderr, "A Xapian exception occured reopening the database: %s\n",
\r
72 + error.get_msg().c_str());
\r
73 + status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
\r
80 notmuch_database_close (notmuch_database_t *notmuch)
\r
82 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
83 index aef5c56..51d6a9a 100644
\r
86 @@ -205,6 +205,14 @@ notmuch_database_open (const char *path,
\r
88 notmuch_database_flush (notmuch_database_t *database);
\r
90 +/* Refresh the database contents to the latest version.
\r
92 + * This is needed only if another instance of notmuch_database_t has
\r
93 + * modified the database contents on disk.
\r
96 +notmuch_database_reopen (notmuch_database_t *database);
\r
98 /* Close the given notmuch database.
\r
100 * After notmuch_database_close has been called, calls to other
\r