WalnutSchema.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Willie-Sue, June 11, 1985 2:08:29 pm PDT
Types and entities in the Walnut message database
Last Edited by: Willie-Sue, January 4, 1985 9:04:13 am PST
Last Edited by: Wert, August 31, 1984 7:06:51 pm PDT
Last Edited by: Donahue, February 2, 1985 9:30:14 am PST
(Added NewMail and Archive log position info for restart)
(Changed mDAInfo to be mInfo and changed mAccepted to be mShow -- in multiple log case, this attribute will be used for both Active and Deleted message set enumerations)
DIRECTORY
DB USING [Attribute, Domain, Relation, Relship, Version],
Rope USING [ROPE],
WalnutDefs USING [Segment];
WalnutSchema:
CEDAR DEFINITIONS
= BEGIN
OPEN DB;
Types
ROPE: TYPE = Rope.ROPE;
Schema Variables
Global Domains
MsgDomain: READONLY Domain;
MsgSetDomain: READONLY Domain;
ServerDomain: READONLY Domain;
Global Info relations - one each per database
gSchemaDateInfo: READONLY Relation; -- no-one needs to know this
gSVDate: READONLY Attribute; -- time (of schema definition)
gRootInfo:
READONLY Relation;
gRootFileStamp: READONLY Attribute; -- rootFile create date for this db
gRootFileKey: READONLY Attribute; -- key from rootFile for this db
gMailFor: READONLY Attribute; -- RName (ROPE)
gLogInfo:
READONLY Relation;
gLogFileID: READONLY Attribute; -- int
gOpInProgressPos: READONLY Attribute; -- int - long running operation Pos
gFirstDestroyedMsgPos: READONLY Attribute; -- int
gBytesInDestroyedMsgs: READONLY Attribute; -- int
gParseLogInfo:
READONLY Relation;
gParseLogInProgress: READONLY Attribute; -- bool
gParseLogPos: READONLY Attribute; -- int
gExpungeInfo:
READONLY Relation;
gLogExpungePhase: READONLY Attribute; -- int
gExpungeFileID: READONLY Attribute; -- int
gCurrentLogPos: READONLY Attribute; -- int
gExpungeLogPos: READONLY Attribute; -- int
gNewMailInfo:
READONLY Relation;
gNewMailLogLength: READONLY Attribute; -- int
gCopyNewMailLogPos: READONLY Attribute; -- int
gAcceptNewMailLogPos: READONLY Attribute; -- int
gAddingServerMsgs: READONLY Attribute; -- bool
gLastNewMailTimeStamp: READONLY Attribute; -- time
gReadArchiveInfo:
READONLY Relation;
gReadArchiveLogPos: READONLY Attribute; -- int
gCopyReadArchiveLogPos: READONLY Attribute; -- int
gVersionInfo:
READONLY Relation;
gMsgCount: READONLY Attribute; -- int (number of message in DB)
gMsgSetCount: READONLY Attribute; -- int (number of msgSets in DB)
gMsgSetsVersion: READONLY Attribute; -- int (version number for msgSets)
Server entity Relation
sBasicInfo:
READONLY Relation;
-- One per Server
sBIOf: READONLY Attribute; -- Server
sBINum: READONLY Attribute; -- int (number of messages)
MsgSet entity relation
msBasicInfo:
READONLY Relation;
-- One per MsgSet
msBIOf: READONLY Attribute; -- MsgSet
msBICount: READONLY Attribute; -- int (number of member msgs)
msBIVersion: READONLY Attribute; -- int
Msg displaying relation
mTextInfo:
READONLY Relation;
-- One per Msg
mTIOf: READONLY Attribute; -- Msg
mTIHerald: READONLY Attribute; -- rope
mTIShortNameLen: READONLY Attribute; -- int (for icon label, other uses)
mTIEntryStart: READONLY Attribute; -- int (start of entry in log)
mTITextOffset: READONLY Attribute; -- int (offset for text)
mTITextLen: READONLY Attribute; -- int (length of text)
mTIFormatLen: READONLY Attribute; -- int (length of formatting)
Msg in MsgSet displayer relation
mDisplayInfo:
READONLY Relation;
-- One per Msg
mDIOf: READONLY Attribute; -- Msg
mDITOCEntry: READONLY Attribute; -- rope
mDIStartOfSubject: READONLY Attribute; -- int
mDIHasBeenRead: READONLY Attribute; -- bool
Msg Date/Show relation
mInfo:
READONLY Relation;
-- One per Msg
mInfoOf: READONLY Attribute; -- Msg
mDateIs: READONLY Attribute; -- time
mShowIs: READONLY Attribute; -- bool
Category/Date relation
cdRelation:
READONLY Relation;
-- One per Msg / MsgSet pair
cdMsg: READONLY Attribute; -- Msg
cdMsgSet: READONLY Attribute; -- MsgSet
cdDate: READONLY Attribute; -- time (of the Msg)
Global Relships
rRootInfo: READONLY Relship;
rLogInfo: READONLY Relship;
rParseLogInfo: READONLY Relship;
rExpungeInfo: READONLY Relship;
rVersionInfo: READONLY Relship;
rNewMailInfo: READONLY Relship;
rReadArchiveInfo: READONLY Relship;
Procedures
Initialize:
PROC [segment: WalnutDefs.Segment, version: Version ← NewOrOld];
This procedure initializes the database schema. A transaction must be open on the specified segment. The version parameter controls how much error checking you want when defining the database schema; the default value is normally sufficient. Specifying NewOnly indicates that all schema items must not previously exist, while OldOnly specifies that all items must previously exist. NewOrOld indicates that all items may or may not exist, and that they should be created if they don't exist.
SchemaMismatch[explanation] -- schema version mismatch
This is SIGNALed. If you RESUME the signal, the database will be erased. This is normally what you want, unless you want to preserve the database, or accidentally used the wrong version of the software.
SetSchemaVersion:
PROC[segment: WalnutDefs.Segment];
this proc erases the open database, declares and sets the correct schema version stamp, and then commits the database; it catches NO errors
END.