2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-27 12:42:49 +00:00

Add streaming functions to mockBackend

This commit is contained in:
Alexander Neumann 2015-02-11 20:01:01 +01:00
parent 89bf88df7a
commit 6c68150e45

View File

@ -2,6 +2,7 @@ package backend_test
import (
"fmt"
"io"
"path/filepath"
"reflect"
"runtime"
@ -49,7 +50,9 @@ func str2id(s string) backend.ID {
type mockBackend struct {
list func(backend.Type) (backend.IDs, error)
get func(backend.Type, backend.ID) ([]byte, error)
getReader func(backend.Type, backend.ID) (io.ReadCloser, error)
create func(backend.Type, []byte) (backend.ID, error)
createFrom func(backend.Type, io.Reader) (backend.ID, error)
test func(backend.Type, backend.ID) (bool, error)
remove func(backend.Type, backend.ID) error
close func() error
@ -63,10 +66,18 @@ func (m mockBackend) Get(t backend.Type, id backend.ID) ([]byte, error) {
return m.get(t, id)
}
func (m mockBackend) GetReader(t backend.Type, id backend.ID) (io.ReadCloser, error) {
return m.getReader(t, id)
}
func (m mockBackend) Create(t backend.Type, data []byte) (backend.ID, error) {
return m.create(t, data)
}
func (m mockBackend) CreateFrom(t backend.Type, r io.Reader) (backend.ID, error) {
return m.createFrom(t, r)
}
func (m mockBackend) Test(t backend.Type, id backend.ID) (bool, error) {
return m.test(t, id)
}