-
Notifications
You must be signed in to change notification settings - Fork 5
/
testing.go
84 lines (67 loc) · 2.04 KB
/
testing.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package store
import "context"
type TestPurgeableKVDBDriver struct {
KVStore
DSN string
}
func (t *TestPurgeableKVDBDriver) MarkCurrentHeight(height uint64) {
panic("test purgeable driver, not callable")
}
func (t *TestPurgeableKVDBDriver) PurgeKeys(ctx context.Context) error {
panic("test purgeable driver, not callable")
}
func NewTestPurgeableKVDBDriver(dsn string) *TestPurgeableKVDBDriver {
return &TestPurgeableKVDBDriver{
KVStore: NewTestKVDBDriver(dsn),
DSN: dsn,
}
}
type TestKVDBDriver struct {
DSN string
}
func NewTestKVDBDriver(dsn string) *TestKVDBDriver {
return &TestKVDBDriver{
DSN: dsn,
}
}
func RegisterTestKVDBDriver() {
if !isRegistered("test") {
Register(&Registration{
Name: "test",
Title: "Test KVDB Driver",
FactoryFunc: NewTestKVDBDriverFactory,
})
}
}
func NewTestKVDBDriverFactory(dsn string) (KVStore, error) {
return &TestKVDBDriver{
DSN: dsn,
}, nil
}
func (t *TestKVDBDriver) Put(ctx context.Context, key, value []byte) (err error) {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) FlushPuts(ctx context.Context) (err error) {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) Get(ctx context.Context, key []byte) (value []byte, err error) {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) BatchGet(ctx context.Context, keys [][]byte) *Iterator {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) Scan(ctx context.Context, start, exclusiveEnd []byte, limit int, options ...ReadOption) *Iterator {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) Prefix(ctx context.Context, prefix []byte, limit int, options ...ReadOption) *Iterator {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) BatchPrefix(ctx context.Context, prefixes [][]byte, limit int, options ...ReadOption) *Iterator {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) BatchDelete(ctx context.Context, keys [][]byte) (err error) {
panic("test driver, not callable")
}
func (t *TestKVDBDriver) Close() error {
return nil
}