Function notmuch_sys::notmuch_database_open [] [src]

pub unsafe extern "C" fn notmuch_database_open(
    path: *const c_char,
    mode: notmuch_database_mode_t,
    database: *mut *mut notmuch_database_t
) -> notmuch_status_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'. 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_t::READ_WRITE mode.

An existing notmuch database can be identified by the presence of a directory named ".notmuch" below 'path'.

The caller should call notmuch_database_destroy when finished with this database.

In case of any failure, this function returns an error status and sets *database to NULL (after printing an error message on stderr).

Return value:

  • notmuch_status_t::SUCCESS: Successfully opened the database.

  • notmuch_status_t::NULL_POINTER: The given 'path' argument is NULL.

  • notmuch_status_t::OUT_OF_MEMORY: Out of memory.

  • notmuch_status_t::FILE_ERROR: An error occurred trying to open the database file (such as permission denied, or file not found, etc.), or the database version is unknown.

  • notmuch_status_t::XAPIAN_EXCEPTION: A Xapian exception occurred.