notmuch_directory_set_mtime

Store an mtime within the database for 'directory'.

The 'directory' should be an object retrieved from the database with notmuch_database_get_directory for a particular path.

The intention is for the caller to use the mtime to allow efficient identification of new messages to be added to the database. The recommended usage is as follows:

o Read the mtime of a directory from the filesystem

o Call add_message for all mail files in the directory

o Call notmuch_directory_set_mtime with the mtime read from the filesystem.

Then, when wanting to check for updates to the directory in the future, the client can call notmuch_directory_get_mtime and know that it only needs to add files if the mtime of the directory and files are newer than the stored timestamp.

Note: The notmuch_directory_get_mtime function does not allow the caller to distinguish a timestamp of 0 from a non-existent timestamp. So don't store a timestamp of 0 unless you are comfortable with that.

Return value:

version(DerelictNotMuch_Static)nothrow
notmuch_directory_set_mtime
(
notmuch_directory_t* directory
,
time_t mtime
)

Detailed Description

NOTMUCH STATUS SUCCESS

mtime successfully stored in database.

NOTMUCH STATUS XAPIAN EXCEPTION

A Xapian exception * occurred, mtime not stored.

NOTMUCH STATUS READ ONLY DATABASE

Database was opened in read-only * mode so directory mtime cannot be modified.

Meta