Add LstatFileLister, an optional interface for FileLister, if this
interface is implemented Lstat requests will call it otherwirse they
will be handled in the same way as Stat, as before
we need to add a case for this packet inside the packet worker otherwise
it will be handled in hasHandle case and it will become a "Put" request.
Client side if a Truncate request is called on the open file we should
send a FSETSTAT packet, the request is on the handle, and not a SETSTAT
packet that should be used for paths and not for handle.
The fakeFileInfoSys and testOsSys funcs are only used in tests, so
rename the files they are defined in to request_*_test.go to exclude
them from non-test builds.
Also rename request-example.go to request_example_test.go to exclude it
as well, since it uses said funcs in example code.
windows filepath.Dir(), more specifically the clean function preforms
incorrectly in our situation. As the filesystem is constant we can do a
simplified dir() function to resolve the issue.
Add an optional interface that readerAt and writerAt can implement
to be notified about the error causing Serve() to exit with the
request still open.
Implement the TransferError interface in request-example.
This way we can run the request server example in debug mode, for example:
cd examples/request-server
go run -tags debug main.go
simulate a connection error killing an sftp client while uploading/downloading
and see the debug log that shows that the error is correctly notifyed
Fixes#306
Just like with files, the call to the hander to create the Lister is
done when the OPENDIR packet is received. This eliminates the need for
the lock in the filelist() method and opens the path for eliminating
more locks.
Testing feasibility of creating the reader/writer when first receiving
the Open packet instead of waiting for the Get/Put.
This work is meant to make the Request locks easier to manage and
ultimately reducing/eliminating them as much as possible.
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.