RemoteFile.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Demers, November 7, 1987 2:00:36 pm PST
DIRECTORY
Rope USING [ROPE]
;
RemoteFile: CEDAR DEFINITIONS
~ {
Copied Types
ROPE: TYPE ~ Rope.ROPE;
Server handles
ServerHandle: TYPE ~ REF ServerObject;
ServerObject: TYPE ~ RECORD [
flavor: ATOM,
name: ROPE, -- e.g. "Ivy-STP", "Palain-NFS"
procs: ServerProcs,
data: REF
];
ServerProcs: TYPE ~ REF ServerProcsObject;
ServerProcsObject: TYPE ~ RECORD [
sweep: SweepProc ← NIL,
validate: ValidateProc,
getProcs: GetProcsProc
];
SweepProc: TYPE ~ PROC [h: ServerHandle, seconds: CARD];
Called a few (~10) times a minute by this package for miscellaneous housekeeping. The seconds argument specifies how long it's been since the last call.
ValidateProc: TYPE ~ PROC [h: ServerHandle] RETURNS [obsolete: BOOL, downMsg: ROPE];
Called to validate a handle that might be stale.
If obsolete=TRUE, the handle is out of date and should be replaced (by calling appropriate getServerProc).
IF downMsg#NIL, the server is known to exist but is down.
GetProcsProc: TYPE ~ PROC [h: ServerHandle, view: ATOM] RETURNS [procs: REF];
Return procs record for specified view of given server.
! Error[$notImplemented, ...]
Registration
Register: PROC [flavor: ATOM, getServer: GetServerProc];
Register an(other) remote file ops implementation. Any existing registration for "flavor" disappears. "getServer" may be NIL, to clear a registration.
GetServerProc: TYPE ~ PROC [server: ROPE] RETURNS [h: ServerHandle, downMsg: ROPE];
Tries to find a server of the given name.
If successful, creates ServerHandle h and return [h, NIL].
If no server responds and no server is known to exist, returns [NIL, NIL].
If server is known to exist but is not responding, returns [NIL, message],
Does not raise Error!
The caller may Process.Abort a GetServerProc.
Lookup
GetServer: PROC [server: ROPE] RETURNS [h: ServerHandle];
Tries to find a server of the given name, using the server cache.
! Error[$serverNotKnown, ...]
! Error[$serverNotAvailable, ...]
GetProcs: PROC [h: ServerHandle, view: ATOM] RETURNS [procs: REF] ~ INLINE {
RETURN[h.procs.getProcs[h, view]] };
Controlling the flavor of a cached server.
If this is necessary the network environment is probably screwed up.
SetCachedServer: PROC [server: ROPE, flavor: ATOM];
Force server of given name to be of given flavor.
ClearCachedServer: PROC [server: ROPE];
Error
Error: ERROR [code: ATOM, msg: ROPE];
Codes
$serverNotKnown : can't look up the server name.
$serverNotAvailable : can't contact it.
$notImplemented : requested view not implemented by server.
$software : "can't happen"
}...