2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-08 20:02:21 +00:00
restic/src/restic/backend.go

41 lines
1.3 KiB
Go
Raw Normal View History

package restic
import "io"
// Backend is used to store and access data.
type Backend interface {
// Location returns a string that describes the type and location of the
// repository.
Location() string
2016-08-31 18:29:54 +00:00
// Test a boolean value whether a File with the name and type exists.
Test(h Handle) (bool, error)
2016-08-31 18:29:54 +00:00
// Remove removes a File with type t and name.
Remove(h Handle) error
// Close the backend
Close() error
// Save stores the data in the backend under the given handle.
Save(h Handle, rd io.Reader) error
2017-01-23 17:11:10 +00:00
// Load returns a reader that yields the contents of the file at h at the
2017-01-23 16:20:08 +00:00
// given offset. If length is larger than zero, only a portion of the file
// is returned. rd must be closed after use. If an error is returned, the
// ReadCloser must be nil.
2017-01-23 17:11:10 +00:00
Load(h Handle, length int, offset int64) (io.ReadCloser, error)
2017-01-22 21:01:12 +00:00
2016-08-31 18:29:54 +00:00
// Stat returns information about the File identified by h.
Stat(h Handle) (FileInfo, error)
2016-08-31 18:29:54 +00:00
// List returns a channel that yields all names of files of type t in an
// arbitrary order. A goroutine is started for this. If the channel done is
// closed, sending stops.
List(t FileType, done <-chan struct{}) <-chan string
}
2016-08-31 18:29:54 +00:00
// FileInfo is returned by Stat() and contains information about a file in the
// backend.
type FileInfo struct{ Size int64 }