WalnutKernelDefs.mesa
Willie-Sue, March 26, 1986 2:51:52 pm PST
Donahue, March 24, 1986 11:15:06 am PST
Definitions used by WalnutOps, WalnutDB, WalnutLog, WalnutStream
These are internal for use by WalnutKernel
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last Edited by: Willie-Sue, January 4, 1985 10:10:40 am PST
Last Edited by: Donahue, at December 11, 1984 10:45:27 am PST
(Changed ROPEs to REF TEXT to avoid all the allocations)
(Added EndReadArchiveFile entry)
DIRECTORY
BasicTime USING [GMT, nullGMT],
DBDefs USING[Segment, SegmentIndex],
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: REF TEXT NIL,
internalFileID: INT,
logSeqNo: INT
],
CreateMsg => [
msg: REF TEXT NIL,
date: BasicTime.GMT ← BasicTime.nullGMT,
show: BOOL,  -- to distinguish new grapevine mail
sender, subject, to: ROPENIL,
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,  -- the length of the text (chars)
formatLen: INT, -- the length of the formatting information
headersLen: INT  -- the length of the headers information
],
ExpungeMsgs => NULL,
WriteExpungeLog => [internalFileID: INT],
CreateMsgSet => [ msgSet: REF TEXTNIL],
DestroyMsgSet => [ msgSet: REF TEXTNIL],
EmptyMsgSet => [msgSet: REF TEXTNIL],
HasBeenRead => [msg: REF TEXTNIL],
AddMsg => [ msg: REF TEXTNIL, to: REF TEXTNIL],
RemoveMsg => [ msg: REF TEXTNIL, from: REF TEXTNIL],
MoveMsg => [
msg: REF TEXTNIL,
from: REF TEXTNIL,
to: REF TEXTNIL
],
RecordNewMailInfo => [
logLen: INT,
when: BasicTime.GMT,
server: REF TEXTNIL,
num: INT],
StartCopyNewMail => NULL,
EndCopyNewMailInfo => [ startCopyPos: INT],
AcceptNewMail => NULL,
StartReadArchiveFile => [ file: REF TEXTNIL, msgSet: REF TEXTNIL],
EndReadArchiveFile => NULL,
StartCopyReadArchive => NULL,
EndCopyReadArchiveInfo => [ startCopyPos: INT],
ENDCASE ];
MsgLogEntry: TYPE = REF CreateMsg LogEntryObject;
WhichTempLog: TYPE = {newMail, readArchive};
-- Misc
LogExpungePhase: TYPE = {idle, initializingExpungeLog, writingExpungeLog, swappingLogs};
-- Segment stuff
Segment: TYPE = DBDefs.Segment;
SegmentIndex: TYPE = DBDefs.SegmentIndex ← defaultSegmentIndex;
defaultSegmentIndex: SegmentIndex = 0;
SegmentID: TYPE = RECORD[segment: Segment, index: SegmentIndex];
END.