WalnutSchemaGlobalsImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Willie-Sue, June 11, 1985 2:14:44 pm PDT
Types and entities in the Walnut message database
Last Edited by: Willie-Sue, January 4, 1985 9:05:15 am PST
DIRECTORY
DB USING [Attribute, BoolType, DeclareAttribute, DeclareRelation, DeclareRelship, GetF, IntType, I2V, NextRelship, Relation, RelationSubset, ReleaseRelshipSet, Relship, RelshipSet, RopeType, SetF, TimeType, Version, V2I],
Rope USING [ROPE],
WalnutDefs USING [Segment],
WalnutSchema USING [],
WalnutSchemaInternal USING [];
WalnutSchemaGlobalsImpl: CEDAR PROGRAM
IMPORTS
DB
EXPORTS
WalnutSchema, WalnutSchemaInternal
= BEGIN
OPEN DB, WalnutSchema;
Types
ROPE: TYPE = Rope.ROPE;
(Some of the) Schema Variables - Global Relations
Global Relations - one each per database
gRootInfo: PUBLIC Relation;
gRootFileStamp: PUBLIC Attribute; -- rootFile create date for this db
gRootFileKey: PUBLIC Attribute;  -- key from rootFile for this db
gMailFor: PUBLIC Attribute;   -- RName (ROPE)
gLogInfo: PUBLIC Relation;
gLogFileID: PUBLIC Attribute;     -- int
gOpInProgressPos: PUBLIC Attribute;   -- int - long running operation Pos
gFirstDestroyedMsgPos: PUBLIC Attribute; -- int
gBytesInDestroyedMsgs: PUBLIC Attribute; -- int
gParseLogInfo: PUBLIC Relation;
gParseLogInProgress: PUBLIC Attribute;  -- bool
gParseLogPos: PUBLIC Attribute;    -- int
gExpungeInfo: PUBLIC Relation;
gLogExpungePhase: PUBLIC Attribute;  -- int
gExpungeFileID: PUBLIC Attribute;   -- int
gCurrentLogPos: PUBLIC Attribute;   -- int
gExpungeLogPos: PUBLIC Attribute;   -- int
gNewMailInfo: PUBLIC Relation;
gNewMailLogLength: PUBLIC Attribute;   -- int
gCopyNewMailLogPos: PUBLIC Attribute;   -- int
gAcceptNewMailLogPos: PUBLIC Attribute;  -- int
gAddingServerMsgs: PUBLIC Attribute;   -- bool
gLastNewMailTimeStamp: PUBLIC Attribute;  -- time
gReadArchiveInfo: PUBLIC Relation;
gReadArchiveLogPos: PUBLIC Attribute;   -- int
gCopyReadArchiveLogPos: PUBLIC Attribute; -- int
gVersionInfo: PUBLIC Relation;
gMsgCount: PUBLIC Attribute;    -- int
gMsgSetCount: PUBLIC Attribute;   -- int
gMsgSetsVersion: PUBLIC Attribute;  -- int
Global Relships
rRootInfo: PUBLIC Relship;
rLogInfo: PUBLIC Relship;
rParseLogInfo: PUBLIC Relship;
rExpungeInfo: PUBLIC Relship;
rVersionInfo: PUBLIC Relship;
rNewMailInfo: PUBLIC Relship;
rReadArchiveInfo: PUBLIC Relship;
Procedures
InitializeGlobals: PUBLIC PROC[segment: WalnutDefs.Segment, version: Version ← NewOrOld] = {
gRootInfo ← DeclareRelation["RootInfo", segment, version];
gRootFileStamp ←
DeclareAttribute[gRootInfo, "RootFileStamp", TimeType, , , , version];
gRootFileKey ←
DeclareAttribute[gRootInfo, "RootFileKey", RopeType, , , , version];
gMailFor ←
DeclareAttribute[gRootInfo, "MailFor", RopeType, , 20, , version];
gLogInfo ← DeclareRelation["LogInfo", segment, version];
gLogFileID ← DeclareAttribute[gLogInfo, "LogFileID", IntType, , , , version];
gOpInProgressPos ←
DeclareAttribute[gLogInfo, "OpInProgressPos", IntType, , , , version];
gFirstDestroyedMsgPos ←
DeclareAttribute[gLogInfo, "FirstDestroyedMsgPos", IntType, , , , version];
gBytesInDestroyedMsgs ←
DeclareAttribute[gLogInfo, "BytesInDestroyedMsgs", IntType, , , , version];
gParseLogInfo ← DeclareRelation["ParseLogInfo", segment, version];
gParseLogInProgress ←
DeclareAttribute[gParseLogInfo, "ParseLogInProgress", BoolType, , , , version];
gParseLogPos ←
DeclareAttribute[gParseLogInfo, "ParseLogPos", IntType, , , , version];
gExpungeInfo ← DeclareRelation["ExpungeInfo", segment, version];
gLogExpungePhase ←
DeclareAttribute[gExpungeInfo, "LogExpungePhase", IntType, , , , version];
gExpungeFileID ←
DeclareAttribute[gExpungeInfo, "ExpungeFileID", IntType, , , , version];
gCurrentLogPos ←
DeclareAttribute[gExpungeInfo, "CurrentLogPos", IntType, , , , version];
gExpungeLogPos ←
DeclareAttribute[gExpungeInfo, "TempLogPos", IntType, , , , version];
gNewMailInfo ← DeclareRelation["NewMailInfo", segment, version];
gNewMailLogLength ←
DeclareAttribute[gNewMailInfo, "NewMailLogLength", IntType, , , , version];
gCopyNewMailLogPos ←
DeclareAttribute[gNewMailInfo, "CopyNewMailLogPos", IntType, , , , version];
gAcceptNewMailLogPos ←
DeclareAttribute[gNewMailInfo, "AcceptNewMailLogPos", IntType, , , , version];
gAddingServerMsgs ←
DeclareAttribute[gNewMailInfo, "AddingServerMsgs", BoolType, , , , version];
gLastNewMailTimeStamp ←
DeclareAttribute[gNewMailInfo, "LastNewMailTimeStamp", TimeType, , , , version];
gReadArchiveInfo ← DeclareRelation["ReadArchiveInfo", segment, version];
gReadArchiveLogPos ←
DeclareAttribute[gReadArchiveInfo, "ReadArchiveLogPos", IntType, , , , version];
gCopyReadArchiveLogPos ←
DeclareAttribute[
gReadArchiveInfo, "CopyReadArchiveLogPos", IntType, , , , version];
gVersionInfo ← DeclareRelation["VersionInfo", segment, version];
gMsgCount ← DeclareAttribute[gVersionInfo, "MsgCount", IntType, , , , version];
gMsgSetCount ←
DeclareAttribute[gVersionInfo, "MsgSetCount", IntType, , , , version];
gMsgSetsVersion ←
DeclareAttribute[gVersionInfo, "MsgSetsVersion", IntType, , , , version];
-- Declare the Global Relships
rRootInfo ← DeclareGlobalRelship[gRootInfo, version];
rLogInfo ← DeclareGlobalRelship[gLogInfo, version];
rParseLogInfo ← DeclareGlobalRelship[gParseLogInfo, version];
rExpungeInfo ← DeclareGlobalRelship[gExpungeInfo, version];
rVersionInfo ← DeclareGlobalRelship[gVersionInfo, version];
rNewMailInfo ← DeclareGlobalRelship[gNewMailInfo, version];
rReadArchiveInfo ← DeclareGlobalRelship[gReadArchiveInfo, version];
this is a kludge; Active and Deleted are not created in the normal fashion
IF DB.V2I[DB.GetF[rVersionInfo, gMsgSetCount]] = 0 THEN
DB.SetF[rVersionInfo, gMsgSetCount, DB.I2V[2]];
};
DeclareGlobalRelship: PROC [r: Relation, version: Version ← NewOrOld]
RETURNS [rel: Relship] = {
rs: RelshipSet ← RelationSubset[r];
rel ← DB.NextRelship[rs];
IF DB.NextRelship[rs] # NIL THEN ERROR;
ReleaseRelshipSet[rs];
IF rel = NIL THEN rel ← DeclareRelship[r, NIL, version];
};
END.