forked from ChainSafe/gossamer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage_api.go
188 lines (153 loc) · 4.44 KB
/
storage_api.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.
package mocks
import (
common "github.com/ChainSafe/gossamer/lib/common"
mock "github.com/stretchr/testify/mock"
state "github.com/ChainSafe/gossamer/dot/state"
trie "github.com/ChainSafe/gossamer/lib/trie"
)
// MockStorageAPI is an autogenerated mock type for the StorageAPI type
type MockStorageAPI struct {
mock.Mock
}
// Entries provides a mock function with given fields: root
func (_m *MockStorageAPI) Entries(root *common.Hash) (map[string][]byte, error) {
ret := _m.Called(root)
var r0 map[string][]byte
if rf, ok := ret.Get(0).(func(*common.Hash) map[string][]byte); ok {
r0 = rf(root)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*common.Hash) error); ok {
r1 = rf(root)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetKeysWithPrefix provides a mock function with given fields: root, prefix
func (_m *MockStorageAPI) GetKeysWithPrefix(root *common.Hash, prefix []byte) ([][]byte, error) {
ret := _m.Called(root, prefix)
var r0 [][]byte
if rf, ok := ret.Get(0).(func(*common.Hash, []byte) [][]byte); ok {
r0 = rf(root, prefix)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([][]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*common.Hash, []byte) error); ok {
r1 = rf(root, prefix)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStateRootFromBlock provides a mock function with given fields: bhash
func (_m *MockStorageAPI) GetStateRootFromBlock(bhash *common.Hash) (*common.Hash, error) {
ret := _m.Called(bhash)
var r0 *common.Hash
if rf, ok := ret.Get(0).(func(*common.Hash) *common.Hash); ok {
r0 = rf(bhash)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*common.Hash)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*common.Hash) error); ok {
r1 = rf(bhash)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStorage provides a mock function with given fields: root, key
func (_m *MockStorageAPI) GetStorage(root *common.Hash, key []byte) ([]byte, error) {
ret := _m.Called(root, key)
var r0 []byte
if rf, ok := ret.Get(0).(func(*common.Hash, []byte) []byte); ok {
r0 = rf(root, key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*common.Hash, []byte) error); ok {
r1 = rf(root, key)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStorageByBlockHash provides a mock function with given fields: bhash, key
func (_m *MockStorageAPI) GetStorageByBlockHash(bhash common.Hash, key []byte) ([]byte, error) {
ret := _m.Called(bhash, key)
var r0 []byte
if rf, ok := ret.Get(0).(func(common.Hash, []byte) []byte); ok {
r0 = rf(bhash, key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Hash, []byte) error); ok {
r1 = rf(bhash, key)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStorageChild provides a mock function with given fields: root, keyToChild
func (_m *MockStorageAPI) GetStorageChild(root *common.Hash, keyToChild []byte) (*trie.Trie, error) {
ret := _m.Called(root, keyToChild)
var r0 *trie.Trie
if rf, ok := ret.Get(0).(func(*common.Hash, []byte) *trie.Trie); ok {
r0 = rf(root, keyToChild)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*trie.Trie)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*common.Hash, []byte) error); ok {
r1 = rf(root, keyToChild)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStorageFromChild provides a mock function with given fields: root, keyToChild, key
func (_m *MockStorageAPI) GetStorageFromChild(root *common.Hash, keyToChild []byte, key []byte) ([]byte, error) {
ret := _m.Called(root, keyToChild, key)
var r0 []byte
if rf, ok := ret.Get(0).(func(*common.Hash, []byte, []byte) []byte); ok {
r0 = rf(root, keyToChild, key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*common.Hash, []byte, []byte) error); ok {
r1 = rf(root, keyToChild, key)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegisterStorageObserver provides a mock function with given fields: observer
func (_m *MockStorageAPI) RegisterStorageObserver(observer state.Observer) {
_m.Called(observer)
}
// UnregisterStorageObserver provides a mock function with given fields: observer
func (_m *MockStorageAPI) UnregisterStorageObserver(observer state.Observer) {
_m.Called(observer)
}