[Dovecot] Save/restore IMAP session state

Timo Sirainen tss at iki.fi
Mon Oct 29 18:53:00 EET 2012


Some future Dovecot version will have "imap-idle" processes where
IDLEing IMAP connections get moved, so the system wouldn't waste so much
memory for all the IDLEing imap processes. A week ago I thought I'd see
how easy it would be to implement this. I got a basic proof of concept
working as a "X-STATE" command.

Save the state:

a x-state
* STATE AQDLW45QdwAAAAMAAABuAQAAAAAAAFAcffYAPHnpFctbjlDbYQAAcEmzCwAA
a OK State exported.

Restore the state:

b x-state AQDLW45QdwAAAAMAAABuAQAAAAAAAFAcffYAPHnpFctbjlDbYQAAcEmzCwAA
b OK State imported.

This could also be used to implement quick session state restoring for
webmails (as suggested by Michael Slusarz).

For getting the imap-idle process there would have to be code that:
 * triggers the session saving when process is IDLEing
 * figures out what filesystem paths the imap-idle should be looking at
(i.e. paths to selected mailbox's dovecot.index.log file and maybe for
e.g. maildir new/)
 * send the session state string, paths and imap connection fd to
imap-idle process via UNIX socket
 * implement the actual imap-idle process
 * implement a way for imap-idle process to send back the state and
connection fd to restore the imap process

The patch is ugly and still missing many things. Anyway I thought I'd
include it here just in case someone was really eager to continue
implementing it. :) I'm not sure when I'll have time for it.

A full patch would probably have to have some
session_save()/session_restore() functions in lib-storage API. But a
quick and dirty way is possible to implement for v2.1 as well, as long
as some IMAP extensions aren't used (most importantly rfc5267).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imap-state.diff
Type: text/x-patch
Size: 11305 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20121029/c4e6f599/attachment-0002.bin>


More information about the dovecot mailing list