-- AlpineTransaction.mesa
-- Last edited by
--   MBrown on March 1, 1983 3:30 pm
--   Taft on 29-Jan-82 10:14:13
--   Kolling on March 8, 1983 2:35 pm

DIRECTORY
  AlpineEnvironment;

AlpineTransaction: DEFINITIONS =
  BEGIN

  Conversation: TYPE = AlpineEnvironment.Conversation;
  TransID: TYPE = AlpineEnvironment.TransID;
  FileStore: TYPE = AlpineEnvironment.FileStore;

  Create: PROC [conversation: Conversation, createLocalWorker: BOOL ← TRUE]
   RETURNS [transID: TransID];
      --! OperationFailed {busy};
      -- Call from client to coordinator.
      -- If createLocalWorker, then calls CreateWorker[conversation, transID, <self>],
      -- and is guaranteed not to raise any of the errors raised by CreateWorker.

  CreateWorker: PROC [
    conversation: Conversation,
    transID: TransID,
    coordinator: FileStore];
      --! Unknown {coordinator, transID};
      -- Call from client to worker.
      -- This procedure returns (i.e. does not raise an error) iff trans becomes active
      -- (prepared to do work) on the called server.  Of course, there is no guarantee
      -- that this state will last for any length of time.

  AssertAlpineWheel: PROC [
    conversation: Conversation,
    transID: TransID,
    enable: BOOL ← TRUE];
    -- ! OperationFailed {regServersUnavailable, notAlpineWheel},
    -- ! Unknown {transID}.
    -- When called with enable = TRUE, causes all subsequent calls for this
    -- (conversation, transID) pair to pass all access control checks without further
    -- checking; raises OperationFailed [notAlpineWheel] if the caller identified by
    -- conversationis not a member of the AlpineWheels group for this server.  When
    -- called with enable = FALSE, causes normal access control checking to resume
    -- for this (conversation, transID) pair.

  RequestedOutcome: TYPE = AlpineEnvironment.CommitOrAbort;
  Outcome: TYPE = AlpineEnvironment.Outcome;

  Finish: PROC [
    conversation: Conversation,
    transID: TransID,
    requestedOutcome: RequestedOutcome --{abort, commit}--,
    continue: BOOL ← FALSE]
    RETURNS [outcome: Outcome --{abort, commit, unknown}--,
    newTrans: TransID];
      --! (none);
      -- Call from client to coordinator.
      -- newTrans is meaningless unless requestedOutcome = commit, continue = TRUE,
      -- and outcome = commit.

  Unknown: ERROR [what: AlpineEnvironment.UnknownType];
  OperationFailed: ERROR [why: AlpineEnvironment.OperationFailure];
  
  END.

CHANGE LOG

Changed by MBrown on January 21, 1983 10:28 pm
-- Added createLocalWorker parm to Create.  Renamed trans -> transID to be consistent
-- with AlpineFile.

Changed by MBrown on March 1, 1983 3:29 pm
-- Moved AssertAlpineWheel here, from AlpineOwner; it now raises
-- OperationFailed [notAlpineWheel] instead of AccessFailed [alpineWheel].