[PATCH] WIP: support XDG database directory

David Bremner david at tethera.net
Tue Jan 2 16:00:33 PST 2018


Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:

> On Sat 2017-12-30 16:07:40 -0400, David Bremner wrote:
>
>> Just a rebase against current master, based on discussion in IRC
>> today.  AFAIK, the general approach could be extended to support a 
>> "NOTMUCH_DATABASE_DIRECTORY" environment variable, which if think is
>> what Tomi was suggesting previously.
>
> I'm not sure i understand the rationale here -- it looks like this might
> move the notmuch database directory away from its historic location
> alongside the set of maildirs (then "mailstore").  is that right?
>

Correct. This is an often reguested feature.

> 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
  
> is it possible (or should it be) to have one mailstore that is indexed
> by multiple databases?

Yes, this would possible, at least in terms of switching databases
associated with a maildir. It doesn't cost extra implimentation
effort. Whether it's a good thing or not, I don't know. As I write this
I'm reminded that Xapian can search across multiple databases. I'm not
sure if that's worth thinking about here.

> 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? 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.

d


More information about the notmuch mailing list