Appendix III: Status Codes Returned by copyToScratch()¶
art::FileTranferStatus codes mostly come from the status code returned
by a request, on the web, to obtain a file based on some URI. Thus the codes
defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html, which is
http Status Code Definitions, are all possible. The important ones, which
will appear in the enum, are:
201 - CREATED - The scratch copy has been created; fileFQname is valid. - This is the only "SUCCESS" status. 200 - OK - Something went wrong; the server thinks the request has - succeeded, but no file was created. 400 - BADREQUEST - Malformed syntax was created and used. * 401 - UNAUTHORIZED - Obtaining the file would require user authorization. * 402 - PAYMENTREQUIRED - * 403 - FORBIDDEN - Server is refusing the request. * 404 - NOTFOUND - File was not found by server. * 410 - GONE - The requested resoure is no longer available. * 413 - TOOLARGE - URI points to a file that is too large to transer. * 414 - URITOOLONG - The URI itself is too long. * 500 - SERVERERROR - The server encountered an unexpected condition. 503 - UNAVAILABLE - The server is (perhaps temporarily) unavailable.
Status codes between 100 and 199, which by the http protocol indicate
that a request has been received and is being processed, ought not to
be passed back by the copyToScratch() method, since there would be nothing
for the caller to do but repeat the call. Similarly for all 200 - 299
responses, other than 201 "CREATED", and all 300 (redirection) responses.
Status codes betwen 400 and 499 indicate serious problems, and for practical
purposes ought to be treated as fatal (although one could imagine trying to
go on to the next file instead.
Status codes between 500 and 599 are in principe re-tryable, but the re-tries
should be kept on a short leash.
In addition to the above codes returned by the web server, it is plausible that
something could go wrong with the attempt to create the scratch file copy.
In that case, the FIleTransfer service should return the errno code, which
according to the errno.h I have seen is never above 199 -- thus it can't interfere
with any http status code we are willing to return. In any event, FileTransfer
should not return 201 ("CREATED") unless the file has successfully been copied to
the scratch area.