-
Notifications
You must be signed in to change notification settings - Fork 0
/
ledger_reader.go
229 lines (208 loc) · 6.87 KB
/
ledger_reader.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
"sync"
ledgera "github.com/hyperledger/fabric/common/ledger"
"github.com/hyperledger/fabric/token/ledger"
)
type LedgerReader struct {
DoneStub func()
doneMutex sync.RWMutex
doneArgsForCall []struct {
}
GetStateStub func(string, string) ([]byte, error)
getStateMutex sync.RWMutex
getStateArgsForCall []struct {
arg1 string
arg2 string
}
getStateReturns struct {
result1 []byte
result2 error
}
getStateReturnsOnCall map[int]struct {
result1 []byte
result2 error
}
GetStateRangeScanIteratorStub func(string, string, string) (ledgera.ResultsIterator, error)
getStateRangeScanIteratorMutex sync.RWMutex
getStateRangeScanIteratorArgsForCall []struct {
arg1 string
arg2 string
arg3 string
}
getStateRangeScanIteratorReturns struct {
result1 ledgera.ResultsIterator
result2 error
}
getStateRangeScanIteratorReturnsOnCall map[int]struct {
result1 ledgera.ResultsIterator
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *LedgerReader) Done() {
fake.doneMutex.Lock()
fake.doneArgsForCall = append(fake.doneArgsForCall, struct {
}{})
fake.recordInvocation("Done", []interface{}{})
fake.doneMutex.Unlock()
if fake.DoneStub != nil {
fake.DoneStub()
}
}
func (fake *LedgerReader) DoneCallCount() int {
fake.doneMutex.RLock()
defer fake.doneMutex.RUnlock()
return len(fake.doneArgsForCall)
}
func (fake *LedgerReader) DoneCalls(stub func()) {
fake.doneMutex.Lock()
defer fake.doneMutex.Unlock()
fake.DoneStub = stub
}
func (fake *LedgerReader) GetState(arg1 string, arg2 string) ([]byte, error) {
fake.getStateMutex.Lock()
ret, specificReturn := fake.getStateReturnsOnCall[len(fake.getStateArgsForCall)]
fake.getStateArgsForCall = append(fake.getStateArgsForCall, struct {
arg1 string
arg2 string
}{arg1, arg2})
fake.recordInvocation("GetState", []interface{}{arg1, arg2})
fake.getStateMutex.Unlock()
if fake.GetStateStub != nil {
return fake.GetStateStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getStateReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *LedgerReader) GetStateCallCount() int {
fake.getStateMutex.RLock()
defer fake.getStateMutex.RUnlock()
return len(fake.getStateArgsForCall)
}
func (fake *LedgerReader) GetStateCalls(stub func(string, string) ([]byte, error)) {
fake.getStateMutex.Lock()
defer fake.getStateMutex.Unlock()
fake.GetStateStub = stub
}
func (fake *LedgerReader) GetStateArgsForCall(i int) (string, string) {
fake.getStateMutex.RLock()
defer fake.getStateMutex.RUnlock()
argsForCall := fake.getStateArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *LedgerReader) GetStateReturns(result1 []byte, result2 error) {
fake.getStateMutex.Lock()
defer fake.getStateMutex.Unlock()
fake.GetStateStub = nil
fake.getStateReturns = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *LedgerReader) GetStateReturnsOnCall(i int, result1 []byte, result2 error) {
fake.getStateMutex.Lock()
defer fake.getStateMutex.Unlock()
fake.GetStateStub = nil
if fake.getStateReturnsOnCall == nil {
fake.getStateReturnsOnCall = make(map[int]struct {
result1 []byte
result2 error
})
}
fake.getStateReturnsOnCall[i] = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *LedgerReader) GetStateRangeScanIterator(arg1 string, arg2 string, arg3 string) (ledgera.ResultsIterator, error) {
fake.getStateRangeScanIteratorMutex.Lock()
ret, specificReturn := fake.getStateRangeScanIteratorReturnsOnCall[len(fake.getStateRangeScanIteratorArgsForCall)]
fake.getStateRangeScanIteratorArgsForCall = append(fake.getStateRangeScanIteratorArgsForCall, struct {
arg1 string
arg2 string
arg3 string
}{arg1, arg2, arg3})
fake.recordInvocation("GetStateRangeScanIterator", []interface{}{arg1, arg2, arg3})
fake.getStateRangeScanIteratorMutex.Unlock()
if fake.GetStateRangeScanIteratorStub != nil {
return fake.GetStateRangeScanIteratorStub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getStateRangeScanIteratorReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *LedgerReader) GetStateRangeScanIteratorCallCount() int {
fake.getStateRangeScanIteratorMutex.RLock()
defer fake.getStateRangeScanIteratorMutex.RUnlock()
return len(fake.getStateRangeScanIteratorArgsForCall)
}
func (fake *LedgerReader) GetStateRangeScanIteratorCalls(stub func(string, string, string) (ledgera.ResultsIterator, error)) {
fake.getStateRangeScanIteratorMutex.Lock()
defer fake.getStateRangeScanIteratorMutex.Unlock()
fake.GetStateRangeScanIteratorStub = stub
}
func (fake *LedgerReader) GetStateRangeScanIteratorArgsForCall(i int) (string, string, string) {
fake.getStateRangeScanIteratorMutex.RLock()
defer fake.getStateRangeScanIteratorMutex.RUnlock()
argsForCall := fake.getStateRangeScanIteratorArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *LedgerReader) GetStateRangeScanIteratorReturns(result1 ledgera.ResultsIterator, result2 error) {
fake.getStateRangeScanIteratorMutex.Lock()
defer fake.getStateRangeScanIteratorMutex.Unlock()
fake.GetStateRangeScanIteratorStub = nil
fake.getStateRangeScanIteratorReturns = struct {
result1 ledgera.ResultsIterator
result2 error
}{result1, result2}
}
func (fake *LedgerReader) GetStateRangeScanIteratorReturnsOnCall(i int, result1 ledgera.ResultsIterator, result2 error) {
fake.getStateRangeScanIteratorMutex.Lock()
defer fake.getStateRangeScanIteratorMutex.Unlock()
fake.GetStateRangeScanIteratorStub = nil
if fake.getStateRangeScanIteratorReturnsOnCall == nil {
fake.getStateRangeScanIteratorReturnsOnCall = make(map[int]struct {
result1 ledgera.ResultsIterator
result2 error
})
}
fake.getStateRangeScanIteratorReturnsOnCall[i] = struct {
result1 ledgera.ResultsIterator
result2 error
}{result1, result2}
}
func (fake *LedgerReader) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.doneMutex.RLock()
defer fake.doneMutex.RUnlock()
fake.getStateMutex.RLock()
defer fake.getStateMutex.RUnlock()
fake.getStateRangeScanIteratorMutex.RLock()
defer fake.getStateRangeScanIteratorMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *LedgerReader) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ ledger.LedgerReader = new(LedgerReader)