WalnutKernelDefs.mesa
Copyright Ó 1984, 1986, 1987, 1992 by Xerox Corporation. All rights reserved.
Willie-Sue, May 23, 1988 4:32:16 pm PDT
Definitions used by WalnutLog, WalnutStream
These are internal for use by WalnutKernel
(Changed ROPEs to REF TEXT to avoid all the allocations)
(Added EndReadArchiveFile entry)
(Changed REF TEXT to ROPEs, as they almost always get converted anyway!)
DIRECTORY
BasicTime USING [GMT, nullGMT],
IO USING [STREAM],
Rope USING [ROPE];
WalnutKernelDefs: CEDAR DEFINITIONS
= BEGIN
STREAM: TYPE = IO.STREAM;
ROPE: TYPE = Rope.ROPE;
Types
-- Relating to Entries in root files; these entries do not include a size;
-- logSeqNo is guaranteed to be 7 characters long
-- formal definition, but we won't use it
RootEntry: TYPE = REF RootEntryObject;
RootEntryObject: TYPE = RECORD [
SELECT type: * FROM
Key => [ keyValue: ROPE ],
MailFor => [ rName: ROPE ],
Database => [ dbName: ROPE ],
NewMailLog => [ fileName: ROPE ],
ReadArchiveLog => [ fileName: ROPE ],
LogInfo =>
fileName: ROPE,
internalFileID: INT,
logSeqNo: ROPE  -- is number or "Expunge" or "Emptied"
],
End => NULL  -- entries after this one are ignored
];
RootEntry: TYPE = RECORD [
ident: ROPE,   -- would like ATOM, but then case counts and rootFile is edited by people
value: ROPE,     -- NIL for LogInfo entries
info: LogInfoFromRoot  -- NIL for entries other than LogInfo entries
];
LogInfoFromRoot: TYPE = RECORD [
fileName: ROPE,
internalFileID: INT,
logSeqNo: ROPE,
seqNoPos: INT  -- position in rootFile of this logFile's sequence number
];
-- Relating to Entries in log files
LogEntry: TYPE = REF LogEntryObject;
LogEntryObject: TYPE = RECORD [
SELECT type: * FROM
LogFileInfo => [  -- change this name each time the format changes
key: ROPE ¬ NIL,
internalFileID: INT,
logSeqNo: INT
],
CreateMsg => [
msg: ROPE ¬ NIL,
date: BasicTime.GMT ¬ BasicTime.nullGMT,
show: BOOL,  -- to distinguish new grapevine mail
sender,
from,
subject,
to,
cc: ROPE ¬ NIL,
entryStart: INT ¬ 0,   -- the position of the entry in the log
textOffset: INT ¬ 0,    -- the offset of the first char of the message header
textLen: INT ¬ 0,   -- the length of the text (chars)
formatLen: INT ¬ 0,  -- the length of the formatting information
headersLen: INT ¬ 0 -- the length of the headers information
],
ExpungeMsgs => NULL,
WriteExpungeLog => [ internalFileID: INT ],
CreateMsgSet => [ msgSet: ROPE ¬ NIL ],
DestroyMsgSet => [ msgSet: ROPE ¬ NIL ],
EmptyMsgSet => [ msgSet: ROPE ¬ NIL ],
HasBeenRead => [ msg: ROPE ¬ NIL ],
AddMsg => [ msg: ROPE ¬ NIL, to: ROPE ¬ NIL],
RemoveMsg => [ msg: ROPE ¬ NIL, from: ROPE ¬ NIL],
MoveMsg => [
msg: ROPE ¬ NIL,
from: ROPE ¬ NIL,
to: ROPE ¬ NIL
],
RecordNewMailInfo => [
logLen: INT,
when: BasicTime.GMT,
server: ROPE ¬ NIL,
num: INT
],
StartCopyNewMail => NULL,
EndCopyNewMailInfo => [ startCopyPos: INT ],
AcceptNewMail => NULL,
StartReadArchiveFile => [ file: ROPE ¬ NIL, msgSet: ROPE ¬ NIL],
EndReadArchiveFile => NULL,
StartCopyReadArchive => NULL,
EndCopyReadArchiveInfo => [ startCopyPos: INT ],
EndOfLog => [length: INT],  -- need not be a "real" entry
the end of the log - returned by WalnutStream
ENDCASE ];
MsgLogEntry: TYPE = REF CreateMsg LogEntryObject;
WhichTempLog: TYPE = {newMail, readArchive};
-- Misc
LogExpungePhase: TYPE = {idle, initializingExpungeLog, writingExpungeLog, swappingLogs};
END.