summaryrefslogtreecommitdiff
path: root/lib/notmuch.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-11-21 19:54:25 +0000
committerCarl Worth <cworth@cworth.org>2009-11-21 22:04:49 +0100
commitf379aa52845f5594aa6cc2e7cf131d5f57202bbf (patch)
tree1befbaa8796388c58fd40459ea42b93881af008e /lib/notmuch.h
parentaac1d6035238f6a2b18c0dc0d7a5190a2187c511 (diff)
Permit opening the notmuch database in read-only mode.
We only rarely need to actually open the database for writing, but we always create a Xapian::WritableDatabase. This has the effect of preventing searches and like whilst updating the index. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Carl Worth <cworth@cworth.org>
Diffstat (limited to 'lib/notmuch.h')
-rw-r--r--lib/notmuch.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/notmuch.h b/lib/notmuch.h
index cc713a3..89ed7ad 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -86,6 +86,7 @@ typedef int notmuch_bool_t;
typedef enum _notmuch_status {
NOTMUCH_STATUS_SUCCESS = 0,
NOTMUCH_STATUS_OUT_OF_MEMORY,
+ NOTMUCH_STATUS_READONLY_DATABASE,
NOTMUCH_STATUS_XAPIAN_EXCEPTION,
NOTMUCH_STATUS_FILE_ERROR,
NOTMUCH_STATUS_FILE_NOT_EMAIL,
@@ -139,11 +140,18 @@ notmuch_database_create (const char *path);
/* XXX: I think I'd like this to take an extra argument of
* notmuch_status_t* for returning a status value on failure. */
+typedef enum {
+ NOTMUCH_DATABASE_MODE_READONLY = 0,
+ NOTMUCH_DATABASE_MODE_WRITABLE
+} notmuch_database_mode_t;
+
/* Open an existing notmuch database located at 'path'.
*
* The database should have been created at some time in the past,
* (not necessarily by this process), by calling
- * notmuch_database_create with 'path'.
+ * notmuch_database_create with 'path'. By default the database should be
+ * opened for reading only. In order to write to the database you need to
+ * pass the NOTMUCH_DATABASE_MODE_WRITABLE mode.
*
* An existing notmuch database can be identified by the presence of a
* directory named ".notmuch" below 'path'.
@@ -155,7 +163,8 @@ notmuch_database_create (const char *path);
* an error message on stderr).
*/
notmuch_database_t *
-notmuch_database_open (const char *path);
+notmuch_database_open (const char *path,
+ notmuch_database_mode_t mode);
/* Close the given notmuch database, freeing all associated
* resources. See notmuch_database_open. */