From 84210719afb573b8bdebcaa689edeef8e7c12bbc Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 3 Dec 2013 19:29:25 +0200 Subject: [PATCH] Re: [PATCH 2/2] lib: introduce notmuch_database_new for initializing a database handle --- 73/4ed673f9ed2a0d8d832fdd58ec741cc745ffcc | 142 ++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 73/4ed673f9ed2a0d8d832fdd58ec741cc745ffcc diff --git a/73/4ed673f9ed2a0d8d832fdd58ec741cc745ffcc b/73/4ed673f9ed2a0d8d832fdd58ec741cc745ffcc new file mode 100644 index 000000000..0f2b5bb79 --- /dev/null +++ b/73/4ed673f9ed2a0d8d832fdd58ec741cc745ffcc @@ -0,0 +1,142 @@ +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 AD88A431FB6 + for ; Tue, 3 Dec 2013 09:29:42 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 MciZTFxFf+oi for ; + Tue, 3 Dec 2013 09:29:32 -0800 (PST) +Received: from mail-la0-f49.google.com (mail-la0-f49.google.com + [209.85.215.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 6B83B431FAF + for ; Tue, 3 Dec 2013 09:29:32 -0800 (PST) +Received: by mail-la0-f49.google.com with SMTP id er20so9127527lab.22 + for ; Tue, 03 Dec 2013 09:29:30 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=AyxMUfch6hzCTdfTip7ttrxAP1UixqxujwYXYX6qSUo=; + b=C7ua/2jP7txnbeVwxQVtMR+6saU3sbDaRem+/O9kVMbla3qRoqs2WTIvti4BTBrXZR + vqtBAjdrDWCOYIqRdHaRmd1sUnBuWx8HSXkokRgQka4ERbF37pkLpjkHJCiVUxkBwVrL + brP8Ld5MaP27I4vvrpXVziDh87stVf5e0Va7OEnh2nJ8cE8SoDUq/vORzlKSSQnDU8qW + Af1HDVH163TZHRaWAVVMRRgjG6BAyypAjZoLIcmZg4EDP9qRNMvSjNhLv1LQzFGhzE/h + OpNym0Wnijs+FkC6YBvAb1jfJ0Imdam/zMoufuDQ0INyPK1m8h2EbGWZRHjst2GgyLRz + 3iQg== +X-Gm-Message-State: + ALoCoQkc00zllFj9997RNzx/8ISf2CDEJbJ5VjyUsBxOYmfQzfJs2zVGodFHIr1KixA7NB4AGerB +X-Received: by 10.152.242.8 with SMTP id wm8mr76322lac.76.1386091770646; + Tue, 03 Dec 2013 09:29:30 -0800 (PST) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + ld10sm17458298lab.8.2013.12.03.09.29.28 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Tue, 03 Dec 2013 09:29:29 -0800 (PST) +From: Jani Nikula +To: Tomi Ollila , David Bremner , + notmuch@notmuchmail.org +Subject: Re: [PATCH 2/2] lib: introduce notmuch_database_new for initializing + a database handle +In-Reply-To: +References: + + <87wqjm2m2q.fsf@zancas.localnet> + +User-Agent: Notmuch/0.16+145~gebbaa94 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Tue, 03 Dec 2013 19:29:25 +0200 +Message-ID: <871u1tyhai.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +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: Tue, 03 Dec 2013 17:29:42 -0000 + +On Tue, 03 Dec 2013, Tomi Ollila wrote: +> On Tue, Dec 03 2013, David Bremner wrote: +> +>> The first patch looks ok. I like the new API overall. +>> +>> As far as breaking contrib/notmuch-deliver, I'd rather fix +>> notmuch-insert than put effort into notmuch-deliver at this point. I +>> guess it could be a rough transition for people running notmuch-deliver +>> from git. +>> +>> Jani Nikula writes: +>> +>>> +/* +>>> + * XXX: error handling should clean up *all* state created! +>>> + */ +>> is this a warning to future hackers or some current problem? +>> +>>> notmuch_status_t +>>> -notmuch_database_open (const char *path, +>>> - notmuch_database_mode_t mode, +>>> - notmuch_database_t **database) +>>> +notmuch_database_open (notmuch_database_t *notmuch, const char *path, +>>> + notmuch_database_mode_t mode) +>>> +>>> +/* Initialize a new, empty database handle. +>>> + * +>> +>> I wondered about making the new documentation adhere to doxygen? +>> +>> +>>> + if (notmuch_database_open (notmuch, +>>> + notmuch_config_get_database_path (config), +>>> + NOTMUCH_DATABASE_MODE_READ_ONLY)) +>> +>> Would it make any sense to migrate the mode argument to an option +>> setting while we're messing with the API? +> +> if that, then also database_path to options ? + +See my reply to David. + +> I also like this suggestion best of all seen so far, but what if: +> +> #define NOTMUCH_MAJOR_VERSION 0 +> #define NOTMUCH_MINOR_VERSION 17 +> -#define NOTMUCH_MICRO_VERSION 0 +> +#define NOTMUCH_MICRO_VERSION 90 +> +> until changed API/ABI is set into stone (i.e. 0.18.0 at freeze time). + +That would require the user to conditional build with: + +#if NOTMUCH_CHECK_VERSION(0, 17, 90) + /* building against post-0.17 git master or released 0.18 */ +#else + /* building against 0.17 */ +#endif + +instead of the IMHO more natural and accurate: + +#if NOTMUCH_CHECK_VERSION(0, 18, 0) + /* building against post-0.17 git master or released 0.18 */ +#else + /* building against 0.17 */ +#endif + + +BR, +Jani. -- 2.26.2