-- AlpFileImpl.mesa
-- Last edited by
-- Kolling on April 27, 1983 12:03 pm
DIRECTORY
AlpineEnvironment
USING[AccessRights, FileID, LockOption, OpenFileID, OwnerName, PageCount,
PageRun, PropertyValuePair, RecoveryOption, ReferencePattern, VolOrVolGroupID,
VolumeID],
AlpFile
USING[Handle, Object, PropertySet, RESULTPageBuffer, VALUEPageBuffer],
AlpPrivate
USING[NoticeUnboundInstance],
AlpTransaction
USING[Handle],
File
USING[Type],
RPC
USING[CallFailed],
SafeStorage
USING[GetSystemZone];
AlpFileImpl: PROGRAM
IMPORTS AlpF: AlpFile, AE: AlpineEnvironment, AlpP: AlpPrivate, AlpT: AlpTransaction,
RPC, SafeStorage
EXPORTS AlpFile =
BEGIN
-- 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, volumeID: AE.VolumeID, fileID: AE.FileID,
access: AE.AccessRights, lock: AE.LockOption, recoveryOption: AE.RecoveryOption,
referencePattern: AE.ReferencePattern, zone: ZONE] RETURNS[handle: AlpF.Handle] =
BEGIN IF zone = NIL THEN zone ← SafeStorage.GetSystemZone[];
RETURN[zone.NEW[AlpF.Object ← [trans: transHandle, openFileID:
transHandle.inst.file.Open[transHandle.inst.conversation, transHandle.transID,
volumeID, fileID, access, lock, recoveryOption, referencePattern
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[transHandle.inst]]]]];
END;
Create: PUBLIC PROCEDURE[transHandle: AlpT.Handle, volumeID: AE.VolOrVolGroupID, owner:
AE.OwnerName, initialSize: AE.PageCount, type: File.Type, recoveryOption:
AE.RecoveryOption, referencePattern: AE.ReferencePattern, zone: ZONE] RETURNS[handle:
AlpF.Handle] =
BEGIN IF zone = NIL THEN zone ← SafeStorage.GetSystemZone[];
RETURN[zone.NEW[AlpF.Object ← [trans: transHandle, openFileID:
transHandle.inst.file.Create[transHandle.inst.conversation, transHandle.transID, volumeID,
owner, initialSize, type, recoveryOption, referencePattern
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[transHandle.inst]]]]];
END;
Close: PUBLIC PROCEDURE[handle: AlpF.Handle] =
BEGIN handle.trans.inst.file.Close[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
Delete: PUBLIC PROCEDURE[handle: AlpF.Handle] =
BEGIN handle.trans.inst.file.Delete[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
ReadPages: PUBLIC PROCEDURE[handle: AlpF.Handle, pageRun: AE.PageRun, pageBuffer:
AlpF.RESULTPageBuffer, lock: AE.LockOption] =
BEGIN handle.trans.inst.file.ReadPages[handle.trans.inst.conversation, handle.openFileID,
pageRun, pageBuffer, lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
WritePages: PUBLIC PROCEDURE[handle: AlpF.Handle, pageRun: AE.PageRun, pageBuffer:
AlpF.VALUEPageBuffer, lock: AE.LockOption] =
BEGIN handle.trans.inst.file.WritePages[handle.trans.inst.conversation, handle.openFileID,
pageRun, pageBuffer, lock
! RPC.CallFailed => IF why = unbound 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] =
BEGIN RETURN[handle.trans.inst.file.ReadProperties[handle.trans.inst.conversation,
handle.openFileID, desiredProperties, lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
WriteProperties: PUBLIC PROCEDURE[handle: AlpF.Handle, properties: LIST OF
AE.PropertyValuePair, lock: AE.LockOption] =
BEGIN handle.trans.inst.file.WriteProperties[handle.trans.inst.conversation, handle.openFileID,
properties, lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
LockPages: PUBLIC PROCEDURE[handle: AlpF.Handle, pageRun: AE.PageRun, lock:
AE.LockOption] =
BEGIN handle.trans.inst.file.LockPages[handle.trans.inst.conversation, handle.openFileID,
pageRun, lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
UnlockPages: PUBLIC PROCEDURE[handle: AlpF.Handle, pageRun: AE.PageRun] =
BEGIN handle.trans.inst.file.UnlockPages[handle.trans.inst.conversation, handle.openFileID,
pageRun
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetAccessRights: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[access: AE.AccessRights]
=
BEGIN RETURN[handle.trans.inst.file.GetAccessRights[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
GetFileID: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[fileID: AE.FileID] =
BEGIN RETURN[handle.trans.inst.file.GetFileID[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
GetLockOption: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[lock: AE.LockOption] =
BEGIN RETURN[handle.trans.inst.file.GetLockOption[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
SetLockOption: PUBLIC PROCEDURE[handle: AlpF.Handle, lock: AE.LockOption] =
BEGIN handle.trans.inst.file.SetLockOption[handle.trans.inst.conversation,
handle.openFileID, lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetRecoveryOption: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[recoveryOption:
AE.RecoveryOption] =
BEGIN RETURN[handle.trans.inst.file.GetRecoveryOption[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
GetReferencePattern: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[referencePattern:
AE.ReferencePattern] =
BEGIN RETURN[handle.trans.inst.file.GetReferencePattern[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
SetReferencePattern: PUBLIC PROCEDURE[handle: AlpF.Handle, referencePattern:
AE.ReferencePattern] =
BEGIN handle.trans.inst.file.SetReferencePattern[handle.trans.inst.conversation,
handle.openFileID, referencePattern
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetSize: PUBLIC PROCEDURE[handle: AlpF.Handle, lock: AE.LockOption] RETURNS[size:
AE.PageCount] =
BEGIN RETURN[handle.trans.inst.file.GetSize[handle.trans.inst.conversation, handle.openFileID,
lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
SetSize: PUBLIC PROCEDURE[handle: AlpF.Handle, size: AE.PageCount, lock: AE.LockOption] =
BEGIN handle.trans.inst.file.SetSize[handle.trans.inst.conversation, handle.openFileID,
size, lock
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
GetVolumeID: PUBLIC PROCEDURE[handle: AlpF.Handle] RETURNS[volumeID: AE.VolumeID] =
BEGIN RETURN[handle.trans.inst.file.GetVolumeID[handle.trans.inst.conversation,
handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]]];
END;
UnlockVersion: PUBLIC PROCEDURE[handle: AlpF.Handle] =
BEGIN handle.trans.inst.file.UnlockVersion[handle.trans.inst.conversation, handle.openFileID
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
IncrementVersion: PUBLIC PROCEDURE[handle: AlpF.Handle, increment: INT] =
BEGIN handle.trans.inst.file.IncrementVersion[handle.trans.inst.conversation, handle.openFileID,
increment
! RPC.CallFailed => IF why = unbound THEN
AlpP.NoticeUnboundInstance[handle.trans.inst]];
END;
END.
Edit Log
Initial: Kolling: February 14, 1983 5:08 pm: package to aid clients, in conjunction with AlpInstance and AlpTransaction.