-
Notifications
You must be signed in to change notification settings - Fork 199
/
storerStub.go
69 lines (57 loc) · 1.57 KB
/
storerStub.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
package mock
// StorerStub -
type StorerStub struct {
PutCalled func(key, data []byte) error
GetCalled func(key []byte) ([]byte, error)
GetFromEpochCalled func(key []byte, epoch uint32) ([]byte, error)
HasCalled func(key []byte) error
HasInEpochCalled func(key []byte, epoch uint32) error
SearchFirstCalled func(key []byte) ([]byte, error)
RemoveCalled func(key []byte) error
ClearCacheCalled func()
DestroyUnitCalled func() error
}
// GetFromEpoch -
func (ss *StorerStub) GetFromEpoch(key []byte, epoch uint32) ([]byte, error) {
return ss.GetFromEpochCalled(key, epoch)
}
// HasInEpoch -
func (ss *StorerStub) HasInEpoch(key []byte, epoch uint32) error {
return ss.HasInEpochCalled(key, epoch)
}
// SearchFirst -
func (ss *StorerStub) SearchFirst(key []byte) ([]byte, error) {
return ss.SearchFirstCalled(key)
}
// Close -
func (ss *StorerStub) Close() error {
return nil
}
// Put -
func (ss *StorerStub) Put(key, data []byte) error {
return ss.PutCalled(key, data)
}
// Get -
func (ss *StorerStub) Get(key []byte) ([]byte, error) {
return ss.GetCalled(key)
}
// Has -
func (ss *StorerStub) Has(key []byte) error {
return ss.HasCalled(key)
}
// Remove -
func (ss *StorerStub) Remove(key []byte) error {
return ss.RemoveCalled(key)
}
// ClearCache -
func (ss *StorerStub) ClearCache() {
ss.ClearCacheCalled()
}
// DestroyUnit -
func (ss *StorerStub) DestroyUnit() error {
return ss.DestroyUnitCalled()
}
// IsInterfaceNil returns true if there is no value under the interface
func (ss *StorerStub) IsInterfaceNil() bool {
return ss == nil
}