1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

repo/mock: basic impl

This commit is contained in:
Brian Tiger Chow
2015-01-14 18:55:58 -08:00
parent 03486a5109
commit c9a89458a5

37
repo/mock.go Normal file

@ -0,0 +1,37 @@
package repo
import (
"errors"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"github.com/jbenet/go-ipfs/repo/config"
)
var errTODO = errors.New("TODO")
// Mock is not thread-safe
type Mock struct {
C config.Config
D ds.ThreadSafeDatastore
}
func (m *Mock) Config() *config.Config {
return &m.C // FIXME threadsafety
}
func (m *Mock) SetConfig(updated *config.Config) error {
m.C = *updated // FIXME threadsafety
return nil
}
func (m *Mock) SetConfigKey(key string, value interface{}) error {
return errTODO
}
func (m *Mock) GetConfigKey(key string) (interface{}, error) {
return nil, errTODO
}
func (m *Mock) Datastore() ds.ThreadSafeDatastore { return m.D }
func (m *Mock) Close() error { return errTODO }