comparison unix-phil.ms @ 34:0b2cf026d93d

rework of MH's data storage section
author meillo@marmaro.de
date Thu, 25 Mar 2010 22:18:55 +0100
parents 0bd43c4ad9f8
children f11406a85319
comparison
equal deleted inserted replaced
33:0bd43c4ad9f8 34:0b2cf026d93d
806 without leaving the shell. 806 without leaving the shell.
807 807
808 .NH 2 808 .NH 2
809 Data storage 809 Data storage
810 .LP 810 .LP
811 \s-1MH\s0's mail storage is (only little more than) a directory tree 811 \s-1MH\s0's mail storage is a directory tree under the user's
812 where mail folders are directories and mail messages are text files. 812 \s-1MH\s0 directory (usually \f(CW$HOME/Mail\fP),
813 Working with \s-1MH\s0's toolchest is much like working 813 where mail folders are directories and mail messages are text files
814 with Unix' toolchest: 814 within them.
815 \f(CWscan\fP is like \f(CWls\fP, 815 Each mail folder contains a file \f(CW.mh_sequences\fP which lists
816 \f(CWshow\fP is like \f(CWcat\fP, 816 the public message sequences of that folder, for instance new messages.
817 \f(CWfolder\fP is like \f(CWcd\fP/\f(CWpwd\fP, 817 Mail messages are text files located in a mail folder.
818 \f(CWrefile\fP is like \f(CWmv\fP,
819 and \f(CWrmm\fP is like \f(CWrm\fP.
820 .PP
821 The context of tools in Unix is mainly the current working directory,
822 the user identification, and the environment variables.
823 \s-1MH\s0 extends this context by two more items:
824 .IP \(bu
825 The current mail folder, which is similar to the current working directory.
826 For mail folders, \f(CWfolder\fP provides the corresponding functionality
827 of \f(CWpwd\fP and \f(CWcd\fP for directories.
828 .IP \(bu
829 The current message, relative to the current mail folder,
830 which enables commands like \f(CWnext\fP and \f(CWprev\fP.
831 .LP
832 In contrast to Unix' context, which is chained to the shell session,
833 \s-1MH\s0's context is meant to be chained to a mail account.
834 But actually, the current message is a property of the mail folder,
835 which appears to be a legacy.
836 This will cause problems when multiple users work
837 in one mail folder simultaneously.
838 .PP
839 .I "Data storage.
840 How \s-1MH\s0 stores data was already mentioned.
841 Mail folders are directories (which contain a file
842 \&\f(CW.mh_sequences\fP) under the user's \s-1MH\s0 directory
843 (usually \f(CW$HOME/Mail\fP).
844 Mail messages are text files located in mail folders.
845 The files contain the messages as they were received. 818 The files contain the messages as they were received.
846 The messages are numbered in ascending order in each folder. 819 They are numbered in ascending order in each folder.
820 .PP
847 This mailbox format is called ``\s-1MH\s0'' after the \s-1MUA\s0. 821 This mailbox format is called ``\s-1MH\s0'' after the \s-1MUA\s0.
848 Alternatives are \fImbox\fP and \fImaildir\fP. 822 Alternatives are \fImbox\fP and \fImaildir\fP.
849 In the mbox format all messages are stored within one file. 823 In the mbox format all messages are stored within one file.
850 This was a good solution in the early days, when messages 824 This was a good solution in the early days, when messages
851 were only a few lines of text and were deleted soon. 825 were only a few lines of text and were deleted soon.
857 the relevant message in the mbox file. 831 the relevant message in the mbox file.
858 With the \s-1MH\s0 mailbox format, 832 With the \s-1MH\s0 mailbox format,
859 each message is a self-standing item, by definition. 833 each message is a self-standing item, by definition.
860 Also, the problem of concurrent access to one mailbox is 834 Also, the problem of concurrent access to one mailbox is
861 reduced to the problem of concurrent access to one message. 835 reduced to the problem of concurrent access to one message.
862 However, the issue of the shared parts of the context,
863 as mentioned above, remains.
864 Maildir is generally similar to \s-1MH\s0's format, 836 Maildir is generally similar to \s-1MH\s0's format,
865 but modified towards guaranteed reliability. 837 but modified towards guaranteed reliability.
866 This involves some complexity, unfortunately. 838 This involves some complexity, unfortunately.
867 839 .PP
840 Working with \s-1MH\s0's toolchest on mailboxes is much like
841 working with Unix' toolchest on directory trees:
842 \f(CWscan\fP is like \f(CWls\fP,
843 \f(CWshow\fP is like \f(CWcat\fP,
844 \f(CWfolder\fP is like \f(CWcd\fP and \f(CWpwd\fP,
845 \f(CWrefile\fP is like \f(CWmv\fP,
846 and \f(CWrmm\fP is like \f(CWrm\fP.
847 .PP
848 The context of tools in Unix consists mainly the current working directory,
849 the user identification, and the environment variables.
850 \s-1MH\s0 extends this context by two more items:
851 .IP \(bu
852 The current mail folder, which is similar to the current working directory.
853 For mail folders, \f(CWfolder\fP provides the corresponding functionality
854 of \f(CWcd\fP and \f(CWpwd\fP for directories.
855 .IP \(bu
856 Sequences, which are named sets of messages in a mail folder.
857 The current message, relative to a mail folder, is a special sequence.
858 It enables commands like \f(CWnext\fP and \f(CWprev\fP.
859 .LP
860 In contrast to Unix' context, which is chained to the shell session,
861 \s-1MH\s0's context is independent.
862 Usually there is one context for each user, but a user can have many
863 contexts.
864 Public sequences are an exception, as they belong to the mail folder.
865 .[
866 %O mh-profile(5) and mh-sequence(5)
867 .]
868 868
869 .NH 2 869 .NH 2
870 Discussion of the design 870 Discussion of the design
871 .LP 871 .LP
872 The following paragraphs discuss \s-1MH\s0 in regard to the tenets 872 The following paragraphs discuss \s-1MH\s0 in regard to the tenets
906 functions that are available nowhere yet, he best takes a 906 functions that are available nowhere yet, he best takes a
907 toolchest system like \s-1MH\s0 where he can add the 907 toolchest system like \s-1MH\s0 where he can add the
908 functionality with little work. 908 functionality with little work.
909 909
910 .PP 910 .PP
911 .B "Store data in flat text files" . 911 .B "Store data in flat text files
912 FIXME 912 is followed by \s-1MH\s0.
913 This is not surprising, because email messages are already plain text.
914 \s-1MH\s0 stores the messages as it receives them,
915 thus any other tool that works on RFC 2822 mail messages can operate
916 on the messages in an \s-1MH\s0 mailbox.
917 All other files \s-1MH\s0 uses are plain text too.
918 It is therefore possible and encouraged to use the text processing
919 tools of Unix' toolchest to extend \s-1MH\s0's toolchest.
913 920
914 .PP 921 .PP
915 .B "Avoid captive user interfaces" . 922 .B "Avoid captive user interfaces" .
916 \s-1MH\s0 is perfectly suited for non-interactive use. 923 \s-1MH\s0 is perfectly suited for non-interactive use.
917 It offers all functions directly and without captive user interfaces. 924 It offers all functions directly and without captive user interfaces.