-- AlpDebugImpl.mesa
-- Last edited by
-- Kolling on June 3, 1983 4:19 pm


DIRECTORY

AlpDebug
USING[Handle],
AlpineDebug
USING[AccessFailed, ChangeSpaceForOwner, CrashSystem, LockFailed,
OperationFailed, ReadDBUniversalFile, ReadOwnerFileHeader, ReadNextOwnerRecord,
ReportAccessCacheStats, ReportAccessVolatileStats,
StaticallyInvalid, Unknown],
AlpineDebugRpcControl
USING[ImportNewInterface, InterfaceRecord, NewInterfaceRecord],
AlpineEnvironment
USING[Conversation, LockFailure, NeededAccess, OperationFailure, OwnerName,
OwnerPropertySet, OwnerPropertyValuePair, PageCount, TransID, UniversalFile,
UnknownType, VolumeGroupID],
AlpineFile
USING[AccessFailed, LockFailed, OperationFailed, PossiblyDamaged, StaticallyInvalid,
Unknown],
AlpineOwner
USING[allOwnerProperties],
AlpInstance
USING[Handle],
AlpPrivate
USING[InterfaceCreatorProc, NoticeUnboundInstance, RegisterInterfaceCreator],
RPC
USING[CallFailed],
Rope
USING[Equal, ROPE];


AlpDebugImpl: CEDAR PROGRAM
IMPORTS AD: AlpineDebug, AlpineDebugRpcControl, AF: AlpineFile, AlpPrivate, RPC, Rope
EXPORTS AlpDebug
SHARES AlpineDebugRpcControl =

BEGIN OPEN AlpD: AlpDebug, AE: AlpineEnvironment, AlpI: AlpInstance;

ReadOwnerFileHeader: PUBLIC PROCEDURE[handle: AlpD.Handle, volumeGroupID:
AE.VolumeGroupID] RETURNS[version: NAT, recordedVolGroupID: AE.VolumeGroupID,
totalQuota, quotaLeft: AE.PageCount, numberOfOwners, numberOfOwnerSlotsInUse,
maxNumberOfOwnersAllowed: NAT] =
TRUSTED BEGIN
[version: version, recordedVolGroupID: recordedVolGroupID, totalQuota: totalQuota,
quotaLeft: quotaLeft, numberOfOwners: numberOfOwners, numberOfOwnerSlotsInUse:
numberOfOwnerSlotsInUse, maxNumberOfOwnersAllowed: maxNumberOfOwnersAllowed] ←
GetDebugInterface[handle].ReadOwnerFileHeader[handle.inst.conversation,
handle.transID, volumeGroupID
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.inst]];
END;

ReadNextOwnerRecord
: PUBLIC PROCEDURE[handle: AlpD.Handle, volumeGroupID:
AE.VolumeGroupID, contRecNum: INT ← 0, desiredProperties: AE.OwnerPropertySet ←
AlpineOwner.allOwnerProperties] RETURNS[entryEmpty, entryValid: BOOLEAN, owner:
AE.OwnerName, properties: LIST OF AE.OwnerPropertyValuePair, nextContRecNum: INT] =
TRUSTED BEGIN
[entryEmpty: entryEmpty, entryValid: entryValid, owner: owner, properties: properties,
nextContRecNum: nextContRecNum] ←
GetDebugInterface[handle].ReadNextOwnerRecord[handle.inst.conversation,
handle.transID, volumeGroupID, contRecNum, desiredProperties
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.inst]];
END;

ChangeSpaceForOwner: PUBLIC PROCEDURE[handle: AlpD.Handle, volumeGroupID:
AE.VolumeGroupID, ownerName: AE.OwnerName, nPages: AE.PageCount] =
TRUSTED BEGIN
GetDebugInterface[handle].ChangeSpaceForOwner[handle.inst.conversation,
handle.transID, volumeGroupID, ownerName, nPages
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.inst]];
END;

ReadDBUniversalFile
: PUBLIC PROCEDURE[handle: AlpD.Handle, volumeGroupID:
AE.VolumeGroupID] RETURNS[dBID: AE.UniversalFile] =
TRUSTED BEGIN
RETURN[GetDebugInterface[handle].ReadDBUniversalFile[volumeGroupID
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.inst]]];
END;

