This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
consensus_migration_controller.go
302 lines (275 loc) · 10 KB
/
consensus_migration_controller.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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
// Code generated by counterfeiter. DO NOT EDIT.
package mocks
import (
sync "sync"
migration "github.com/hyperledger/fabric/orderer/consensus/migration"
)
type FakeController struct {
ConsensusMigrationAbortStub func() error
consensusMigrationAbortMutex sync.RWMutex
consensusMigrationAbortArgsForCall []struct {
}
consensusMigrationAbortReturns struct {
result1 error
}
consensusMigrationAbortReturnsOnCall map[int]struct {
result1 error
}
ConsensusMigrationCommitStub func() error
consensusMigrationCommitMutex sync.RWMutex
consensusMigrationCommitArgsForCall []struct {
}
consensusMigrationCommitReturns struct {
result1 error
}
consensusMigrationCommitReturnsOnCall map[int]struct {
result1 error
}
ConsensusMigrationPendingStub func() bool
consensusMigrationPendingMutex sync.RWMutex
consensusMigrationPendingArgsForCall []struct {
}
consensusMigrationPendingReturns struct {
result1 bool
}
consensusMigrationPendingReturnsOnCall map[int]struct {
result1 bool
}
ConsensusMigrationStartStub func(uint64) error
consensusMigrationStartMutex sync.RWMutex
consensusMigrationStartArgsForCall []struct {
arg1 uint64
}
consensusMigrationStartReturns struct {
result1 error
}
consensusMigrationStartReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeController) ConsensusMigrationAbort() error {
fake.consensusMigrationAbortMutex.Lock()
ret, specificReturn := fake.consensusMigrationAbortReturnsOnCall[len(fake.consensusMigrationAbortArgsForCall)]
fake.consensusMigrationAbortArgsForCall = append(fake.consensusMigrationAbortArgsForCall, struct {
}{})
fake.recordInvocation("ConsensusMigrationAbort", []interface{}{})
fake.consensusMigrationAbortMutex.Unlock()
if fake.ConsensusMigrationAbortStub != nil {
return fake.ConsensusMigrationAbortStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.consensusMigrationAbortReturns
return fakeReturns.result1
}
func (fake *FakeController) ConsensusMigrationAbortCallCount() int {
fake.consensusMigrationAbortMutex.RLock()
defer fake.consensusMigrationAbortMutex.RUnlock()
return len(fake.consensusMigrationAbortArgsForCall)
}
func (fake *FakeController) ConsensusMigrationAbortCalls(stub func() error) {
fake.consensusMigrationAbortMutex.Lock()
defer fake.consensusMigrationAbortMutex.Unlock()
fake.ConsensusMigrationAbortStub = stub
}
func (fake *FakeController) ConsensusMigrationAbortReturns(result1 error) {
fake.consensusMigrationAbortMutex.Lock()
defer fake.consensusMigrationAbortMutex.Unlock()
fake.ConsensusMigrationAbortStub = nil
fake.consensusMigrationAbortReturns = struct {
result1 error
}{result1}
}
func (fake *FakeController) ConsensusMigrationAbortReturnsOnCall(i int, result1 error) {
fake.consensusMigrationAbortMutex.Lock()
defer fake.consensusMigrationAbortMutex.Unlock()
fake.ConsensusMigrationAbortStub = nil
if fake.consensusMigrationAbortReturnsOnCall == nil {
fake.consensusMigrationAbortReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.consensusMigrationAbortReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeController) ConsensusMigrationCommit() error {
fake.consensusMigrationCommitMutex.Lock()
ret, specificReturn := fake.consensusMigrationCommitReturnsOnCall[len(fake.consensusMigrationCommitArgsForCall)]
fake.consensusMigrationCommitArgsForCall = append(fake.consensusMigrationCommitArgsForCall, struct {
}{})
fake.recordInvocation("ConsensusMigrationCommit", []interface{}{})
fake.consensusMigrationCommitMutex.Unlock()
if fake.ConsensusMigrationCommitStub != nil {
return fake.ConsensusMigrationCommitStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.consensusMigrationCommitReturns
return fakeReturns.result1
}
func (fake *FakeController) ConsensusMigrationCommitCallCount() int {
fake.consensusMigrationCommitMutex.RLock()
defer fake.consensusMigrationCommitMutex.RUnlock()
return len(fake.consensusMigrationCommitArgsForCall)
}
func (fake *FakeController) ConsensusMigrationCommitCalls(stub func() error) {
fake.consensusMigrationCommitMutex.Lock()
defer fake.consensusMigrationCommitMutex.Unlock()
fake.ConsensusMigrationCommitStub = stub
}
func (fake *FakeController) ConsensusMigrationCommitReturns(result1 error) {
fake.consensusMigrationCommitMutex.Lock()
defer fake.consensusMigrationCommitMutex.Unlock()
fake.ConsensusMigrationCommitStub = nil
fake.consensusMigrationCommitReturns = struct {
result1 error
}{result1}
}
func (fake *FakeController) ConsensusMigrationCommitReturnsOnCall(i int, result1 error) {
fake.consensusMigrationCommitMutex.Lock()
defer fake.consensusMigrationCommitMutex.Unlock()
fake.ConsensusMigrationCommitStub = nil
if fake.consensusMigrationCommitReturnsOnCall == nil {
fake.consensusMigrationCommitReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.consensusMigrationCommitReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeController) ConsensusMigrationPending() bool {
fake.consensusMigrationPendingMutex.Lock()
ret, specificReturn := fake.consensusMigrationPendingReturnsOnCall[len(fake.consensusMigrationPendingArgsForCall)]
fake.consensusMigrationPendingArgsForCall = append(fake.consensusMigrationPendingArgsForCall, struct {
}{})
fake.recordInvocation("ConsensusMigrationPending", []interface{}{})
fake.consensusMigrationPendingMutex.Unlock()
if fake.ConsensusMigrationPendingStub != nil {
return fake.ConsensusMigrationPendingStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.consensusMigrationPendingReturns
return fakeReturns.result1
}
func (fake *FakeController) ConsensusMigrationPendingCallCount() int {
fake.consensusMigrationPendingMutex.RLock()
defer fake.consensusMigrationPendingMutex.RUnlock()
return len(fake.consensusMigrationPendingArgsForCall)
}
func (fake *FakeController) ConsensusMigrationPendingCalls(stub func() bool) {
fake.consensusMigrationPendingMutex.Lock()
defer fake.consensusMigrationPendingMutex.Unlock()
fake.ConsensusMigrationPendingStub = stub
}
func (fake *FakeController) ConsensusMigrationPendingReturns(result1 bool) {
fake.consensusMigrationPendingMutex.Lock()
defer fake.consensusMigrationPendingMutex.Unlock()
fake.ConsensusMigrationPendingStub = nil
fake.consensusMigrationPendingReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeController) ConsensusMigrationPendingReturnsOnCall(i int, result1 bool) {
fake.consensusMigrationPendingMutex.Lock()
defer fake.consensusMigrationPendingMutex.Unlock()
fake.ConsensusMigrationPendingStub = nil
if fake.consensusMigrationPendingReturnsOnCall == nil {
fake.consensusMigrationPendingReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.consensusMigrationPendingReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeController) ConsensusMigrationStart(arg1 uint64) error {
fake.consensusMigrationStartMutex.Lock()
ret, specificReturn := fake.consensusMigrationStartReturnsOnCall[len(fake.consensusMigrationStartArgsForCall)]
fake.consensusMigrationStartArgsForCall = append(fake.consensusMigrationStartArgsForCall, struct {
arg1 uint64
}{arg1})
fake.recordInvocation("ConsensusMigrationStart", []interface{}{arg1})
fake.consensusMigrationStartMutex.Unlock()
if fake.ConsensusMigrationStartStub != nil {
return fake.ConsensusMigrationStartStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.consensusMigrationStartReturns
return fakeReturns.result1
}
func (fake *FakeController) ConsensusMigrationStartCallCount() int {
fake.consensusMigrationStartMutex.RLock()
defer fake.consensusMigrationStartMutex.RUnlock()
return len(fake.consensusMigrationStartArgsForCall)
}
func (fake *FakeController) ConsensusMigrationStartCalls(stub func(uint64) error) {
fake.consensusMigrationStartMutex.Lock()
defer fake.consensusMigrationStartMutex.Unlock()
fake.ConsensusMigrationStartStub = stub
}
func (fake *FakeController) ConsensusMigrationStartArgsForCall(i int) uint64 {
fake.consensusMigrationStartMutex.RLock()
defer fake.consensusMigrationStartMutex.RUnlock()
argsForCall := fake.consensusMigrationStartArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeController) ConsensusMigrationStartReturns(result1 error) {
fake.consensusMigrationStartMutex.Lock()
defer fake.consensusMigrationStartMutex.Unlock()
fake.ConsensusMigrationStartStub = nil
fake.consensusMigrationStartReturns = struct {
result1 error
}{result1}
}
func (fake *FakeController) ConsensusMigrationStartReturnsOnCall(i int, result1 error) {
fake.consensusMigrationStartMutex.Lock()
defer fake.consensusMigrationStartMutex.Unlock()
fake.ConsensusMigrationStartStub = nil
if fake.consensusMigrationStartReturnsOnCall == nil {
fake.consensusMigrationStartReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.consensusMigrationStartReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeController) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.consensusMigrationAbortMutex.RLock()
defer fake.consensusMigrationAbortMutex.RUnlock()
fake.consensusMigrationCommitMutex.RLock()
defer fake.consensusMigrationCommitMutex.RUnlock()
fake.consensusMigrationPendingMutex.RLock()
defer fake.consensusMigrationPendingMutex.RUnlock()
fake.consensusMigrationStartMutex.RLock()
defer fake.consensusMigrationStartMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeController) 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 _ migration.Controller = new(FakeController)