X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fnotmuch.h;h=fe2340bbcbf62470307138aee548427c65a47d3b;hb=cd3d4e62d63819bd8eced5e2d8e5b6e07ea45e41;hp=68896ae75afeeaa27347a284540160833bcd59ad;hpb=29f125212619ebca8621dd2106b412b22e1b6d22;p=notmuch diff --git a/lib/notmuch.h b/lib/notmuch.h index 68896ae7..fe2340bb 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -159,6 +159,10 @@ typedef enum _notmuch_status { * The operation is not supported. */ NOTMUCH_STATUS_UNSUPPORTED_OPERATION, + /** + * The operation requires a database upgrade. + */ + NOTMUCH_STATUS_UPGRADE_REQUIRED, /** * Not an actual status value. Just a way to find out how many * valid status values there are. @@ -287,8 +291,16 @@ notmuch_database_open (const char *path, * * notmuch_database_close can be called multiple times. Later calls * have no effect. + * + * Return value: + * + * NOTMUCH_STATUS_SUCCESS: Successfully closed the database. + * + * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred; the + * database has been closed but there are no guarantees the + * changes to the database, if any, have been flushed to disk. */ -void +notmuch_status_t notmuch_database_close (notmuch_database_t *database); /** @@ -317,8 +329,11 @@ notmuch_database_compact (const char* path, /** * Destroy the notmuch database, closing it if necessary and freeing * all associated resources. + * + * Return value as in notmuch_database_close if the database was open; + * notmuch_database_destroy itself has no failure modes. */ -void +notmuch_status_t notmuch_database_destroy (notmuch_database_t *database); /** @@ -337,22 +352,27 @@ unsigned int notmuch_database_get_version (notmuch_database_t *database); /** - * Does this database need to be upgraded before writing to it? + * Can the database be upgraded to a newer database version? * - * If this function returns TRUE then no functions that modify the - * database (notmuch_database_add_message, notmuch_message_add_tag, - * notmuch_directory_set_mtime, etc.) will work unless the function - * notmuch_database_upgrade is called successfully first. + * If this function returns TRUE, then the caller may call + * notmuch_database_upgrade to upgrade the database. If the caller + * does not upgrade an out-of-date database, then some functions may + * fail with NOTMUCH_STATUS_UPGRADE_REQUIRED. This always returns + * FALSE for a read-only database because there's no way to upgrade a + * read-only database. */ notmuch_bool_t notmuch_database_needs_upgrade (notmuch_database_t *database); /** - * Upgrade the current database. + * Upgrade the current database to the latest supported version. * - * After opening a database in read-write mode, the client should - * check if an upgrade is needed (notmuch_database_needs_upgrade) and - * if so, upgrade with this function before making any modifications. + * This ensures that all current notmuch functionality will be + * available on the database. After opening a database in read-write + * mode, it is recommended that clients check if an upgrade is needed + * (notmuch_database_needs_upgrade) and if so, upgrade with this + * function before making any modifications. If + * notmuch_database_needs_upgrade returns FALSE, this will be a no-op. * * The optional progress_notify callback can be used by the caller to * provide progress indication to the user. If non-NULL it will be @@ -415,6 +435,10 @@ notmuch_database_end_atomic (notmuch_database_t *notmuch); * If this directory object does not exist in the database, this * returns NOTMUCH_STATUS_SUCCESS and sets *directory to NULL. * + * Otherwise the returned directory object is owned by the database + * and as such, will only be valid until notmuch_database_destroy is + * called. + * * Return value: * * NOTMUCH_STATUS_SUCCESS: Successfully retrieved directory. @@ -423,6 +447,9 @@ notmuch_database_end_atomic (notmuch_database_t *notmuch); * * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred; * directory not retrieved. + * + * NOTMUCH_STATUS_UPGRADE_REQUIRED: The caller must upgrade the + * database to use this function. */ notmuch_status_t notmuch_database_get_directory (notmuch_database_t *database, @@ -475,6 +502,9 @@ notmuch_database_get_directory (notmuch_database_t *database, * * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only * mode so no message can be added. + * + * NOTMUCH_STATUS_UPGRADE_REQUIRED: The caller must upgrade the + * database to use this function. */ notmuch_status_t notmuch_database_add_message (notmuch_database_t *database, @@ -505,6 +535,9 @@ notmuch_database_add_message (notmuch_database_t *database, * * NOTMUCH_STATUS_READ_ONLY_DATABASE: Database was opened in read-only * mode so no message can be removed. + * + * NOTMUCH_STATUS_UPGRADE_REQUIRED: The caller must upgrade the + * database to use this function. */ notmuch_status_t notmuch_database_remove_message (notmuch_database_t *database, @@ -560,6 +593,9 @@ notmuch_database_find_message (notmuch_database_t *database, * NOTMUCH_STATUS_OUT_OF_MEMORY: Out of memory, creating the message object * * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred + * + * NOTMUCH_STATUS_UPGRADE_REQUIRED: The caller must upgrade the + * database to use this function. */ notmuch_status_t notmuch_database_find_message_by_filename (notmuch_database_t *notmuch, @@ -937,6 +973,10 @@ notmuch_thread_get_matched_messages (notmuch_thread_t *thread); * authors of mail messages in the query results that belong to this * thread. * + * The string contains authors of messages matching the query first, then + * non-matched authors (with the two groups separated by '|'). Within + * each group, authors are ordered by date. + * * The returned string belongs to 'thread' and as such, should not be * modified by the caller and will only be valid for as long as the * thread is valid, (which is until notmuch_thread_destroy or until @@ -996,7 +1036,7 @@ notmuch_thread_get_newest_date (notmuch_thread_t *thread); * * for (tags = notmuch_thread_get_tags (thread); * notmuch_tags_valid (tags); - * notmuch_result_move_to_next (tags)) + * notmuch_tags_move_to_next (tags)) * { * tag = notmuch_tags_get (tags); * .... @@ -1238,7 +1278,7 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header); * * for (tags = notmuch_message_get_tags (message); * notmuch_tags_valid (tags); - * notmuch_result_move_to_next (tags)) + * notmuch_tags_move_to_next (tags)) * { * tag = notmuch_tags_get (tags); * ....