DIRECTORY BasicTime USING [GMT], FS USING [FileType, InfoProc, NameProc, tUnspecified], FSBackdoor USING [Version], IO USING [STREAM], Rope USING [ROPE] ; FSRemoteFileExtras: CEDAR DEFINITIONS ~ { ROPE: TYPE ~ Rope.ROPE; GMT: TYPE ~ BasicTime.GMT; Version: TYPE ~ FSBackdoor.Version; FileType: TYPE ~ FS.FileType; Delete: PROCEDURE [server, file: ROPE, wantedCreatedTime: GMT, proc: ConfirmProc]; ConfirmProc: TYPE ~ PROC [v: Version] RETURNS [BOOL]; EnumerateForInfo: PROCEDURE [server, pattern: ROPE, proc: InfoProc]; InfoProc: TYPE ~ FS.InfoProc -- [fullFName, attachedTo: ROPE, created: GMT, bytes: INT, keep: CARDINAL, fileType: FileType] RETURNS [continue: BOOL] -- ; EnumerateForNames: PROCEDURE [server, pattern: ROPE, proc: NameProc]; NameProc: TYPE ~ FS.NameProc -- [fullFName: ROPE] RETURNS [continue: BOOL] -- ; Info: PROCEDURE [server, file: ROPE, wantedCreatedTime: GMT] RETURNS [version: Version, bytes: INT, created: GMT, fileType: FileType]; Rename: PROCEDURE [server, fromFile: ROPE, fromCreated: GMT, toFile: ROPE, proc: ConfirmProc]; Retrieve: PROCEDURE [server, file: ROPE, wantedCreatedTime: GMT, proc: ConfirmRetrieveProc, checkFileType: BOOL _ FALSE, fileType: FileType _ FS.tUnspecified]; ConfirmRetrieveProc: TYPE ~ PROC [fullGName: Rope.ROPE, bytes: INT, created: GMT] RETURNS [IO.STREAM]; Store: PROCEDURE [server, file: ROPE, str: IO.STREAM, created: GMT, proc: ConfirmProc]; ServerHandle: TYPE ~ REF ServerObject; ServerObject: TYPE ~ RECORD [ flavor: ATOM, name: ROPE, procs: ServerProcs, data: REF ]; ServerProcs: TYPE ~ REF ServerProcsObject; ServerProcsObject: TYPE ~ RECORD [ sweep: SweepProc _ NIL, validate: ValidateProc, delete: DeleteProc, enumerateForInfo: EnumerateForInfoProc, enumerateForNames: EnumerateForNamesProc, getInfo: GetInfoProc, rename: RenameProc, retrieve: RetrieveProc, store: StoreProc ]; SweepProc: TYPE ~ PROC [h: ServerHandle, seconds: INT]; ValidateProc: TYPE ~ PROC [h: ServerHandle] RETURNS [ok: BOOL]; DeleteProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, wantedCreatedTime: GMT, proc: ConfirmProc]; EnumerateForInfoProc: TYPE ~ PROC [h: ServerHandle, pattern: ROPE, proc: InfoProc]; EnumerateForNamesProc: TYPE ~ PROC [h: ServerHandle, pattern: ROPE, proc: NameProc]; GetInfoProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, wantedCreatedTime: GMT] RETURNS [version: Version, bytes: INT, created: GMT, fileType: FileType]; RenameProc: TYPE ~ PROC [h: ServerHandle, fromFile: ROPE, fromCreated: GMT, toFile: ROPE, proc: ConfirmProc]; RetrieveProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, wantedCreatedTime: GMT, proc: ConfirmRetrieveProc, checkFileType: BOOL, fileType: FileType]; StoreProc: TYPE ~ PROC [h: ServerHandle, file: ROPE, str: IO.STREAM, created: GMT, proc: ConfirmProc]; Register: PROC [flavor: ATOM, getServer: GetServerProc]; GetServerProc: TYPE ~ PROC [server: ROPE] RETURNS [h: ServerHandle]; SetCachedServer: PROC [server: ROPE, flavor: ATOM]; ClearCachedServer: PROC [server: ROPE]; }... FSRemoteFileExtras.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Demers, September 19, 1987 3:12:35 pm PDT Copied Types Interface to FS Does a delete of the remote file. "proc" is called with the version number of the file to be deleted. Reports the version number of the file to be acted upon. Returning FALSE stops the action, TRUE allows it to continue. Reports the info about each file during EnumerateForInfo. Returning FALSE aborts the enumeration. This is a restricted use of FS.InfoProc : attachedTo is always NIL, keep is always 0. Reports the info about each file during EnumerateForName. Returning FALSE aborts the enumeration. Does a rename on a single remote server. "proc" is called with the version number of the "fromFile". Tries to find the remote file specified by "server" "file" and "wantedCreatedTime". If the file is located then "proc" is called with the full GName (canonical spelling), bytes and created time. If NIL is returned then Retrieve aborts and returns to its caller. Otherwise, the bytes from the remote file are put into the IO.STREAM; the client must close the IO.STREAM. Tries to store the bytes obtained from "str" into the named remote file. Sets the created time of the remote file to "created". "proc" is called with the version number of the file to be created. Interface to communications layer Should become FSRemoteFileBackdoor? Server handles: Called a few times a minute by this package for miscellaneous housekeeping: Called to validate a handle that might be stale: The following are called to perform file operations. They should raise appropriate FS.Error's to indicate failure: Registration Register an(other) remote file ops implementation. Any existing registration for "flavor" disappears. "getServer" may be NIL, to clear a registration. Try to find a server of the given name. Should return NIL if no server responds and no server is known to exist. Should return an unusable handle (i.e. a handle such that every operation will raise FS.Error) if server is known to exist but is not responding. Should not raise FS.Error itself! The caller may Process.Abort this proc. Controlling the flavor of a cached server. If this is necessary the network environment is probably screwed up. Force server of given name to be of given flavor. Κ·˜codešœ™K™