AlpFileCourierImpl.mesa
Carl Hauser, November 12, 1987 2:14:37 pm PST
DIRECTORY
AEToCrAE,
CrAEToAE,
AlpTransaction,
AlpFile,
AlpineEnvironment,
AlpineP2202V1,
AlpineEnvironmentP2201V1,
AlpInstanceCourier,
PrincOpsUtils,
XNSAuth;
AlpFileCourierImpl: CEDAR PROGRAM
IMPORTS AEToCrAE, CrAEToAE, AlpineP2202V1, AlpInstanceCourier, PrincOpsUtils
EXPORTS AlpFile
~ BEGIN
OPEN
ATC: AEToCrAE,
CTA: CrAEToAE,
AlpT: AlpTransaction,
AlpF: AlpFile,
AE: AlpineEnvironment;
in addition to the errors documented for the corresponding Alpine procedures, all of the procedures defined in this interface can also error RPC.CallFailed[RPC.CallFailure].
TransWorkProc: TYPE = AlpInstanceCourier.TransWorkProc;
DoTransWork: PROC [inst: AlpInstanceCourier.Instance, transHandle: AlpTransaction.Handle, work: TransWorkProc] = AlpInstanceCourier.DoTransWork;
Open:
PUBLIC
PROCEDURE
[transHandle: AlpT.Handle, universalFile: AE.UniversalFile, access: AE.AccessRights, lock: AE.LockOption, recoveryOption: AE.RecoveryOption, referencePattern: AE.ReferencePattern]
RETURNS[handle: AlpF.Handle, fileID: AE.FileID]
=
BEGIN
Work: TransWorkProc ~ {
openFileID: AlpineEnvironmentP2201V1.OpenFileID;
crFileID: AlpineEnvironmentP2201V1.FileID;
verifier: XNSAuth.Verifier;
[openFileID, crFileID, verifier] ← AlpineP2202V1.Open[rpc, session,
ATC.TransID[transID], ATC.UniversalFile[universalFile], ATC.AccessRights[access], ATC.LockOption[lock], ATC.RecoveryOption[recoveryOption], ATC.ReferencePattern[referencePattern]];
handle ← NEW[AlpF.Object ←
[trans: transHandle, openFileID: CTA.OpenFileID[openFileID]]];
fileID ← CTA.FileID[crFileID];
};
DoTransWork[NARROW[transHandle.inst.otherInterfaces.first], transHandle, Work];
END;
Create:
PUBLIC
PROCEDURE
[transHandle: AlpT.Handle, volumeID: AE.VolOrVolGroupID, owner: AE.OwnerName, initialSize: AE.PageCount, recoveryOption: AE.RecoveryOption, referencePattern: AE.ReferencePattern]
RETURNS[handle: AlpF.Handle, refUniversalFile: REF AE.UniversalFile]
=
BEGIN
Work: TransWorkProc ~ {
openFileID: AlpineEnvironmentP2201V1.OpenFileID;
universalFile: AlpineEnvironmentP2201V1.UniversalFile;
verifier: XNSAuth.Verifier;
[openFileID, universalFile, verifier] ← AlpineP2202V1.Create[rpc, session,
ATC.TransID[transID], ATC.VolOrVolGroupID[volumeID],
ATC.OwnerName[owner], ATC.PageCount[initialSize], ATC.RecoveryOption[recoveryOption], ATC.ReferencePattern[referencePattern]];
handle ← NEW[AlpF.Object ← [trans: transHandle, openFileID: CTA.OpenFileID[openFileID]]];
refUniversalFile ← NEW[AE.UniversalFile ← CTA.UniversalFile[universalFile]];
};
DoTransWork[NARROW[transHandle.inst.otherInterfaces.first], transHandle, Work];
END;
Close:
PUBLIC
PROCEDURE[handle: AlpF.Handle] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.Close[rpc, session, ATC.OpenFileID[handle.openFileID]]
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
Delete:
PUBLIC
PROCEDURE[handle: AlpF.Handle] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.Delete[rpc, session, ATC.OpenFileID[handle.openFileID]]
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
ReadPages:
PUBLIC
UNSAFE
PROCEDURE
[handle: AlpF.Handle, pageRun: AE.PageRun, pageBuffer: AlpF.RESULTPageBuffer, lock: AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crPageBuffer: AlpineP2202V1.PageBuffer;
[crPageBuffer, verifier] ← AlpineP2202V1.ReadPages[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.PageRun[pageRun], ATC.LockOption[lock]];
copy crPageBuffer into pageBuffer.
TRUSTED {PrincOpsUtils.LongCopy[@crPageBuffer^.body+1, crPageBuffer.length, BASE[pageBuffer]]};
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
WritePages:
PUBLIC
PROCEDURE[handle: AlpF.Handle, pageRun:
AE.PageRun, pageBuffer:
AlpF.VALUEPageBuffer, lock: AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crPageBuffer: AlpineP2202V1.PageBuffer ← NEW[AlpineP2202V1.PageBufferObject[LENGTH[pageBuffer]]];
TRUSTED {PrincOpsUtils.LongCopy[BASE[pageBuffer], crPageBuffer.length, @crPageBuffer^.body+1]};
copy pageBuffer into crPageBuffer.
verifier ← AlpineP2202V1.WritePages[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.PageRun[pageRun], crPageBuffer, ATC.LockOption[lock]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
ReadProperties:
PUBLIC
PROCEDURE
[handle: AlpF.Handle, desiredProperties: AlpF.PropertySet, lock: AE.LockOption]
RETURNS[properties: LIST OF AE.PropertyValuePair] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crProperties: AlpineEnvironmentP2201V1.Properties;
[crProperties, verifier] ← AlpineP2202V1.ReadProperties[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.PropertySet[desiredProperties], ATC.LockOption[lock]];
properties ← CTA.Properties[crProperties];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
WriteProperties:
PUBLIC
PROCEDURE
[handle: AlpF.Handle, properties: LIST OF AE.PropertyValuePair, lock: AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.WriteProperties[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.Properties[properties], ATC.LockOption[lock]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
LockPages:
PUBLIC
PROCEDURE
[handle: AlpF.Handle, pageRun: AE.PageRun, lock: AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.LockPages[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.PageRun[pageRun], ATC.LockOption[lock]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
UnlockPages:
PUBLIC
PROCEDURE
[handle: AlpF.Handle, pageRun: AE.PageRun] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.UnlockPages[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.PageRun[pageRun]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
GetAccessRights:
PUBLIC
PROCEDURE[handle: AlpF.Handle]
RETURNS[access:
AE.AccessRights] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crAccess: AlpineEnvironmentP2201V1.AccessRights;
[crAccess, verifier] ← AlpineP2202V1.GetAccessRights[rpc, session, ATC.OpenFileID[handle.openFileID]];
access ← CTA.AccessRights[crAccess];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
GetLockOption:
PUBLIC
PROCEDURE[handle: AlpF.Handle]
RETURNS[lock:
AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crLock: AlpineEnvironmentP2201V1.LockOption;
[crLock, verifier] ← AlpineP2202V1.GetLockOption[rpc, session, ATC.OpenFileID[handle.openFileID]];
lock ← CTA.LockOption[crLock];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
SetLockOption:
PUBLIC
PROCEDURE[handle: AlpF.Handle, lock:
AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.SetLockOption[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.LockOption[lock]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
GetRecoveryOption:
PUBLIC
PROCEDURE[handle: AlpF.Handle]
RETURNS[recoveryOption: AE.RecoveryOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crRecoveryOption: AlpineEnvironmentP2201V1.RecoveryOption;
[crRecoveryOption, verifier] ← AlpineP2202V1.GetRecoveryOption[rpc, session, ATC.OpenFileID[handle.openFileID]];
recoveryOption ← CTA.RecoveryOption[crRecoveryOption];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
GetReferencePattern:
PUBLIC
PROCEDURE[handle: AlpF.Handle]
RETURNS[referencePattern:
AE.ReferencePattern] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crReferencePattern: AlpineEnvironmentP2201V1.ReferencePattern;
[crReferencePattern, verifier] ← AlpineP2202V1.GetReferencePattern[rpc, session, ATC.OpenFileID[handle.openFileID]];
referencePattern ← CTA.ReferencePattern[crReferencePattern];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
SetReferencePattern:
PUBLIC
PROCEDURE[handle: AlpF.Handle, referencePattern:
AE.ReferencePattern] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.SetReferencePattern[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.ReferencePattern[referencePattern]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
GetSize:
PUBLIC
PROCEDURE[handle: AlpF.Handle, lock:
AE.LockOption]
RETURNS[size:
AE.PageCount] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crSize: AlpineEnvironmentP2201V1.PageCount;
[crSize, verifier] ← AlpineP2202V1.GetSize[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.LockOption[lock]];
size ← CTA.PageCount[crSize];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
SetSize:
PUBLIC
PROCEDURE[handle: AlpF.Handle, size:
AE.PageCount, lock:
AE.LockOption] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.SetSize[rpc, session, ATC.OpenFileID[handle.openFileID], ATC.PageCount[size], ATC.LockOption[lock]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
GetUniversalFile:
PUBLIC
PROCEDURE[handle: AlpF.Handle]
RETURNS[universalFile:
AE.UniversalFile] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
crUniversalFile: AlpineEnvironmentP2201V1.UniversalFile;
[crUniversalFile, verifier] ← AlpineP2202V1.GetUniversalFile[rpc, session, ATC.OpenFileID[handle.openFileID]];
universalFile ← CTA.UniversalFile[crUniversalFile];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
UnlockVersion:
PUBLIC
PROCEDURE[handle: AlpF.Handle] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.UnlockVersion[rpc, session, ATC.OpenFileID[handle.openFileID]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
IncrementVersion:
PUBLIC
PROCEDURE[handle: AlpF.Handle, increment:
INT] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.IncrementVersion[rpc, session, ATC.OpenFileID[handle.openFileID], increment];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
UnlockFile:
PUBLIC
PROCEDURE[handle: AlpF.Handle] =
BEGIN
Work: TransWorkProc ~ {
verifier: XNSAuth.Verifier;
verifier ← AlpineP2202V1.UnlockFile[rpc, session, ATC.OpenFileID[handle.openFileID]];
};
DoTransWork[NARROW[handle.trans.inst.otherInterfaces.first], handle.trans, Work];
END;
END.