sftp/request-interfaces.go

31 lines
707 B
Go
Raw Normal View History

package sftp
import (
"io"
"os"
)
2016-07-09 03:38:35 +08:00
// Interfaces are differentiated based on required returned values.
// All input arguments are to be pulled from Request (the only arg).
// should return an io.Reader for the filepath
type FileReader interface {
2016-07-12 02:16:08 +08:00
Fileread(*Request) (io.Reader, error)
}
// should return an io.Writer for the filepath
type FileWriter interface {
2016-07-12 02:16:08 +08:00
Filewrite(*Request) (io.Writer, error)
}
// should return an error (rename, remove, setstate, etc.)
type FileCmder interface {
2016-07-09 08:22:52 +08:00
Filecmd(*Request) error
}
// should return file listing info and errors (readdir, stat)
// note stat requests would return a list of 1
type FileInfoer interface {
2016-07-09 08:22:52 +08:00
Fileinfo(*Request) ([]os.FileInfo, error)
}