FSRemoteFile.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited by:
Bob Hagmann April 29, 1985 10:23:00 am PDT
Schroeder, November 15, 1983 1:23 pm
DIRECTORY
BasicTime USING [GMT],
FS USING [InfoProc, NameProc],
FSBackdoor USING [Version],
IO USING [STREAM],
Rope USING [ROPE];
FSRemoteFile: CEDAR DEFINITIONS =
BEGIN
ConfirmProc: TYPE = PROC [FSBackdoor.Version] RETURNS [BOOLEAN];
Reports the version number of the file to be acted upon. Returning FALSE stops the action, TRUE allows it to continue.
Delete: PROCEDURE [server, file: Rope.ROPE, wantedCreatedTime: BasicTime.GMT, proc: ConfirmProc ];
Does a delete of the remote file. "proc" is called with the version number of the file to be deleted.
EnumerateForInfo: PROCEDURE [server, pattern: Rope.ROPE, proc: FS.InfoProc];
EnumerateForNames: PROCEDURE [server, pattern: Rope.ROPE, proc: FS.NameProc];
Info: PROCEDURE [server, file: Rope.ROPE, wantedCreatedTime: BasicTime.GMT] RETURNS [version: FSBackdoor.Version, bytes: INT, created: BasicTime.GMT];
Rename: PROCEDURE [server, fromFile: Rope.ROPE, fromCreated: BasicTime.GMT, toFile: Rope.ROPE, proc: ConfirmProc ];
Does a rename on a single remote server. "proc" is called with the version number of the "fromFile".
Retrieve: PROCEDURE [server, file: Rope.ROPE, wantedCreatedTime: BasicTime.GMT, proc: PROC[fullGName: Rope.ROPE, bytes: INT, created: BasicTime.GMT] RETURNS [IO.STREAM]];
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.
Store: PROCEDURE [server, file: Rope.ROPE, str: IO.STREAM, created: BasicTime.GMT, proc: ConfirmProc];
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.
For internal use.
FTPTimeToGMT: PROCEDURE [t: Rope.ROPE] RETURNS [BasicTime.GMT];
Converts an FTP format time string into a BasicTime.GMT.
LookupResult: TYPE = {noResponse, noSuchPort, noSuchServer, noSuchFile, ok};
Lookup: PROCEDURE [server, file: Rope.ROPE] RETURNS [result: LookupResult, version: FSBackdoor.Version, create: BasicTime.GMT, count: INT];
This procedure uses the LookupFile packet exchange protocol to obtain the version number, create time, and byte length of a file on a remote file server. The file name may be specified complete with version number, with "!h", with "!l", or with no version. The "file" must be specified with brackets syntax.
If the result is "ok" then the requested file exists with the returned version number, create time, and byte length. "noSuchName" means that either the "server" was nonsense or that the "file" does not exist on that server. "noSuchPort" means that the "server" responded with a no-such-port error packet when prodded on the LookupFile socket. "noResponse" means that either the NLS didn't respond to the server name lookup, the LookupFile packet didn't get to the server, or the server did not respond to it.
LookupFile caches the state of the server as derived from previous lookup attempts. If the cached state for a server is either "noResponse" or "noSuchPort" then LookupFile immediately returns that result without attempting any communication. Such negative cache entries are flushed after five minutes. Positive cache entries contain the Pup address of the server, eliminating the need to do a NLS lookup on the server name.
The longest that you should have to wait for a response is ~ 4*(2 + 0.5*MIN[8,hopCount]) seconds. This is the time it will take to decided that a server isn't going to respond in the case of an uncached down server. Most answers are determined much more quickly.
GetServerPupName: PROC [server: Rope.ROPE] RETURNS [pupServer: Rope.ROPE];
Convert the server name to a Pup Server name. For an IFS or other name know by the Pup gateways, this mapping is trivial. For Grapevine names (those with "." in them), the mapping is made through Grapevine.
END.
Bob Hagmann February 4, 1985 9:47:09 am PST
changes to: Copyright
Bob Hagmann April 29, 1985 10:19:13 am PDT
changes to: GetServerPupName