Sam Varshavchik wrote:
> certain poor aspects of 
> IMAP's design that makes it difficult to efficiently implement every 
> possible permutation of an IMAP command with an existing mail store 
> (IMAP is heavily biased towards an IMAP-specific mail store, rather than 
> a generic one like a maildir)

I was thinking about possible designs for keyword implementations that 
would reduce IO.  I wondered if storing keywords in files were not a 
design that suffers the same problems that mbox did.

What if, rather than the current implementation, each Maildir had an 
"imapkeywords" directory.  This directory may contain sub-directories 
whose names represent the keywords that have been set on messages in the 
Maildir.  When a keyword is set on a message, a hard link (or symbolic 
link?) is created in the appropriate directory; the name of the link 
should be the same as the file containing the message, minus the flags 
at the end of its name.

With this design, adding a keyword to a message is (usually) an atomic 
operation.  The IMAP server should first try to create the link.  If the 
attempt fails, it should then check for the presence of the keyword 
directory, create it if missing, and attempt to link the file again.

Removing a keyword is also an atomic operation.  Simply unlink the path 
corresponding to the keyword link.

I would imagine that building a list of files with keywords should go 
something like:
* scan the keywords directories and create a list of keywords in the Maildir
* scan each keyword directory and create a hash containing the names of 
message file links
* scan the cur/ directory for message files.  For each one, check all of 
the keyword hashes for a match against the file name minus the flags at 
the end.  If there is a match, record that the message was tagged with 
that keyword.

It should be possible to scan each directory using only readdir(), to 
reduce the IO associated with calling stat() on an indefinite number of 
message files.

Do you think that such a design is possible, Sam?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to