AlpFileImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by
Kolling on October 20, 1983 6:24 am
MBrown on February 1, 1984 8:08:19 pm PST
Carl Hauser, June 18, 1986 11:00:36 am PDT
DIRECTORY
AlpineEnvironment
USING[AccessRights, FileID, LockFailure, LockOption, NeededAccess,
OpenFileID, OperationFailure, OwnerName, PageCount, PageRun, PropertyValuePair,
RecoveryOption, ReferencePattern, TransID, nullTransID, UniversalFile, UnknownType, VolOrVolGroupID],
AlpFile
USING[Handle, Object, PropertySet, RESULTPageBuffer, VALUEPageBuffer, UserProperties, UserPropertyValuePairs, CachePageLockConversion, CachePageLockConversions],
AlpineFile
USING[AccessFailed, LockFailed, OperationFailed, PossiblyDamaged,
StaticallyInvalid, Unknown],
AlpPrivate
USING[NoticeUnboundInstance],
AlpTransaction
USING[Handle],
RPC
USING[CallFailed],
AlpineFileRpcControl;
AlpFileImpl: CEDAR PROGRAM
IMPORTS AF: AlpineFile, AlpP: AlpPrivate, RPC, AlpineFileRpcControl
EXPORTS AlpFile =
BEGIN OPEN AlpF: AlpFile, AE: AlpineEnvironment, AlpT: AlpTransaction;
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].
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
openFileID: AE.OpenFileID;
TRUSTED BEGIN [openFileID, fileID] ← transHandle.inst.file.Open[transHandle.inst.conversation,
transHandle.transID, universalFile, access, lock, recoveryOption, referencePattern
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[transHandle.inst]]; END;
handle ← NEW[AlpF.Object ← [trans: transHandle, openFileID: openFileID]];
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
ENABLE RPC.CallFailed => IF why = unbound OR why = timeout
THEN AlpP.NoticeUnboundInstance[transHandle.inst];
openFileID: AE.OpenFileID;
universalFile: AE.UniversalFile;
TRUSTED BEGIN [openFileID, universalFile] ←
transHandle.inst.file.Create[transHandle.inst.conversation, transHandle.transID, volumeID,
owner, initialSize, recoveryOption, referencePattern]; END;
handle ← NEW[AlpF.Object ← [trans: transHandle, openFileID: openFileID]];
refUniversalFile ← NEW[AE.UniversalFile ←universalFile];
END;
Close: PUBLIC PROCEDURE[handle: AlpF.Handle] =
TRUSTED BEGIN
handle.trans.inst.file.Close[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
Delete: PUBLIC PROCEDURE[handle: AlpF.Handle] =
TRUSTED BEGIN
handle.trans.inst.file.Delete[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
ReadPages: PUBLIC UNSAFE PROCEDURE
[handle: AlpF.Handle, pageRun: AE.PageRun, pageBuffer: AlpF.RESULTPageBuffer, lock: AE.LockOption, cacheTrans: AE.TransID ← AE.nullTransID]
= TRUSTED BEGIN
handle.trans.inst.file.ReadPages[handle.trans.inst.conversation,
handle.openFileID, pageRun, pageBuffer, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
WritePages: PUBLIC PROCEDURE[handle: AlpF.Handle, pageRun: AE.PageRun, pageBuffer:
AlpF.VALUEPageBuffer, lock: AE.LockOption]
= TRUSTED BEGIN
handle.trans.inst.file.WritePages[handle.trans.inst.conversation,
handle.openFileID, pageRun, pageBuffer, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
ReadProperties: PUBLIC PROCEDURE
[handle: AlpF.Handle, desiredProperties: AlpF.PropertySet, lock: AE.LockOption]
RETURNS[properties: LIST OF AE.PropertyValuePair]
= TRUSTED BEGIN
RETURN[handle.trans.inst.file.ReadProperties[handle.trans.inst.conversation, handle.openFileID, desiredProperties, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
WriteProperties: PUBLIC PROCEDURE
[handle: AlpF.Handle, properties: LIST OF AE.PropertyValuePair, lock: AE.LockOption]
= TRUSTED BEGIN
handle.trans.inst.file.WriteProperties[handle.trans.inst.conversation, handle.openFileID, properties, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
ReadUserProperties: PUBLIC PROCEDURE
[handle: AlpF.Handle, desiredProperties: AlpF.UserProperties, lock: AE.LockOption ← [read, wait]]
RETURNS [properties: AlpF.UserPropertyValuePairs]
= TRUSTED BEGIN
RETURN [handle.trans.inst.file.ReadUserProperties[handle.trans.inst.conversation, handle.openFileID, desiredProperties, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
WriteUserProperties: PUBLIC PROCEDURE
[handle: AlpF.Handle, properties: AlpF.UserPropertyValuePairs, lock: AE.LockOption ← [write, wait]]
= TRUSTED BEGIN
handle.trans.inst.file.WriteUserProperties[handle.trans.inst.conversation, handle.openFileID, properties, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
LockPages: PUBLIC PROCEDURE
[handle: AlpF.Handle, pageRun: AE.PageRun, lock: AE.LockOption]
= TRUSTED BEGIN
handle.trans.inst.file.LockPages[handle.trans.inst.conversation, handle.openFileID, pageRun, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
UnlockPages: PUBLIC PROCEDURE
[handle: AlpF.Handle, pageRun: AE.PageRun, retainCacheLocks: BOOLEANFALSE]
= TRUSTED BEGIN
handle.trans.inst.file.UnlockPages[handle.trans.inst.conversation, handle.openFileID, pageRun, retainCacheLocks
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
ValidateCachePageLock: PUBLIC PROC [lock: AlpF.CachePageLockConversion]
RETURNS [success: BOOLEAN]
= TRUSTED BEGIN
Body
END;
ValidateCachePageLocks: PUBLIC PROC [locks: AlpF.CachePageLockConversions]
RETURNS [locksGranted, locksNotGranted: AlpF.CachePageLockConversions]
= TRUSTED BEGIN
Body
END;
GetAccessRights: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[access: AE.AccessRights]
= TRUSTED BEGIN
RETURN[handle.trans.inst.file.GetAccessRights[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
GetLockOption: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[lock: AE.LockOption]
= TRUSTED BEGIN
RETURN[handle.trans.inst.file.GetLockOption[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
SetLockOption: PUBLIC PROCEDURE[handle: AlpF.Handle, lock: AE.LockOption]
= TRUSTED BEGIN
handle.trans.inst.file.SetLockOption[handle.trans.inst.conversation, handle.openFileID, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetRecoveryOption: PUBLIC PROCEDURE[handle: AlpF.Handle]
RETURNS[recoveryOption: AE.RecoveryOption]
= TRUSTED BEGIN
RETURN[handle.trans.inst.file.GetRecoveryOption[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
GetReferencePattern: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[referencePattern:
AE.ReferencePattern] = TRUSTED BEGIN
RETURN[handle.trans.inst.file.GetReferencePattern[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
SetReferencePattern: PUBLIC PROCEDURE[handle: AlpF.Handle, referencePattern:
AE.ReferencePattern] = TRUSTED BEGIN
handle.trans.inst.file.SetReferencePattern[handle.trans.inst.conversation, handle.openFileID, referencePattern
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetSize: PUBLIC PROCEDURE[handle: AlpF.Handle, lock: AE.LockOption] RETURNS[size:
AE.PageCount] = TRUSTED BEGIN
RETURN[handle.trans.inst.file.GetSize[handle.trans.inst.conversation, handle.openFileID, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
SetSize: PUBLIC PROCEDURE[handle: AlpF.Handle, size: AE.PageCount, lock: AE.LockOption] =
TRUSTED BEGIN
handle.trans.inst.file.SetSize[handle.trans.inst.conversation, handle.openFileID, size, lock
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetUniversalFile: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[universalFile:
AE.UniversalFile] = TRUSTED BEGIN
universalFile ←
handle.trans.inst.file.GetUniversalFile[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
UnlockVersion: PUBLIC PROCEDURE[handle: AlpF.Handle] = TRUSTED BEGIN
handle.trans.inst.file.UnlockVersion[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
IncrementVersion: PUBLIC PROCEDURE[handle: AlpF.Handle, increment: INT] = TRUSTED BEGIN
handle.trans.inst.file.IncrementVersion[handle.trans.inst.conversation, handle.openFileID, increment
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
UnlockFile: PUBLIC PROCEDURE[handle: AlpF.Handle, retainCacheLocks: BOOLEANFALSE]
= TRUSTED BEGIN
handle.trans.inst.file.UnlockFile[handle.trans.inst.conversation, handle.openFileID, retainCacheLocks
! RPC.CallFailed => IF why = unbound OR why = timeout THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
AccessFailed: PUBLIC ERROR [missingAccess: AE.NeededAccess] ← AF.AccessFailed;
LockFailed: PUBLIC ERROR [why: AE.LockFailure] ← AF.LockFailed;
OperationFailed: PUBLIC ERROR [why: AE.OperationFailure] ← AF.OperationFailed;
StaticallyInvalid: PUBLIC ERRORAF.StaticallyInvalid;
Unknown: PUBLIC ERROR [what: AE.UnknownType] ← AF.Unknown;
PossiblyDamaged: PUBLIC SIGNALLOOPHOLE[AF.PossiblyDamaged];
END.
Edit Log
Initial: Kolling: February 14, 1983 5:08 pm: package to aid clients, in conjunction with AlpInstance and AlpTransaction.