annotate doc/mail-storages.txt @ 1741:9df02b1533b3 HEAD

Removed most of the license comments from src/lib/*.c. It's just fine to keep them in a single COPYING.MIT file. Changed a few other comments as well.
author Timo Sirainen <tss@iki.fi>
date Wed, 27 Aug 2003 00:18:16 +0300
parents 19ef482ece51
children 1f92f41addea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
1 Maildir
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
2 -------
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 We support Courier-compatible Maildir++. INBOX is the ~/Maildir directory,
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 all the other folders named as ".<folder>.<subfolder>.<etc>" under it, any
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 directories not starting with a dot are simply ignored. Deleting folders is
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 made atomic by renaming them as "..<folder name>" and deleting the
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8 directory after that. So, all directories beginning with ".." are deleted
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9 whenever they're noticed. Indexes are stored into each folder's root
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 directory.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 Custom flags saved using a..z letters as Maildir file flags. .customflags
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 file is then used to map the letters to names (a=0, b=1, etc).
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
15
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
16 mbox
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
17 ----
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18
815
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
19 mbox storage requires an IMAP root directory where to store IMAP folders
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
20 and some other information. mbox file for INBOX is a special case which may
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
21 exist elsewhere in filesystem.
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
22
815
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
23 All files in the IMAP root directory not beginning with a "." are treated
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
24 as IMAP folders. Directories are treated as being IMAP subfolders.
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
25
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
26 Dovecot's indexes are stored in ".imap/<mailbox name>/" directories under
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
27 the folder directories.
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
28
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
29 MAIL environment for mbox is: <root folder>|<INBOX path>[:INBOX=<path>].
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
30 For example ~/Mail:INBOX=/var/mail/username.
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
31
817
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
32 indexes
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
33 -------
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
34
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
35 It's possible to specify different location for index files. This could be
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
36 wanted if mailboxes are accessed via remote filesystem (eg. NFS). Indexes
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
37 are mmap()ed and fcntl() locked, so they may not work too well with NFS, or
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
38 at least they'll work a bit slowly.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
39
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
40 Indexes don't contain anything really important in them, so it doesn't
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
41 matter if they're lost or are out of sync. Dovecot just rebuilds or
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
42 refreshes them. This would allow creating a cluster where each computer
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
43 keeps the indexes locally while accessing the actual mailboxes via NFS. To
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
44 avoid unnecessarily rebuilding indexes all the time, the users should be
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
45 redirected to their primary server whenever possible.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
46
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
47 Currently the only annoying thing with recreating indexes is that the
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
48 message UIDs will change, which may cause more traffic to clients, and
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
49 depending on client software may cause loss of some message-specific
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
50 settings. This will be fixed later by storing the UIDs permanently to
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
51 mailboxes.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
52
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
53 Adding :INDEX=<dir> to MAIL environment overrides the default location. The
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
54 given directory must exist.
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
55
1238
2512ad6fd9e9 Index opening rewrites. We don't try to support .imap.index-<hostname> style
Timo Sirainen <tss@iki.fi>
parents: 817
diff changeset
56 It's also possible to disable index files by building them into memory.
2512ad6fd9e9 Index opening rewrites. We don't try to support .imap.index-<hostname> style
Timo Sirainen <tss@iki.fi>
parents: 817
diff changeset
57 They're also automatically built into memory if the index files can't be
2512ad6fd9e9 Index opening rewrites. We don't try to support .imap.index-<hostname> style
Timo Sirainen <tss@iki.fi>
parents: 817
diff changeset
58 opened or created for some reason (eg. out of disk space). To disable
2512ad6fd9e9 Index opening rewrites. We don't try to support .imap.index-<hostname> style
Timo Sirainen <tss@iki.fi>
parents: 817
diff changeset
59 indexes always, add :INDEX=MEMORY to MAIL environment.
2512ad6fd9e9 Index opening rewrites. We don't try to support .imap.index-<hostname> style
Timo Sirainen <tss@iki.fi>
parents: 817
diff changeset
60
817
86cf24da85f1 Added :INDEX=<dir> for both Maildir and mbox to specify different location
Timo Sirainen <tss@iki.fi>
parents: 815
diff changeset
61
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
62 Detecting what to use
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
63 ---------------------
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
64
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 imap process detects the storage from MAIL-environment. It's preferred
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
66 format is "<storage>:<data>", for example "maildir:~/Maildir". It's anyway
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 allowed to be in pretty much any format as long as some of the storages
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68 recognizes it as a valid data, so for example "MAIL=~/mail" is first
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
69 checked by maildir storage to see if it's valid maildir and mbox storage
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 after that.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72 If the MAIL environment isn't given at all, all storages are gone through
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 and asked if they can find a usable mail folder. Also as a special case, if
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 MAILDIR environment exists, maildir storage is used with the directory
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75 specified in it.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
76
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
77 Maildir storage is autodetected by checking if <directory>/cur/ exists and
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78 we have rwx access to it. If directory isn't known, / and ~/Maildir are
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
79 checked. / is checked because we could be chrooted.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80
815
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
81 mbox storage requires detecting INBOX location and IMAP root directory. If
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
82 MAIL environment points to file (+rw) it's treated as the INBOX file. If it
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
83 points to directory (+rwx) which contains .imap/ (+rwx), inbox (+rw) or
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
84 mbox (+rw) it's treated as IMAP root directory. If INBOX isn't known,
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
85 imap_root/inbox file is used by default. If root directory isn't known, we
ef64c9a50326 Support for separate location of mbox INBOX folder.
Timo Sirainen <tss@iki.fi>
parents: 430
diff changeset
86 try to find it from /, ~/mail or ~/Mail.
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
87
430
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
88
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
89 Files created by Dovecot
b3073f5b1e37 updates
Timo Sirainen <tss@iki.fi>
parents: 429
diff changeset
90 ------------------------
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
91
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
92 .subscriptions: One folder per line listing subscribed IMAP folders.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
93 There's only one of these files in the root mail directory (~/Maildir/ or
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
94 ~/mail/.imap/).
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
95
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
96 Then there's the per-folder files:
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
97
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
98 .imap.index: Fixed width mail index records.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
99
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
100 .imap.index.data: Variable width data, for example mail file name and
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
101 cached body, envelope, etc.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
102
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
103 .imap.index.log: Log file describing made changes. This file is used to
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
104 mark external changes (expunges and flag changes) temporarily until they're
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
105 synced into IMAP clients. If multiple Dovecots have the same folder open,
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
106 this can be a big speedup.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
107
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
108 .imap.index.tree: Binary tree used for looking up messages from .imap.index
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
109 file. This is used for both UID lookups and message sequence lookups.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
110 Sequences can be looked up directly from the index as long as no messages
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
111 have been expunged, but after that it gets slow unless it's compressed.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
112 Using this file however can keep the sequence lookups and expunges fast in
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113 all situations without requiring compression.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
114
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
115 .customflags: Lists custom message flags. First line is header which
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
116 Dovecots check to see if the file has changed. Other lines list the flags
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
117 in format "<flag number> <flag name>". Currently there can be 26 different
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
118 flags (0..25).
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
119
1593
19ef482ece51 We don't lose UIDs anymore if index is deleted.
Timo Sirainen <tss@iki.fi>
parents: 1238
diff changeset
120 .imap.index* files can be deleted without any data loss, they're simply
19ef482ece51 We don't lose UIDs anymore if index is deleted.
Timo Sirainen <tss@iki.fi>
parents: 1238
diff changeset
121 recreated/rebuilt when they're noticed missing.
429
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
123 Deleting .customflags results in loss of custom flag names for Maildir.
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
124 With mbox the .customflags is simply recreated based on the flags listed
58899a413569 Documentation updates.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
125 in the mbox file itself (ie. no data loss).