-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.go
37 lines (27 loc) · 765 Bytes
/
mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 }