On Sat, Jan 15, 2000 at 10:57:00PM -0500, Russell Nelson wrote:
 
> I wonder if that couldn't be handled by the Maildir code writing
> Status: XXXXXXX as the very first line in each message?  Then, you
> could change the status by opening the message file, read in the first
> N bytes, modify one of those characters to set the status, and write
> out those bytes again.

Why do you need to store the message state in the message? This could easily
be kept in a (lockable) file in Maildir/. All that is required
is that "MUA" (e.g. IMAP, Mutt, qmail-pop3d) that use the same file agree on
format and possible locking mechanism.

Opening the Maildir means reading the directory, reading the state file,
and marking the messages not in the state file as new, removing messages that
do not exist from the state file. Safe-write the file.
Skip locking if it is acceptable that the state file misses modifications
if two "MUA" access the dir at the same time (no problem, IMHO). Without
locking it is cheap to write the file every x seconds for a client that keeps
the connection to the maildir.

Delivery notifications can be done via program delivery in .qmail, causing
the MUA (that maintains a connection to the maildir) to reread the directory.
There is no reason for the user to notice the time this may take.

Renaming the files doesn't make much sense since a consequence is that a
message may still exist, but not be accessible via its old name.

For very large folders over slow links, the client can display info from the 
state file while scanning the directory. Most likely, the only difference is
a new message or two.

A cdb keyed on the file name would be nice for the state file.

Of course, the name and format for a state file should be defined in the
Maildir format. IMHO, the "INFO" extension to the file name should be
removed from the Maildir format specification. "new" -> "cur" can be
used as a delivery notification. Just read "new" every whatever seconds. Move
files to "cur" and add them to the cached state info.

-- 

-Sincerely, Fred

Fred Lindberg, Inf. Dis., WashU, St. Louis, MO, USA

Reply via email to