From: Tomi Ollila Date: Wed, 23 Oct 2013 19:05:26 +0000 (+0300) Subject: Re: [PATCH 1/3] cli: add insert --must-index option X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c0cc83085776cc74632e7d0d89fb9d003fdbfda0;p=notmuch-archives.git Re: [PATCH 1/3] cli: add insert --must-index option --- diff --git a/3e/df31d00a11a0bbcf6b406cca89c8e6a271fb4b b/3e/df31d00a11a0bbcf6b406cca89c8e6a271fb4b new file mode 100644 index 000000000..244d6a0ba --- /dev/null +++ b/3e/df31d00a11a0bbcf6b406cca89c8e6a271fb4b @@ -0,0 +1,137 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 5512A431FC7 + for ; Wed, 23 Oct 2013 12:05:40 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id K-squcbNu2j0 for ; + Wed, 23 Oct 2013 12:05:35 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 9918B431FBC + for ; Wed, 23 Oct 2013 12:05:35 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 534D4100217; + Wed, 23 Oct 2013 22:05:27 +0300 (EEST) +From: Tomi Ollila +To: David Bremner +Subject: Re: [PATCH 1/3] cli: add insert --must-index option +In-Reply-To: <87bo2xtdp2.fsf@unb.ca> +References: <1374365254-13227-1-git-send-email-novalazy@gmail.com> + <87ip048gbj.fsf@qmul.ac.uk> + <20130727151510.GA13750@hili.localdomain> + <87hadtxfrr.fsf@qmul.ac.uk> + <20130912001349.GA18821@hili.localdomain> + <87zjqhv264.fsf@zancas.localnet> + <87bo2xtdp2.fsf@unb.ca> +User-Agent: Notmuch/0.16+115~g11c2ff5 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 23 Oct 2013 19:05:40 -0000 + +On Thu, Oct 10 2013, David Bremner wrote: + +> Tomi Ollila writes: +>>> 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 mu= +ch +>> for something that is going to be dropped...) +>> +>> notmuch_status_t +>> -notmuch_database_create (const char *path, notmuch_database_t **databas= +e); +>> +notmuch_database_create (const char *path, +>> + notmuch_loghook_t *loghook, +>> + notmuch_database_t **database); +> +> Another idea floated (by Austin?) was to pass in an options struct, to +> allow future options to be added without changing the function +> signature. I guess with some care this could be done in an upwardly +> compatible way. + +Maybe something like + +#define NOTMUCH_API_OPTIONS_VERSION 1 +typedef struct { + int options_version; + void (*log)(void *, int level, int status, const char * format, ...= +); + void * logdata; +} notmuch_options_t;=20=20=20=20=20=20=20=20 + +... + +notmuch_status_t +notmuch_database_create (const char *path, + notmuch_options_t *options, + notmuch_database_t **database); +... + +notmuch_status_t +notmuch_database_open (const char *path, + notmuch_database_mode_t mode, + notmuch_options_t *options, + notmuch_database_t **database); + +then in use: + +notmuch_options_t options =3D { + .options_version =3D NOTMUCH_API_OPTIONS_VERSION, + +.. =C3=A4sh, this has problem that the macro changes in header file +but the structure initialization is not following automatically +(in other fields than that). Therefore perhaps "fixing" +the version macros: + +#define NOTMUCH_API_OPTIONS_VERSION_1 1 +/* #define NOTMUCH_API_OPTIONS_VERSION_2 2 // added in the future */ + +notmuch_options_t options =3D { + .options_version =3D NOTMUCH_API_OPTIONS_VERSION_1, + .log =3D log_to_stderr, + .logdata =3D NULL +}; + +Well, this is one idea (does not sound as good as I initially +thought...) how does other software tackle this kind of issues... + +If something like this is finally chosen we could provide easy +transition path to allow NULL as options -- making notmuch CLI +behave as it used to be (log to stderr...). + + +> d + +Tomi