[PATCH] Mailstore abstraction v4 - part 2 (maildir synchronization)

Michal Sojka sojkam1 at fel.cvut.cz
Mon Apr 12 04:47:59 PDT 2010


On Mon, 12 Apr 2010, martin f krafft wrote:
> also sprach Michal Sojka <sojkam1 at fel.cvut.cz> [2010.04.08.1713 +0200]:
> >    I'm working on the solution - if the mailstore cannot open the
> >    message with the name passed, it tries different names with
> >    different maildir flags.
> 
> Wouldn't it be better to postpone synchronisation of the tags until
> after emacs is done with the message?

Theoretically, it would be possible, but if, for some reason, the
synchronization step would not happen, then the tags in the database and
in the mailstore will be inconsistent and next run of notmuch new would
reset the tags according to the state in mailstore.

The current implementation takes tags in mailstore as authoritative and
ensures that tags in mailstore are always updated before tags in the
database.

> I understand this might be hard to make work with mailstore
> abstraction. Wouldn't it make more sense to have emacs call 'notmuch
> cat', which returns the entire message, removes the unread tag,
> changes the filename, and updates the database?

I do not like the fact that cat would do two things - cat and tag. And
then, 'unread' tag is not the only one which can be changed.
 
> The message returned by cat would be stored in a temporary file for
> use by the client (emacs). And if the message was needed again, you
> could just search for it again.
> 
> I dislike the idea of heuristically probing a Maildir for files.

Well, I do not plan to use wired heuristics. At the end there will be
readdir() to traverse the cur/ directory to find the file with the same
part before flags. Since the S flag will probably be the most frequent
change, I may add one single test for added S flag before trying more
expensive readdir().

-Michal


More information about the notmuch mailing list