2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-15 01:34:06 +00:00
restic/vendor/github.com/pkg/sftp/request-interfaces.go

39 lines
1.1 KiB
Go
Raw Normal View History

2017-07-23 12:24:45 +00:00
package sftp
import (
"io"
"os"
)
// 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
type FileReader interface {
2017-09-13 12:09:48 +00:00
Fileread(*Request) (io.ReaderAt, error)
2017-07-23 12:24:45 +00:00
}
// FileWriter should return an io.Writer for the filepath
type FileWriter interface {
2017-09-13 12:09:48 +00:00
Filewrite(*Request) (io.WriterAt, error)
2017-07-23 12:24:45 +00:00
}
// FileCmder should return an error (rename, remove, setstate, etc.)
type FileCmder interface {
2017-09-13 12:09:48 +00:00
Filecmd(*Request) error
2017-07-23 12:24:45 +00:00
}
2017-09-13 12:09:48 +00:00
// FileLister should return file info interface and errors (readdir, stat)
type FileLister interface {
Filelist(*Request) (ListerAt, error)
}
// ListerAt does for file lists what io.ReaderAt does for files.
// ListAt should return the number of entries copied and an io.EOF
// 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.
type ListerAt interface {
ListAt([]os.FileInfo, int64) (int, error)
2017-07-23 12:24:45 +00:00
}