⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formats.txt

📁 Vovida 社区开源的 SIP 协议源码
💻 TXT
字号:
		    Mailbox Format Characteristics			     Mark Crispin			     5 June 1999     When a mailbox storage technology uses local files anddirectories directly, the file(s) and directories are layed out in amailbox format.I. Flat-File Formats     In these formats, a mailbox and all the messages inside are asingle file on the filesystem.  The mailbox name is the name of thefile in the filesystem, relative to the user's "mail home directory."     A flat-file format mailbox is always a file, never a directory.This means that it is impossible to have a flat-file format mailboxthat has inferior mailbox names under it (so-called "dual-usage"mailboxes).  For some inexplicable reason, some people want this.     The mail home directory is usually the same as the user loginhome directory if that concept is meaningful; otherwise, it is someother default directory (e.g. "C:\My Documents" on Windows 98).  Thiscan be redefined by modifying the c-client source code or in anapplication via the SET_HOMEDIR mail_parameters() call.     For example, a mailbox named "project" is likely to be found inthe file "project" in the user's home directory.  Similarly, a mailboxnamed "test/trial1" (assuming a UNIX system) is likely to be found inthe file "trial1" in the subdirectory "test" in the user's homedirectory.     Note that the name "INBOX" has special semantics and rules, asdescribed in the file naming.txt.     The following flat-file formats are supported by c-client as ofthe time of this writing:. unix	This is the traditional UNIX mailbox format, in use for nearly	30 years.  It uses a line starting with "From " to indicate	start of message, and stores the message status inside the	RFC822 message header.	unix is not particularly efficient; the entire mailbox file	must be read when the mailbox is open, and when reading message	texts it is necessary to convert the newline convention to	Internet standard CR LF form.  unix preserves UIDs, and allows	the creation of keywords.	Only one process may have a unix-format mailbox open	read/write at a time.. mmdf	This is the format used by the MMDF mailer.  It uses a line	consisting of 4 <CTRL/A> (0x01) characters to indicate start	and end of message.  Optionally, there may also be a unix	format "From " line.  It otherwise has the same	characteristics as unix format.. mbx	This is the current preferred mailbox format.  It can be	handled quite efficiently by c-client, without the problems	that exist with unix and mmdf formats.  Messages are stored	in Internet standard CR LF format.	mbx permits shared access, including shared expunge.  It	preserves UIDs, and allows the creation of keywords.. mtx	This is supported for compatibility with the past.  This is	the old Tenex/TOPS-20 mail.txt format.  It can be handled	quite efficiently by c-client, and has most of the	characteristics of mbx format.	mtx is deficient in that it does not support shared expunge;	it has no means to store UIDs; and it has no way to define	keywords except through an external configuration file.. tenex	This is supported for compatibility with the past.  This is	the old Columbia MM format.  This is similar to mtx format,	only it uses UNIX-style bare-LF newlines instead of CR LF	newlines, thus incurring a performance penalty for newline	conversion.. phile	This is not strictly a format.  Any file which is not in a	recognized format is in phile format, which treats the entire	contents of the file as a single message.II. File/Message Formats     In these formats, a mailbox is a directory, and each the messagesinside are separate files inside the directory.  The file names ofthese files are generally the text form of a number, which alsomatches the UID of the message.     In the case of mx, the mailbox name is the name of the directoryin the filesystem, relative to the user's "mail home directory."  Inthe case of news and mh, the mailbox name is in a separate namespaceas described in the file naming.txt.     A file/message format mailbox is always a directory.  This meansthat it is possible to have a file/message format mailbox that hasinferior mailbox names under it (so-called "dual-usage" mailboxes).For some inexplicable reason, some people want this.     Note that the name "INBOX" has special semantics and rules, asdescribed in the file naming.txt.     The following file/message formats are supported by c-client as ofthe time of this writing:. mx	This is an experimental format, and may be removed in a future	release.  An mx format mailbox has a .mxindex file which holds	the message status and unique identifiers.  Messages are	stored in Internet standard CF LF form, so the file size of	the message file equals the size of the message.	mx is somewhat inefficient; the entire directory must be read	and each file stat()'d.  We found it intolerable for a	moderate sized mailbox (2000 messages) and have more or less	abandoned it.	. mh	This is supported for compatibility with the past.  This is	the format used by the old mh program.	mh is very inefficient; the entire directory must be read	and each file stat()'d, and in order to determine the size	of a message, the entire file must be read and newline	conversion performed.	mh is deficient in that it does not support any permanent	flags or keywords; and has no means to store UIDs (because	the mh "compress" command renames all the files, that's	why).. news	This is an export of the local filesystem's news spool, e.g.	/var/spool/news.  Access to mailboxes in news format is read	only; however, message "deleted" status is preserved in a	.newsrc file in the user's home directory.  There is no other	status or keywords.	news is very inefficient; the entire directory must be	read and each file stat()'d, and in order to determine the	size of a message, the entire file must be read and newline	conversion performed.	news is deficient in that it does not support permanent flags	other than deleted; does not support keywords; and has no	expunge.Soapbox on File/Message Formats     If it sounds from the above descriptions that we're not puttingtoo much effort into file/message formats, you are correct.     There's a general reason why file/message formats are a bad idea.Just about every filesystem in existance serializes file creation anddeletions because these manipulate the free space map.  This turns outto be an enormous problem when you start creating/deleting more than afew messages per second; you spend all your time thrashing in thefilesystem.     It is also extremely slow to do a text search through afile/message format mailbox.  All of those open()s and close()s reallyadd up to major filesystem thrashing.What about Cyrus and Maildir?     Both formats are vulnerable to the filesystem trashing outlinedabove.     The Cyrus format used by CMU's Cyrus server (and Esys' server)has a special associated flat file in each directory that containsextensive data (including pre-parsed ENVELOPEs and BODYSTRUCTUREs)about the messages.  Put another way, it's a (considerably) morefeatureful form of mx.  It also uses certain operating systemfacilities (e.g. file/memory mapping) which are not available on oldersystems, at a cost of much more limited portability than c-client.These considerably ameliorate the fundamental problems withfile/message formats; in fact, Cyrus is halfway to being a database.Rather than support Cyrus format in c-client, you should run Cyrus orEsys if you want that format.     The Maildir format used by qmail has all of the performancedisadvantages of mh noted above, with the additional problem that thefiles are renamed in order to change their status so you end up havingto rescan the directory frequently the current names (particularly ina shared mailbox scenario).  It doesn't scale, and it represents asupport nightmare; it will therefore never be supported in theofficial distribution.  Maildir support code for c-client is availablefrom third parties; but, if you use it, it is entirely at your ownrisk (read: don't complain about how poorly it performs or bugs).So what does this all mean?     A database (such as used by Exchange) is really a much betterapproach if you want to move away from flat files.  mx and especiallyCyrus take a tenative step in that direction; mx failed mostly becauseit didn't go anywhere near far enough.  Cyrus goes much further, andscores remarkable benefits from doing so.     However, a well-designed pure database without the overhead ofseparate files would do even better.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -