Rename NOTMUCH_DATABASE_MODE_WRITABLE to NOTMUCH_DATABASE_MODE_READ_WRITE

And correspondingly, READONLY to READ_ONLY.
This commit is contained in:
Carl Worth 2009-11-21 22:10:18 +01:00
parent f379aa5284
commit 637f99d8f3
11 changed files with 21 additions and 18 deletions

3
TODO
View file

@ -47,6 +47,9 @@ maildirs.)
notmuch library
---------------
Add support for files that are moved or deleted (which obviously need
to be handled differently).
Actually compile and install a libnotmuch shared library.
Fix to use the *last* Message-ID header if multiple such headers are

View file

@ -441,7 +441,7 @@ notmuch_database_create (const char *path)
}
notmuch = notmuch_database_open (path,
NOTMUCH_DATABASE_MODE_WRITABLE);
NOTMUCH_DATABASE_MODE_READ_WRITE);
DONE:
if (notmuch_path)
@ -487,7 +487,7 @@ notmuch_database_open (const char *path,
notmuch->mode = mode;
try {
if (mode == NOTMUCH_DATABASE_MODE_WRITABLE) {
if (mode == NOTMUCH_DATABASE_MODE_READ_WRITE) {
notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path,
Xapian::DB_CREATE_OR_OPEN);
} else {
@ -530,7 +530,7 @@ notmuch_database_open (const char *path,
void
notmuch_database_close (notmuch_database_t *notmuch)
{
if (notmuch->mode == NOTMUCH_DATABASE_MODE_WRITABLE)
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_WRITE)
(static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db))->flush ();
delete notmuch->term_gen;
@ -583,7 +583,7 @@ notmuch_database_set_timestamp (notmuch_database_t *notmuch,
notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;
char *db_key = NULL;
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READONLY) {
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) {
fprintf (stderr, "Attempted to update a read-only database.\n");
return NOTMUCH_STATUS_READONLY_DATABASE;
}

View file

@ -172,7 +172,7 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
unsigned int doc_id;
char *term;
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READONLY) {
if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) {
*status_ret = NOTMUCH_PRIVATE_STATUS_READONLY_DATABASE;
return NULL;
}
@ -552,7 +552,7 @@ _notmuch_message_sync (notmuch_message_t *message)
{
Xapian::WritableDatabase *db;
if (message->notmuch->mode == NOTMUCH_DATABASE_MODE_READONLY)
if (message->notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY)
return;
db = static_cast <Xapian::WritableDatabase *> (message->notmuch->xapian_db);

View file

@ -137,14 +137,14 @@ typedef struct _notmuch_tags notmuch_tags_t;
notmuch_database_t *
notmuch_database_create (const char *path);
typedef enum {
NOTMUCH_DATABASE_MODE_READ_ONLY = 0,
NOTMUCH_DATABASE_MODE_READ_Write
} notmuch_database_mode_t;
/* 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,

View file

@ -36,7 +36,7 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
return 1;
notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READONLY);
NOTMUCH_DATABASE_MODE_READ_ONLY);
if (notmuch == NULL)
return 1;

View file

@ -414,7 +414,7 @@ notmuch_new_command (void *ctx,
add_files_state.total_files = count;
} else {
notmuch = notmuch_database_open (db_path,
NOTMUCH_DATABASE_MODE_READONLY);
NOTMUCH_DATABASE_MODE_READ_ONLY);
add_files_state.ignore_read_only_directories = TRUE;
add_files_state.total_files = 0;
}

View file

@ -224,7 +224,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
}
notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READONLY);
NOTMUCH_DATABASE_MODE_READ_ONLY);
if (notmuch == NULL)
return 1;

View file

@ -37,7 +37,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[])
return 1;
notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_WRITABLE);
NOTMUCH_DATABASE_MODE_READ_WRITE);
if (notmuch == NULL)
return 1;

View file

@ -130,7 +130,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
return 1;
notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READONLY);
NOTMUCH_DATABASE_MODE_READ_ONLY);
if (notmuch == NULL)
return 1;

View file

@ -221,7 +221,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
}
notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READONLY);
NOTMUCH_DATABASE_MODE_READ_ONLY);
if (notmuch == NULL)
return 1;

View file

@ -95,7 +95,7 @@ notmuch_tag_command (void *ctx, unused (int argc), unused (char *argv[]))
return 1;
notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_WRITABLE);
NOTMUCH_DATABASE_MODE_READ_WRITE);
if (notmuch == NULL)
return 1;