This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.
Differences between revisions 1 and 2
Revision 1 as of 2009-12-16 01:53:14
Size: 2080
Editor: TimoSirainen
Revision 2 as of 2021-09-24 15:29:18
Size: 72
Editor: TimoSirainen
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Mail Storage =

{{{src/lib-storage/mail-storage.h}}} and {{{mail-storage-private.h}}} describes mail storage. Mail storage is mainly about being a common container for its mailboxes. For example with [[MailboxFormat/dbox|multi-dbox]] each storage has one directory where all the message bodies are written to, while the per-mailbox directories only contain index files. With other mailbox formats mail storage doesn't do much else than allow allocating [[Design/Storage/Mailbox|mailboxes]].

The only public functions for mail storage are:
 * {{{mail_storage_purge()}}} frees disk space used by expunged messages. Currently the only mailbox format that uses this is multi-dbox.
 * {{{mail_storage_get_settings()}}} returns mail storage settings.
 * {{{mail_storage_set_callbacks()}}} can be used to specify "OK" and "NO" callbacks, which are called when a long running operation wants to send a status update. For example "OK Stale mailbox lock file detected, will override in n seconds" or "NO Mailbox is locked, will abort in n seconds".

Methods that mail storage backends need to implement are:
 * {{{get_setting_parser_info()}}}: Returns storage-specific settings parser information.
 * {{{alloc()}}}: Allocate memory for a storage and set its virtual functions.
 * {{{create(ns)}}}: Initialize the storage based on given namespace settings. The same storage can be used by other namespaces, but they don't call {{{create()}}} again. This function typically shouldn't fail, except when storage can't handle the wanted namespace settings.
 * {{{destroy()}}}: Destroys the storage.
 * {{{add_list(list)}}}: Called every time the storage is attached to a new namespace / mailbox list.
 * {{{get_list_settings(ns, set)}}}: Used to get storage's default settings.
 * {{{autodetect(ns, set)}}}: Returns TRUE if based on the given settings it looks like this storage should be handling the namespace. This is done when mail_location doesn't explicitly specify the mailbox format.
 * {{{mailbox_alloc()}}}: Allocate memory for [[Design/Storage/Mailbox|mailbox]].
Moved to

None: Design/Storage/MailStorage (last edited 2021-09-24 15:29:18 by TimoSirainen)