unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] WIP: support XDG database directory
Date: Tue, 02 Jan 2018 19:42:06 -0500	[thread overview]
Message-ID: <87r2r7epsx.fsf@fifthhorseman.net> (raw)
In-Reply-To: <87a7xv3j6m.fsf@tethera.net>

On Tue 2018-01-02 20:00:33 -0400, David Bremner wrote:
> Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
>> where would each such notmuch database live if there were two different
>> mailstores?  how is any given mailstore bound to the associated notmuch
>> database itself?
>
> Each database would point to the associated maildir_root in this version.
>
>> does the user point explicitly to both the mailstore
>> and the database?
>
> at the library level, I'm thinking the right API is probably to take
> both parameters (database and maildir), and if
>
> - database_path is NULL => look in traditional .notmuch location
>   current notmuch_database_open would call something like
>           notmuch_database_open2 (maildir, NULL).
>   Presumable with a more informative name.
>   
> - maildir_path is NULL => look in the database for a configuration
>
> - both are NULL => look in $ENV{NOTMUCH_DATABASE_DIRECTORY} and then
>   under $ENV{XDG_DATA_HOME}/notmuch, using the database to find the
>   maildir (essentially this patch)
>
>   This last case is aimed at allowing users of the library to open a
>   "default" database without the current parsing of .notmuch-config

i like the sound of this, but...

>> i ask because i've been thinking about ways to protect the index itself,
>> but i want to make sure i understand all the different ways that the
>> mailstore and the database are (or are not) coupled to each other.
>
> I guess the initial proposal would be not at all?

this doesn't seem like a correct characterization of it, unless we're
misunderstanding each other.

it looks to me like each notmuch database *would* be coupled with
exactly one mailstore, given this proposal.  is that right?

if the library tried to open the database on its own, it would look at
the database's stored maildir_root path.

or am i missing something?

> That probably allows a few new kinds of user error; I'm imagining
> runing notmuch new with mismatched database and maildir, and happily
> deleteing all of the database documents.

yikes!  still, i agree that in general i'd rather point notmuch at the
database and have it discover everything it needs to from that; rather
than the current approach of the split config file and database, which
seems cumbersome and error-prone in other ways.

that said, i *definitely* prefer the database identifying the mailstore
(as you've done here) rather than the other way around.

one final question: for portable databases, which live on a removable
volume, or which are on networked-accessible storage and might be
mounted in different places on different computers, do we have a way to
protect them from the "whoops, mailstore is missing because you are on
the wrong host" or ("…because you mounted the USB stick at /Media/foo
instead of /Volumes/foo") scenario?

        --dkg

  reply	other threads:[~2018-01-03  0:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-30 20:07 [PATCH] WIP: support XDG database directory David Bremner
2018-01-02 23:14 ` Daniel Kahn Gillmor
2018-01-03  0:00   ` David Bremner
2018-01-03  0:42     ` Daniel Kahn Gillmor [this message]
2018-01-03  1:01       ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2r7epsx.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).