]> git.cworth.org Git - notmuch/commitdiff
lib: publish API for notmuch_database_reopen
authorDavid Bremner <david@tethera.net>
Sun, 14 Mar 2021 14:01:57 +0000 (11:01 -0300)
committerDavid Bremner <david@tethera.net>
Thu, 18 Mar 2021 11:03:36 +0000 (08:03 -0300)
Include the (currently unused) mode argument which will specify which
mode to re-open the database in. Functionality and docs to be
finalized in a followup commit.

lib/database.cc
lib/message.cc
lib/notmuch-private.h
lib/notmuch.h

index f27616da32d60e7a7c8c067198883b88770d565d..82ac5f200ebfec6de03f9b7ff26e0af4aadfe137 100644 (file)
@@ -518,7 +518,8 @@ notmuch_database_close (notmuch_database_t *notmuch)
 }
 
 notmuch_status_t
-_notmuch_database_reopen (notmuch_database_t *notmuch)
+notmuch_database_reopen (notmuch_database_t *notmuch,
+                        unused(notmuch_database_mode_t mode))
 {
     if (_notmuch_database_mode (notmuch) != NOTMUCH_DATABASE_MODE_READ_ONLY)
        return NOTMUCH_STATUS_UNSUPPORTED_OPERATION;
index dc4b47dcd92784543f18c4640276ee5a1a1557f2..73a7805f8a2714eb48cfb6cdaec921563e77151b 100644 (file)
@@ -459,7 +459,8 @@ _notmuch_message_ensure_metadata (notmuch_message_t *message, void *field)
            /* all the way without an exception */
            break;
        } catch (const Xapian::DatabaseModifiedError &error) {
-           notmuch_status_t status = _notmuch_database_reopen (message->notmuch);
+           notmuch_status_t status = notmuch_database_reopen (message->notmuch,
+                                                              NOTMUCH_DATABASE_MODE_READ_ONLY);
            if (status != NOTMUCH_STATUS_SUCCESS)
                INTERNAL_ERROR ("unhandled error from notmuch_database_reopen: %s\n",
                                notmuch_status_to_string (status));
index 3c52cfc2c262fedce56d73ed3c0942f247f3cdfd..ef81437887b4451e5e5c4f30c9535f00c5e10b19 100644 (file)
@@ -204,9 +204,6 @@ _notmuch_message_id_compressed (void *ctx, const char *message_id);
 notmuch_status_t
 _notmuch_database_ensure_writable (notmuch_database_t *notmuch);
 
-notmuch_status_t
-_notmuch_database_reopen (notmuch_database_t *notmuch);
-
 void
 _notmuch_database_log (notmuch_database_t *notmuch,
                       const char *format, ...);
index 58c568d5a927ccab66c44a3d736037333456062c..db86ffc003d2bea735b6bc2daea19fc28fdfd62b 100644 (file)
@@ -879,6 +879,13 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch,
 notmuch_tags_t *
 notmuch_database_get_all_tags (notmuch_database_t *db);
 
+/**
+ * Reopen an open notmuch database.
+ *
+ */
+notmuch_status_t
+notmuch_database_reopen (notmuch_database_t *db, notmuch_database_mode_t mode);
+
 /**
  * Create a new query for 'database'.
  *