}
notmuch_bool_t
-notmuch_filenames_has_more (notmuch_filenames_t *filenames)
+notmuch_filenames_valid (notmuch_filenames_t *filenames)
{
if (filenames == NULL)
return NULL;
}
void
-notmuch_filenames_advance (notmuch_filenames_t *filenames)
+notmuch_filenames_move_to_next (notmuch_filenames_t *filenames)
{
if (filenames == NULL)
return;
path = _notmuch_database_relative_path (notmuch, path);
- if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) {
- fprintf (stderr, "Attempted to update a read-only database.\n");
- *status_ret = NOTMUCH_STATUS_READONLY_DATABASE;
- return NULL;
- }
+ if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY)
+ INTERNAL_ERROR ("Failure to ensure database is writable");
db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);
Xapian::docid parent_id;
char *term = talloc_asprintf (local, "%s%s",
_find_prefix ("directory"), db_path);
- directory->doc.add_term (term);
+ directory->doc.add_term (term, 0);
directory->doc.set_data (path);
term = talloc_asprintf (local, "%s%u:%s",
_find_prefix ("directory-direntry"),
parent_id, basename);
- directory->doc.add_term (term);
+ directory->doc.add_term (term, 0);
}
directory->doc.add_value (NOTMUCH_VALUE_TIMESTAMP,
{
notmuch_database_t *notmuch = directory->notmuch;
Xapian::WritableDatabase *db;
+ notmuch_status_t status;
- if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) {
- fprintf (stderr, "Attempted to update a read-only database.\n");
- return NOTMUCH_STATUS_READONLY_DATABASE;
- }
+ status = _notmuch_database_ensure_writable (notmuch);
+ if (status)
+ return status;
db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);