Function notmuch_sys::notmuch_database_create [] [src]

pub unsafe extern "C" fn notmuch_database_create(
    path: *const c_char,
    database: *mut *mut notmuch_database_t
) -> notmuch_status_t

Create a new, empty notmuch database located at 'path'.

The path should be a top-level directory to a collection of plain-text email messages (one message per file). This call will create a new ".notmuch" directory within 'path' where notmuch will store its data.

After a successful call to notmuch_database_create, the returned database will be open so the caller should call notmuch_database_destroy when finished with it.

The database will not yet have any data in it (notmuch_database_create itself is a very cheap function). Messages contained within 'path' can be added to the database by calling notmuch_database_add_message.

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 created 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 create the database file (such as permission denied, or file not found, etc.), or the database already exists.

  • notmuch_status_t::XAPIAN_EXCEPTION: A Xapian exception occurred.