ComputeServerInternal:
CEDAR
DEFINITIONS =
BEGIN
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
IdleTransitionsEnabled: BOOL;
ActiveServices: INT; -- count of currently active services
LastActiveTime: BasicTime.GMT;
myHostName: ROPE;
MyNetAddressRope: ROPE;
ControllerGVName: ROPE;
RemoteCommandDir: ROPE;
LocalCommandDir: ROPE ;
OKToUseLocalDisk: BOOL;
DisableIFIdle: BOOL;
DisableIFIdleAfter: INT;
DisableIFIdleBefore: INT;
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,
listenerPupAddress: Pup.Address,
startListenGMT: BasicTime.GMT,
sockets: PupStream.Sockets,
heardDoService: BOOL ← FALSE,
debugItem: BOOL ← FALSE,
quitRendezvousAttempt: BOOL ← FALSE,
rendezvousDone: BOOL ← FALSE,
h: InterpreterToolPrivate.Handle ← NIL,
originalListenerPupAddress: Pup.Address ← Pup.nullAddress,
procHandle: RegisteredProcHandle,
msg: ROPE ← NIL,
success: ComputeServerClient.RemoteSuccess,
remoteStream: IO.STREAM ← NIL,
clientNetAddressRope: ROPE ← NIL,
clientMachineName: ROPE ← NIL,
userName: ROPE ← NIL,
packageEntry: PackageEntry,
commandEntry: CmdEntry,
inEOF: BOOL ← FALSE,
outEOF: StreamEOFState ← false,
flushCounter: INT ← -1,
outStreamBusy: BOOL ← FALSE,
doingEnumerate: BOOL ← FALSE,
callOver: BOOL ← FALSE,
pleaseAbort: BOOL ← FALSE,
request: LIST OF ComputeServer.Request
];
CurrentRequests: LIST OF ComputeServer.Request;
BufStreamData: TYPE = REF BufStreamDataObject;
BufStreamBufferSize: CARDINAL = 1024; -- must be a power of 2 and match BufStreamBufferSizeMask
BufStreamBufferSizeMask: INT = 1777B; -- must match BufStreamBufferSize
bufStreamState: TYPE = {true, pending, false};
BufStreamDataObject:
TYPE =
RECORD [
inPointer: CARD ← 0,
outPointer: CARD ← 0,
EOF: bufStreamState ← false,
listenerItem: ActiveServicesItem,
buffer: ARRAY [0..BufStreamBufferSize) OF CHAR ← ALL[' ],
backUpChars: LIST OF CHAR ← NIL
];
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: Pup.Address, procHandle: RegisteredProcHandle, sockets: PupStream.Sockets]
RETURNS [newItem: ActiveServicesItem];
Note a new active service
DeletePupAddress:
PROC [serverPupAddress: Pup.Address]
RETURNS [found:
BOOL];
Remove an active service
MatchPupAddress:
PROC [serverPupAddress: Pup.Address, 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;
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, userName: Rope.ROPE];
END.