mirror of
https://github.com/restic/restic.git
synced 2026-11-27 15:23:48 +00:00
Add Load() for all existing backends
This commit is contained in:
1 parent
8b7bf8691d
commit
0a24261afb
5 files changed
+84
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
type MockBackend struct {
|
||||
CloseFn func() error
|
||||
CreateFn func() (Blob, error)
|
||||
LoadFn func(h Handle, p []byte, off int64) (int, error)
|
||||
GetReaderFn func(Type, string, uint, uint) (io.ReadCloser, error)
|
||||
ListFn func(Type, <-chan struct{}) <-chan string
|
||||
RemoveFn func(Type, string) error
|
||||
@@ -42,6 +43,14 @@ func (m *MockBackend) Create() (Blob, error) {
|
||||
return m.CreateFn()
|
||||
}
|
||||
|
||||
func (m *MockBackend) Load(h Handle, p []byte, off int64) (int, error) {
|
||||
if m.LoadFn == nil {
|
||||
return 0, errors.New("not implemented")
|
||||
}
|
||||
|
||||
return m.Load(h, p, off)
|
||||
}
|
||||
|
||||
func (m *MockBackend) GetReader(t Type, name string, offset, len uint) (io.ReadCloser, error) {
|
||||
if m.GetReaderFn == nil {
|
||||
return nil, errors.New("not implemented")
|
||||
|
||||
Reference in new issue
Block a user