From 9917fead0c27827eb2f78208dc494d1d708089ec Mon Sep 17 00:00:00 2001 From: John Eikenberry Date: Tue, 16 Jan 2018 14:42:06 -0800 Subject: [PATCH] handler type documenation improvements Fixes #221 --- request-interfaces.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/request-interfaces.go b/request-interfaces.go index 0f2b0aaf..44b8da10 100644 --- a/request-interfaces.go +++ b/request-interfaces.go @@ -8,22 +8,29 @@ import ( // Interfaces are differentiated based on required returned values. // All input arguments are to be pulled from Request (the only arg). -// FileReader should return an io.Reader for the filepath +// FileReader should return an io.ReaderAt for the filepath +// Note in cases of an error, the error text will be sent to the client. type FileReader interface { Fileread(*Request) (io.ReaderAt, error) } -// FileWriter should return an io.Writer for the filepath +// FileWriter should return an io.WriterAt for the filepath. +// +// The request server code will call Close() on the returned io.WriterAt +// ojbect if an io.Closer type assertion succeeds. +// Note in cases of an error, the error text will be sent to the client. type FileWriter interface { Filewrite(*Request) (io.WriterAt, error) } -// FileCmder should return an error (rename, remove, setstate, etc.) +// FileCmder should return an error +// Note in cases of an error, the error text will be sent to the client. type FileCmder interface { Filecmd(*Request) error } -// FileLister should return file info interface and errors (readdir, stat) +// FileLister should return an object that fulfils the ListerAt interface +// Note in cases of an error, the error text will be sent to the client. type FileLister interface { Filelist(*Request) (ListerAt, error) } @@ -33,6 +40,7 @@ type FileLister interface { // error if at end of list. This is testable by comparing how many you // copied to how many could be copied (eg. n < len(ls) below). // The copy() builtin is best for the copying. +// Note in cases of an error, the error text will be sent to the client. type ListerAt interface { ListAt([]os.FileInfo, int64) (int, error) }