ComputeServerInternal:
CEDAR
DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
IdleTransitionsEnabled: BOOL;
ActiveServices: INT; -- count of currently active services
myHostName: ROPE;
MyNetAddressRope: ROPE;
ControllerGVName: ROPE;
RemoteCommandDir: ROPE;
LocalCommandDir: ROPE ;
OKToUseLocalDisk: BOOL;
RegisteredProcObject: TYPE = ComputeServerServer.RegisteredProcObject;
RegisteredProcObject: TYPE = RECORD [
version: Rope.ROPE,
service: Rope.ROPE,
commanderProcHandle: Commander.CommandProcHandle ← NIL
];
RegisteredProcHandle: TYPE = REF RegisteredProcObject;
PackageEntryObject:
TYPE =
RECORD [
package: ROPE ← NIL,
dfCreate: BasicTime.GMT ← BasicTime.nullGMT,
commands: LIST OF ROPE ← NIL,
maintainer: LIST OF ROPE ← NIL,
latestVersion: ROPE ← NIL,
runVersion: ROPE ← NIL,
exclusive: BOOL ← FALSE,
maxCountActive: INT ← 10000,
nowActive: INT ← 0
];
PackageEntry: TYPE = REF PackageEntryObject;
PackageTable: SymTab.Ref;
CmdEntryObject:
TYPE =
RECORD [
service: ROPE ← NIL,
package: ROPE ← NIL,
version: ROPE ← NIL,
firstTime: BOOL ← TRUE,
doQueueing: BOOL ← FALSE,
okToQueuePosted: BOOL ← FALSE
];
CmdEntry: TYPE = REF CmdEntryObject;
ConfigEntryObject:
TYPE =
RECORD [
package: ROPE ← NIL,
dfCreate: BasicTime.GMT ← BasicTime.nullGMT,
maintainer: LIST OF ROPE ← NIL
];
ConfigEntry: TYPE = REF ConfigEntryObject;
ConfigTable: PUBLIC SymTab.Ref;
ActiveServicesListBase: ActiveServicesItem ;
ActiveServicesItem: TYPE = REF ActiveServicesItemObject;
ActiveServicesPointer: TYPE = LONG POINTER TO ActiveServicesItemObject;
StreamEOFState: TYPE = {true, pending, false};
ActiveServicesItemObject:
TYPE =
RECORD [
next: ActiveServicesItem,
callbacksInterface: ComputeServerCallbacksRpcControl.InterfaceRecord ← NIL,
userInterface: ComputeServerUserRpcControl.InterfaceRecord ← NIL,
listenerPupAddress: PupDefs.PupAddress,
startListenGMT: BasicTime.GMT,
listener: PupListener,
heardDoService: BOOL ← FALSE,
debugItem: BOOL ← FALSE,
debuggerInterface: ComputeServerDebuggerRpcControl.InterfaceRecord ← NIL,
h: InterpreterToolPrivate.Handle ← NIL,
originalListenerPupAddress: PupDefs.PupAddress ← [[0],[0],[0,0]],
procHandle: RegisteredProcHandle,
msg: ROPE ← NIL,
success: ComputeServerClient.RemoteSuccess,
remoteStream: IO.STREAM ← NIL,
clientNetAddressRope: ROPE ← NIL,
clientMachineName: ROPE ← NIL,
packageEntry: PackageEntry,
commandEntry: CmdEntry,
inEOF: BOOL ← FALSE,
outEOF: StreamEOFState ← false,
doingEnumerate: BOOL ← FALSE,
callOver: BOOL ← FALSE,
pleaseAbort: BOOL ← FALSE
];
PupListener: TYPE = REF PupListenerObject;
PupListenerObject: TYPE;
BufStreamData: TYPE = REF BufStreamDataObject;
BufStreamBufferSize: INT = 128;
bufStreamState: TYPE = {true, pending, false};
BufStreamDataObject:
TYPE =
RECORD [
inPointer: NAT ← 0,
outPointer: NAT ← 0,
EOF: bufStreamState ← false,
listenerItem: ActiveServicesItem,
buffer: ARRAY [0..BufStreamBufferSize-1] OF CHAR ← ALL[' ]
];
CommandTable: SymTab.Ref; -- knowing a command, find the package/version
MarkGuestProcess:
PROC [process:
PROCESS, data:
LONG
POINTER]
RETURNS [ok:
BOOL ←
TRUE, oldData:
LONG
POINTER];
Establish this process as a guest. data must point to "guest process data"
IsGuestProcess: PROC [] RETURNS [isGuest: BOOL] ;
GetGuestProcessData: PROC [process: PROCESS] RETURNS [data: LONG POINTER];
MarkProcessNotGuest:
PROC [process:
PROCESS];
Temporarily flag this process as not a guest, but retain "guest process data". All use of FS, UserCredentials and UserProfile will now be done locally.
RemoveMarkProcessNotGuest:
PROC [process:
PROCESS];
Reverses the effect of MarkProcessNotGuest
MarkProcessUseLocalFS:
PROC [process:
PROCESS];
Temporarily flag this process as not a guest for FS calls, but retain "guest process data".
RemoveMarkProcessUseLocalFS:
PROC [process:
PROCESS];
Reverses the effect of MarkProcessUseLocalFS
AddPupAddress:
PROC [serverPupAddress: PupDefs.PupAddress, procHandle: RegisteredProcHandle, listener: PupListener]
RETURNS [newItem: ActiveServicesItem];
Note a new active service
DeletePupAddress:
PROC [serverPupAddress: PupDefs.PupAddress]
RETURNS [found:
BOOL];
Remove an active service
MatchPupAddress:
PROC [serverPupAddress: PupDefs.PupAddress, flagStarted:
BOOL ←
FALSE]
RETURNS [found:
BOOL, item: ActiveServicesItem];
Find an active service by pup address - that's a unique id.
GetClientInterfaceFromCache: PROC [clientInstance: RPC.ShortROPE, forceNewInterface: BOOL ← FALSE] RETURNS [clientInterface: ComputeServerCallbacksRpcControl.InterfaceRecord ← NIL];
DeleteClientInterfaceFromCache: PROC [clientInterface: ComputeServerCallbacksRpcControl.InterfaceRecord] RETURNS [gotIt: BOOL ← FALSE];
findDebuggerItemFromInterpreterHandle: PROC [h: InterpreterToolPrivate.Handle] RETURNS [found: BOOL, item: ActiveServicesItem ← NIL];
KillOldUnstartedServices: PROC;
CreatePupByteStreamListener:
PROC [
local: PupDefs.PupSocketID, proc: PROCEDURE [STREAM, PupDefs.PupAddress, PupListener, PupDefs.PupAddress], ticks: PupDefs.Tocks,
filter: PROCEDURE [PupDefs.PupAddress]] RETURNS [PupListener];
DestroyPupListener: PROC [listener: PupListener];
ListenerProcess: PROC [stream: STREAM, connectionPupAddress: PupDefs.PupAddress, listener: PupListener, listenerPupAddress: PupDefs.PupAddress];
DontReject: PROCEDURE [PupDefs.PupAddress] ;
inStreamProcs: REF IO.StreamProcs;
outStreamProcs: REF IO.StreamProcs;
inCharsAvail: PROC [self: STREAM, wait: BOOL] RETURNS [INT];
inBufGetChar: PROC [self: STREAM] RETURNS [ch: CHAR];
outBufPutChar: PROC [self: STREAM, char: CHAR];
ControllerInterface: ComputeServerControllerRpcControl.InterfaceRecord;
ServiceEnabled: BOOL;
SendStats: PROC [] RETURNS [success, terminateService, newPackage: BOOL, queueingCommands: LIST OF Rope.ROPE];
InitStats: PROC [myName: RPC.ShortROPE, myAddress: RPC.ShortROPE] ;
InitCommands: PROC [remoteCommandDirectory, localCommandDirectory: Rope.ROPE] RETURNS [msg: Rope.ROPE ← NIL] ;
getNewPackages: PROC;
MyCatcher: RuntimeError.UCSProc;
SummonerServerMonitor: PROC;
ReportServerEvent: PROC [type: ComputeServerStatistics.ServerEventType, command: Rope.ROPE, startTime: BasicTime.GMT, endTime: BasicTime.GMT, remoteMachineName: Rope.ROPE];
END.