Skip to content

Commit

Permalink
handler type documenation improvements
Browse files Browse the repository at this point in the history
Fixes pkg#221
  • Loading branch information
eikenb committed Jan 16, 2018
1 parent 02e3513 commit 9917fea
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions request-interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}

0 comments on commit 9917fea

Please sign in to comment.