YggTransactionMap.mesa
Copyright Ó 1985, 1988 by Xerox Corporation. All rights reserved.
TransID -> YgTransactionMap.Handle, and public operations on YgTransactionMap.Handle.
Last edited by
Taft on 16-Feb-82 17:22:37
MBrown on January 24, 1983 2:23 pm
Kolling on November 2, 1983 12:45 pm
Hauser, March 8, 1985 11:11:09 am PST
Bob Hagmann May 3, 1988 9:56:24 am PDT
DIRECTORY
BasicTime,
YggEnvironment,
YggInternal;
YggTransactionMap: CEDAR DEFINITIONS =
BEGIN
Conversation: TYPE = YggEnvironment.Conversation;
TransID: TYPE = YggEnvironment.TransID;
OpenDoc: TYPE = YggInternal.OpenDoc;
TransHandle: TYPE = YggInternal.TransHandle;
nullTransHandle: TransHandle = NIL;
Creating, finding, and deleting TransHandles
Register: PROC [self: TransHandle] RETURNS [alreadyRegistered: BOOL];
If a transaction object with TransID self.transID exists in the map, return
alreadyRegistered = TRUE. Otherwise insert self into the map and return
alreadyRegistered = FALSE.
GetTransHandle: PROC [transID: TransID] RETURNS [TransHandle];
Returns nullTransHandle if transID is not registered.
Unregister: PROC [self: TransHandle];
EnumProc: TYPE = PROC [TransHandle] RETURNS [stop: BOOL];
LockedEnumerate: PROC [proc: EnumProc];
proc is called with TransactionMap monitor locked. All TransHandles Registered
before the start of the enumeration and not Unregistered before the start of the
enumeration will be seen exactly once.
UnlockedEnumerate: PROC [proc: EnumProc];
proc is called with TransactionMap monitor unlocked. All TransHandles Registered
before the start of the enumeration and not Unregistered before the end of the
enumeration will be seen at least once.
Using TransHandles
GetTransID: PROC [self: TransHandle] RETURNS [TransID];
Returns the TransID established by the Register call that generated the TransHandle.
StartWork: PROC [self: TransHandle, difficulty: YggInternal.WorkLevel ← normal]
RETURNS [canWork: BOOL];
Called during normal operation at start of any operation (CreateFile, WritePages, ...)
for transaction self. Not called by recovery procedures for these operations.
Called with difficulty = hard if the operation may dirty a cache that is flushed
during transaction prepare by calling through the YgFile interface. For instance,
CreateFile dirties the owner database cache in this way.
If StartWork returns canWork ~ FALSE, then operation must terminate (raising
an error to indicate that the transaction or open file is "unknown").
StopWork: PROC [self: TransHandle];
Called at end of any operation (CreateFile, WritePages, ...) for transaction self.
GetTimeOfLastStartWork: PROC [self: TransHandle] RETURNS [BasicTime.GMT];
Returns number of seconds that have elapsed since the last successful call
to StartWork on self.
GetEstimatedUpdateCost: PROC [self: TransHandle] RETURNS [INT];
Returns the total of all estimatedUpdateCosts for operations on this transaction.
EnableYggdrasilWheel: PROC [self: TransHandle, conversation: Conversation, enable: BOOL];
IsYggdrasilWheel: PROC [self: TransHandle, conversation: Conversation]
RETURNS [enabled: BOOL];
If self = YgIdentity.myFileStore, then returns TRUE. Otherwise, if there has
been a call to IsYggdrasilWheel for this (TransHandle, Conversation) pair, returns the
value of "enable" passed on the last such call. Otherwise returns FALSE.
GetOpenDocList: PROC [self: TransHandle] RETURNS [documentList: YggInternal.OpenDoc];
Does not enter self's monitor.
SetOpenDocList: PROC [self: TransHandle, documentList: YggInternal.OpenDoc];
Does not enter self's monitor.
GetLockHeader: PROC [self: TransHandle]
RETURNS [lockHeader: YggInternal.LockTransHeader];
Does not enter self's monitor.
IsCommitted: PROC [self: TransHandle] RETURNS [BOOL];
Called during normal operation and during recovery.
Error if self is not active or completing.
TransState: TYPE = YggInternal.TransState; --{committed, aborted, ready}--
StateDuringRecovery: PROC [self: TransHandle] RETURNS [TransState];
Called during recovery only.
Returns the state that the transaction will reach at the end of recovery.
AbortUnilaterally: PROC [self: TransHandle, why: AbortReason];
Aborts self without any communication with self's coordinator.
why is for informational purposes only.
AbortReason: TYPE = {
clientRequest,
deadlock,
timeout,
blockingNewLockRequest,
tooManyTransactions,
oldUncommittedUpdates
};
AssertUpdatesAreComplete: PROC [self: TransHandle];
Asserts that all updates called for by the transaction self have been completed
(if self committed) or have been undone (if self aborted), at the level of the
FilePageMgr interface. These updates may still not be recoverable except from
the log; calling FilePageMgr.ForceOutEverything is guaranteed to make the
updates recoverable.
END.
Hauser, March 8, 1985 11:10:56 am PST
Nodified, added copyright.