ReportAccessCacheStats: PUBLIC PROCEDURE[handle: AlpD.Handle] RETURNS
[nCacheEntries: NAT, statsCacheHit, statsGrapevineAuthorized, statsGrapevineNotAuthorized,
statsRegServersDown, statsIndivGrapeNotAuthorized: INT] =
TRUSTED BEGIN
[nCacheEntries: nCacheEntries, statsCacheHit: statsCacheHit, statsGrapevineAuthorized:
statsGrapevineAuthorized, statsGrapevineNotAuthorized: statsGrapevineNotAuthorized,
statsRegServersDown: statsRegServersDown, statsIndivGrapeNotAuthorized:
statsIndivGrapeNotAuthorized] ← GetDebugInterface[handle].ReportAccessCacheStats[
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.inst]];
END;

ReportAccessVolatileStats
: PUBLIC PROCEDURE[handle: AlpD.Handle] RETURNS
[nRegs, nInits, nUnRegs, nReorganizes, nEnumAlls, nAllocReqsWin, nAllocReqsLose,
nDeallocReqs, nRemoveOwner, nEnumFindWin, nEnumFindLose, nSetEnums, nActions,
nPhaseOnes, nPhaseTwos, nAborts: INT] =
TRUSTED BEGIN
[nRegs: nRegs, nInits: nInits, nUnRegs: nUnRegs, nReorganizes: nReorganizes, nEnumAlls:
nEnumAlls, nAllocReqsWin: nAllocReqsWin, nAllocReqsLose: nAllocReqsLose,
nDeallocReqs: nDeallocReqs, nRemoveOwner: nRemoveOwner, nEnumFindWin:
nEnumFindWin, nEnumFindLose: nEnumFindLose, nSetEnums: nSetEnums,
nActions: nActions, nPhaseOnes: nPhaseOnes, nPhaseTwos: nPhaseTwos, nAborts:
nAborts] ← GetDebugInterface[handle].ReportAccessVolatileStats[
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.inst]];
END;

CrashSystem
: PUBLIC PROCEDURE[handle: AlpD.Handle] =
TRUSTED BEGIN
GetDebugInterface[handle].CrashSystem[handle.inst.conversation, handle.transID
! RPC.CallFailed => IF why = unbound THEN
AlpPrivate.NoticeUnboundInstance[handle.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 ERROR ← AF.StaticallyInvalid;
Unknown: PUBLIC ERROR [what: AE.UnknownType] ← AF.Unknown;
PossiblyDamaged: PUBLIC SIGNALLOOPHOLE[AF.PossiblyDamaged];



NoInterface: ERROR = CODE;

GetDebugInterface: PROCEDURE[handle: AlpDebug.Handle] RETURNS[interface:
AlpineDebugRpcControl.InterfaceRecord] =
BEGIN
FOR list: LIST OF REF ANY ← handle.inst.otherInterfaces, list.rest
UNTIL list = NIL
DO
WITH list.first SELECT FROM
interface: AlpineDebugRpcControl.InterfaceRecord => RETURN[interface];
ENDCASE;
ENDLOOP
;
ERROR NoInterface;
END;


-- InterfaceCreatorProc: TYPE = PROCEDURE[fileStore: AlpineEnvironment.FileStore, version: RPC.VersionRange] RETURNS[REF ANY];
DebugInterfaceCreatorProc
: AlpPrivate.InterfaceCreatorProc =
-- non system-fatal errors:
BEGIN
IF Rope.Equal[fileStore, "local.alpine", FALSE]
THEN BEGIN
interface: AlpineDebugRpcControl.InterfaceRecord ←
AlpineDebugRpcControl.NewInterfaceRecord[];
interface^ ← [ReadOwnerFileHeader: AD.ReadOwnerFileHeader, ReadNextOwnerRecord:
AD.ReadNextOwnerRecord, ChangeSpaceForOwner: AD.ChangeSpaceForOwner,
ReadDBUniversalFile: AD.ReadDBUniversalFile, ReportAccessCacheStats:
AD.ReportAccessCacheStats, ReportAccessVolatileStats: AD.ReportAccessVolatileStats,
CrashSystem: AD.CrashSystem, AccessFailed: AD.AccessFailed, LockFailed:
AD.LockFailed, OperationFailed: AD.OperationFailed, StaticallyInvalid:
AD.StaticallyInvalid, Unknown: AD.Unknown, lupineDetails: ];
RETURN
[interface];
END
ELSE RETURN
[AlpineDebugRpcControl.ImportNewInterface[[type: "AlpineDebug.alpine",
instance: fileStore, version: version], [NIL, NIL, NIL]]];
END;




-- main line code:

AlpPrivate.RegisterInterfaceCreator[proc: DebugInterfaceCreatorProc];


END.


Edit Log

Initial: Kolling: March 8, 1983 1:10 pm: implementors interface.