On Thu, Oct 10 2013, David Bremner <david@tethera.net> wrote: > Peter Wang <novalazy@gmail.com> writes: > >> On Tue, 10 Sep 2013 09:06:00 +0100, Mark Walters <markwalters1009@gmail.com> wrote: >>> >>> Alternatively maybe add notmuch_database_destroy_with_flush or something >>> which does give a return value. notmuch_database_close is only called 3 >>> times and notmuch_database_destroy lots of times so changing close is >>> much less intrusive than changing destroy. But I don't know whether we >>> would break any bindings or external programs etc. >>> >>> What do you think? >> >> I think notmuch_database_close and notmuch_database_destroy should >> return the status, and we update the three language bindings >> and bump the soname. >> > > I'm not opposed to doing an SONAME bump for 0.17. Are there other ABI > breaking changes that we have been holding back on? Can these maybe go > through at the same time? Maybe something along these lines... (Quick draft for the API part; to start discussion before working too much for something that is going to be dropped...) diff --git a/lib/notmuch.h b/lib/notmuch.h index 9dab555..ae52dab 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -106,6 +106,17 @@ typedef enum _notmuch_status { NOTMUCH_STATUS_LAST_STATUS } notmuch_status_t; +/* Structure to provide logging interface to the notmuch library + * + * ... + */ + +typedef struct _notmuch_loghook { + void (*func)(struct _notmuch_loghook *, int level, int status, + const char * format, ...); +} notmuch_loghook_t; + + /* Get a string representation of a notmuch_status_t value. * * The result is read-only. @@ -159,7 +170,9 @@ typedef struct _notmuch_filenames notmuch_filenames_t; * NOTMUCH_STATUS_XAPIAN_EXCEPTION: A Xapian exception occurred. */ notmuch_status_t -notmuch_database_create (const char *path, notmuch_database_t **database); +notmuch_database_create (const char *path, + notmuch_loghook_t *loghook, + notmuch_database_t **database); typedef enum { NOTMUCH_DATABASE_MODE_READ_ONLY = 0, @@ -200,6 +213,7 @@ typedef enum { notmuch_status_t notmuch_database_open (const char *path, notmuch_database_mode_t mode, + notmuch_loghook_t *loghook, notmuch_database_t **database); /* Close the given notmuch database. > > d Tomi