[Dovecot] bidirectional synchronization of dovecot-managed maildirs

James Leifer James.Leifer at inria.fr
Mon Dec 27 17:11:35 EET 2004


Hello and happy holidays,

I've been thinking about high performance bidirectional synchronizing
the mail on my laptop (which is frequently disconnected) and my
workstation at work (which is always on and receives all inbound
mail).  Both run dovecot on top of maildir.

I've been playing with offlineimap, unison (which I already use for
all my non-mail files), as well as the gnus agent (in IMAP
"disconnected mode").  None of these solutions is really satisfactory:

* offlineimap treats a message refile between folders as a
  delete-plus-resend;

* unison doesn't understand the semantics of flag changes at the end
  of files in maildirs; it also has to stat all the files (which can
  become slow) to detect changes;

* gnus agent can't refile messages between folders when in
  disconnected mode.

Perhaps there are better disconnected IMAP modes available for other
MUAs, but, it seems like a more general solution would be
appropriate. 

In particular, the "uniq" field of a maildir filename is an easy way
of tracking the identity of a message as it gets refiled.  My
question: would it be difficult to patch dovecot so that it maintained
the *same* uniq when copying messages between folders?

What about adding hooks that get triggered whenever dovecot copies or
deletes messages?  These hooks could log the changes. Later, when one
tries to sync, one merges the changes from both replicas and then
applies them.

I'm aware that dovecot has an option to do copies as hardlinks, which
is a good start, but still requires one to stat the files to discover
which have the same inode.  This is *much* slower than simply listing
the directories and comparing maildir "uniq" fields.

I'm aware that this invariant wouldn't be maintained if other programs
modified the maildirs under dovecot's nose, but I'm willing to exclude
this possibility.

Suggestions?

Best regards,
-James Leifer



More information about the dovecot mailing list