YggDIDMap.mesa
Copyright Ó 1988, 1989 by Xerox Corporation. All rights reserved.
Last edited by
Bob Hagmann March 21, 1989 10:18:31 am PST
Maps DID's to where the data really is (files, on-line archive, or logs).
DIRECTORY
Camelot USING [segmentIdT, tidT],
YggDID USING [DID],
YggInternal USING[Document, FileHandle],
Rope USING[ROPE];
YggDIDMap: CEDAR DEFINITIONS =
BEGIN
Types
Document: TYPE = YggInternal.Document;
Run: TYPE = RECORD [
segmentId: Camelot.segmentIdT, -- segment for fragment
segmentPage: CARD, -- offset in segment in pages
firstPage: INT, -- page number in file of first byte (-1 for leader)
pages: INT, -- for non-leader, number of pages (0 for leader)
leader: BOOL -- flag for leader (leaders, if used, are 256 bytes long and are not allocated with the rest of the document)
];
NullRun: Run = [[0], 0, 0, 0, FALSE];
RunList: TYPE = LIST OF Run;
Document procedures
OpenDocumentFromDID: PROC [did: YggDID.DID, tid: Camelot.tidT, destroyedOK: BOOLFALSE] RETURNS [doc: Document];
Finds or creates a Document for the supplied DID and transaction.
MarkInterestInDID: PROC [did: YggDID.DID];
Notes continued interest in this did.
Access to immutable attributes.
GetDID: PROC [doc: Document] RETURNS [did: YggDID.DID];
Get the did for the Document.
GetLinkInfo: PROC [doc: Document] RETURNS [fromDID, toDID: YggDID.DID, linkType: Rope.ROPE];
Get the link info for the Document.
SwapLinkInfo: PROC [doc: Document, newFromDID, newToDID: YggDID.DID, newLinkType: Rope.ROPE] RETURNS [oldFromDID, oldToDID: YggDID.DID, oldLinkType: Rope.ROPE];
Swap the link info for the document, and report what it used to be.
GetComponentFiles: PROC [doc: Document] RETURNS [componentFiles: LIST OF YggInternal.FileHandle];
Find all component files for the Document.
AddComponentFile: PROC [doc: Document, componentFile: YggInternal.FileHandle, tid: Camelot.tidT];
Add a new component file for the Document.
RemoveComponentFile: PROC [doc: Document, componentFile: YggInternal.FileHandle, tid: Camelot.tidT];
Remove an old component file from the Document.
GetName: PROC [doc: Document] RETURNS [Rope.ROPE];
no errors possible, but may return NIL.
CreateNewDID: PROC [tid: Camelot.tidT] RETURNS [did: YggDID.DID];
CreateExplicitDID: PROC [tid: Camelot.tidT, did: YggDID.DID] RETURNS [ok: BOOL]; -- use only for well known dids
DestroyDID: PROC [tid: Camelot.tidT, did: YggDID.DID];
Access to root DID's.
GetRootDIDs: PROC RETURNS [dids: LIST OF YggDID.DID];
AddRootDID: PROC [did: YggDID.DID] RETURNS [ok: BOOL];
RemoveRootDID: PROC [did: YggDID.DID] RETURNS [ok: BOOL];
Document modifications
RemoveRuns: PROC [did: YggDID.DID, tid: Camelot.tidT, runList: RunList];
Normally, only called by the file package during it's pre-commit. tid is a top level transaction. Runs listed are removed from the object. Also used when an object is migrated. Caller guarentees that PreCommit will later be called with this tid (if the system doesn't crash).
AddRuns: PROC [did: YggDID.DID, tid: Camelot.tidT, fileUse: ATOM, runList: RunList];
Normally, only called by the file package during it's pre-commit. tid is a top level transaction. Runs listed are added to the object. Also used when an object is removed from the disk cache.
SetByteSize: PROC [did: YggDID.DID, tid: Camelot.tidT, fileUse: ATOM, bytes: INT];
Normally, only called by the file package during it's pre-commit. tid is a top level transaction. The size of valid bytes is set to this amount, but the pages for the file are not changed.
Transactions
PreCommit: PROC [tid: Camelot.tidT];
Called just before Camelot is called to try to commit.
Commit: PROC [tid: Camelot.tidT];
Called after Camelot claims the transaction committed.
Abort: PROC [tid: Camelot.tidT];
Transaction has aborted.
Initialization
InitDIDMap: PROC [firstTime: BOOL];
Called once recoverable storage is known and recovered
Testing
FlushDocument: PROC [did: YggDID.DID, tid: Camelot.tidT];
Flush a document out of the cache. Testing only!!
END.