Updates #192
Move handle() onto *Request, this has flow on effects to the interface
types declared in request-interface.go, the examples and the tests.
The decision to address #192 started with advice from gopl.io, but I
think has uncovered several bugs as many of the request methods operate
on copies of data stored in the RequestServer's cache. I think this is
unintentional, but may point to some correctness issues, see #193.
I didn't like how the initial fix for #184 required the handler author
to track the token/offset for the filelist. I came up with a way to do
it that mimic'd the FileReader handler interface using a method
something like ReaderAt except for file lists.
changed MaxFileinfoList to a var for testing and tweaking
Renaming FileInfoer interface to FileLister.
FileInfoer -> FileLister
Fileinfo -> Filelist
The request server needs to support batching of file list requests. To
address this the methods LsSave(string) and LsNext()string are added to
the Request object. They should work to store a token to keep your place.
The Handler should now return an EOF when the end of the directory list is
reached. If it doesn't but returns an empty list, the wrapper will send the EOF
for you.
The old behaviour of just returning 1 batch and sending the EOF is preserved if
you don't set the token (you don't use LsSave). It will return the 1 list and
EOF on the next underlying readdir call. This is to preserve backwards
compatibility and it not the recommended way to handle file lists.
fstat and fsetstat are not converted to versions that work on path
instead of working with open filehandle. So I removed them from the
request.update method which updates the request object for methods that
are working on an opened file.
Had file attributes, but not the flags which are required for the
attributes to be meaningful. The stats stuff in the request-server is
very simplistic, but I want it to be able to be used even if a PITA.
Added a test that breaks w/ old code which has typos but is fixed with
typos fixed. Also added switch-default error message that would have
helped diagnose this (should have been there already).
Encapsulate stateful data into sub-structures with pointer references
from the Request structure. This allows me to pass by value in most
cases to keep non-stateful (write once) data data race free and tightly
controlling access to stateful data to ease locking.
working to decouple request handling from packet handling. adding a
response channel means I don't need to handle sending packets.
eliminated need for cur_pkt and sendError() on request objects so far.