github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/common/follower/mocks/channel_puller.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-protos-go/common" 8 "github.com/hechain20/hechain/orderer/common/cluster" 9 "github.com/hechain20/hechain/orderer/common/follower" 10 ) 11 12 type ChannelPuller struct { 13 CloseStub func() 14 closeMutex sync.RWMutex 15 closeArgsForCall []struct { 16 } 17 HeightsByEndpointsStub func() (map[string]uint64, error) 18 heightsByEndpointsMutex sync.RWMutex 19 heightsByEndpointsArgsForCall []struct { 20 } 21 heightsByEndpointsReturns struct { 22 result1 map[string]uint64 23 result2 error 24 } 25 heightsByEndpointsReturnsOnCall map[int]struct { 26 result1 map[string]uint64 27 result2 error 28 } 29 PullBlockStub func(uint64) *common.Block 30 pullBlockMutex sync.RWMutex 31 pullBlockArgsForCall []struct { 32 arg1 uint64 33 } 34 pullBlockReturns struct { 35 result1 *common.Block 36 } 37 pullBlockReturnsOnCall map[int]struct { 38 result1 *common.Block 39 } 40 UpdateEndpointsStub func([]cluster.EndpointCriteria) 41 updateEndpointsMutex sync.RWMutex 42 updateEndpointsArgsForCall []struct { 43 arg1 []cluster.EndpointCriteria 44 } 45 invocations map[string][][]interface{} 46 invocationsMutex sync.RWMutex 47 } 48 49 func (fake *ChannelPuller) Close() { 50 fake.closeMutex.Lock() 51 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 52 }{}) 53 fake.recordInvocation("Close", []interface{}{}) 54 fake.closeMutex.Unlock() 55 if fake.CloseStub != nil { 56 fake.CloseStub() 57 } 58 } 59 60 func (fake *ChannelPuller) CloseCallCount() int { 61 fake.closeMutex.RLock() 62 defer fake.closeMutex.RUnlock() 63 return len(fake.closeArgsForCall) 64 } 65 66 func (fake *ChannelPuller) CloseCalls(stub func()) { 67 fake.closeMutex.Lock() 68 defer fake.closeMutex.Unlock() 69 fake.CloseStub = stub 70 } 71 72 func (fake *ChannelPuller) HeightsByEndpoints() (map[string]uint64, error) { 73 fake.heightsByEndpointsMutex.Lock() 74 ret, specificReturn := fake.heightsByEndpointsReturnsOnCall[len(fake.heightsByEndpointsArgsForCall)] 75 fake.heightsByEndpointsArgsForCall = append(fake.heightsByEndpointsArgsForCall, struct { 76 }{}) 77 fake.recordInvocation("HeightsByEndpoints", []interface{}{}) 78 fake.heightsByEndpointsMutex.Unlock() 79 if fake.HeightsByEndpointsStub != nil { 80 return fake.HeightsByEndpointsStub() 81 } 82 if specificReturn { 83 return ret.result1, ret.result2 84 } 85 fakeReturns := fake.heightsByEndpointsReturns 86 return fakeReturns.result1, fakeReturns.result2 87 } 88 89 func (fake *ChannelPuller) HeightsByEndpointsCallCount() int { 90 fake.heightsByEndpointsMutex.RLock() 91 defer fake.heightsByEndpointsMutex.RUnlock() 92 return len(fake.heightsByEndpointsArgsForCall) 93 } 94 95 func (fake *ChannelPuller) HeightsByEndpointsCalls(stub func() (map[string]uint64, error)) { 96 fake.heightsByEndpointsMutex.Lock() 97 defer fake.heightsByEndpointsMutex.Unlock() 98 fake.HeightsByEndpointsStub = stub 99 } 100 101 func (fake *ChannelPuller) HeightsByEndpointsReturns(result1 map[string]uint64, result2 error) { 102 fake.heightsByEndpointsMutex.Lock() 103 defer fake.heightsByEndpointsMutex.Unlock() 104 fake.HeightsByEndpointsStub = nil 105 fake.heightsByEndpointsReturns = struct { 106 result1 map[string]uint64 107 result2 error 108 }{result1, result2} 109 } 110 111 func (fake *ChannelPuller) HeightsByEndpointsReturnsOnCall(i int, result1 map[string]uint64, result2 error) { 112 fake.heightsByEndpointsMutex.Lock() 113 defer fake.heightsByEndpointsMutex.Unlock() 114 fake.HeightsByEndpointsStub = nil 115 if fake.heightsByEndpointsReturnsOnCall == nil { 116 fake.heightsByEndpointsReturnsOnCall = make(map[int]struct { 117 result1 map[string]uint64 118 result2 error 119 }) 120 } 121 fake.heightsByEndpointsReturnsOnCall[i] = struct { 122 result1 map[string]uint64 123 result2 error 124 }{result1, result2} 125 } 126 127 func (fake *ChannelPuller) PullBlock(arg1 uint64) *common.Block { 128 fake.pullBlockMutex.Lock() 129 ret, specificReturn := fake.pullBlockReturnsOnCall[len(fake.pullBlockArgsForCall)] 130 fake.pullBlockArgsForCall = append(fake.pullBlockArgsForCall, struct { 131 arg1 uint64 132 }{arg1}) 133 fake.recordInvocation("PullBlock", []interface{}{arg1}) 134 fake.pullBlockMutex.Unlock() 135 if fake.PullBlockStub != nil { 136 return fake.PullBlockStub(arg1) 137 } 138 if specificReturn { 139 return ret.result1 140 } 141 fakeReturns := fake.pullBlockReturns 142 return fakeReturns.result1 143 } 144 145 func (fake *ChannelPuller) PullBlockCallCount() int { 146 fake.pullBlockMutex.RLock() 147 defer fake.pullBlockMutex.RUnlock() 148 return len(fake.pullBlockArgsForCall) 149 } 150 151 func (fake *ChannelPuller) PullBlockCalls(stub func(uint64) *common.Block) { 152 fake.pullBlockMutex.Lock() 153 defer fake.pullBlockMutex.Unlock() 154 fake.PullBlockStub = stub 155 } 156 157 func (fake *ChannelPuller) PullBlockArgsForCall(i int) uint64 { 158 fake.pullBlockMutex.RLock() 159 defer fake.pullBlockMutex.RUnlock() 160 argsForCall := fake.pullBlockArgsForCall[i] 161 return argsForCall.arg1 162 } 163 164 func (fake *ChannelPuller) PullBlockReturns(result1 *common.Block) { 165 fake.pullBlockMutex.Lock() 166 defer fake.pullBlockMutex.Unlock() 167 fake.PullBlockStub = nil 168 fake.pullBlockReturns = struct { 169 result1 *common.Block 170 }{result1} 171 } 172 173 func (fake *ChannelPuller) PullBlockReturnsOnCall(i int, result1 *common.Block) { 174 fake.pullBlockMutex.Lock() 175 defer fake.pullBlockMutex.Unlock() 176 fake.PullBlockStub = nil 177 if fake.pullBlockReturnsOnCall == nil { 178 fake.pullBlockReturnsOnCall = make(map[int]struct { 179 result1 *common.Block 180 }) 181 } 182 fake.pullBlockReturnsOnCall[i] = struct { 183 result1 *common.Block 184 }{result1} 185 } 186 187 func (fake *ChannelPuller) UpdateEndpoints(arg1 []cluster.EndpointCriteria) { 188 var arg1Copy []cluster.EndpointCriteria 189 if arg1 != nil { 190 arg1Copy = make([]cluster.EndpointCriteria, len(arg1)) 191 copy(arg1Copy, arg1) 192 } 193 fake.updateEndpointsMutex.Lock() 194 fake.updateEndpointsArgsForCall = append(fake.updateEndpointsArgsForCall, struct { 195 arg1 []cluster.EndpointCriteria 196 }{arg1Copy}) 197 fake.recordInvocation("UpdateEndpoints", []interface{}{arg1Copy}) 198 fake.updateEndpointsMutex.Unlock() 199 if fake.UpdateEndpointsStub != nil { 200 fake.UpdateEndpointsStub(arg1) 201 } 202 } 203 204 func (fake *ChannelPuller) UpdateEndpointsCallCount() int { 205 fake.updateEndpointsMutex.RLock() 206 defer fake.updateEndpointsMutex.RUnlock() 207 return len(fake.updateEndpointsArgsForCall) 208 } 209 210 func (fake *ChannelPuller) UpdateEndpointsCalls(stub func([]cluster.EndpointCriteria)) { 211 fake.updateEndpointsMutex.Lock() 212 defer fake.updateEndpointsMutex.Unlock() 213 fake.UpdateEndpointsStub = stub 214 } 215 216 func (fake *ChannelPuller) UpdateEndpointsArgsForCall(i int) []cluster.EndpointCriteria { 217 fake.updateEndpointsMutex.RLock() 218 defer fake.updateEndpointsMutex.RUnlock() 219 argsForCall := fake.updateEndpointsArgsForCall[i] 220 return argsForCall.arg1 221 } 222 223 func (fake *ChannelPuller) Invocations() map[string][][]interface{} { 224 fake.invocationsMutex.RLock() 225 defer fake.invocationsMutex.RUnlock() 226 fake.closeMutex.RLock() 227 defer fake.closeMutex.RUnlock() 228 fake.heightsByEndpointsMutex.RLock() 229 defer fake.heightsByEndpointsMutex.RUnlock() 230 fake.pullBlockMutex.RLock() 231 defer fake.pullBlockMutex.RUnlock() 232 fake.updateEndpointsMutex.RLock() 233 defer fake.updateEndpointsMutex.RUnlock() 234 copiedInvocations := map[string][][]interface{}{} 235 for key, value := range fake.invocations { 236 copiedInvocations[key] = value 237 } 238 return copiedInvocations 239 } 240 241 func (fake *ChannelPuller) recordInvocation(key string, args []interface{}) { 242 fake.invocationsMutex.Lock() 243 defer fake.invocationsMutex.Unlock() 244 if fake.invocations == nil { 245 fake.invocations = map[string][][]interface{}{} 246 } 247 if fake.invocations[key] == nil { 248 fake.invocations[key] = [][]interface{}{} 249 } 250 fake.invocations[key] = append(fake.invocations[key], args) 251 } 252 253 var _ follower.ChannelPuller = new(ChannelPuller)