Add Load() for all existing backends

This commit is contained in:
Alexander Neumann committed 2016-01-23 14:12:12 +01:00
1 parent 8b7bf8691d
commit 0a24261afb
5 files changed
+84

No files matched your search

+9
View File
@@ -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")