github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/common/follower/mocks/ledger_resources.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/follower" 9 ) 10 11 type LedgerResources struct { 12 AppendStub func(*common.Block) error 13 appendMutex sync.RWMutex 14 appendArgsForCall []struct { 15 arg1 *common.Block 16 } 17 appendReturns struct { 18 result1 error 19 } 20 appendReturnsOnCall map[int]struct { 21 result1 error 22 } 23 BlockStub func(uint64) *common.Block 24 blockMutex sync.RWMutex 25 blockArgsForCall []struct { 26 arg1 uint64 27 } 28 blockReturns struct { 29 result1 *common.Block 30 } 31 blockReturnsOnCall map[int]struct { 32 result1 *common.Block 33 } 34 ChannelIDStub func() string 35 channelIDMutex sync.RWMutex 36 channelIDArgsForCall []struct { 37 } 38 channelIDReturns struct { 39 result1 string 40 } 41 channelIDReturnsOnCall map[int]struct { 42 result1 string 43 } 44 HeightStub func() uint64 45 heightMutex sync.RWMutex 46 heightArgsForCall []struct { 47 } 48 heightReturns struct { 49 result1 uint64 50 } 51 heightReturnsOnCall map[int]struct { 52 result1 uint64 53 } 54 invocations map[string][][]interface{} 55 invocationsMutex sync.RWMutex 56 } 57 58 func (fake *LedgerResources) Append(arg1 *common.Block) error { 59 fake.appendMutex.Lock() 60 ret, specificReturn := fake.appendReturnsOnCall[len(fake.appendArgsForCall)] 61 fake.appendArgsForCall = append(fake.appendArgsForCall, struct { 62 arg1 *common.Block 63 }{arg1}) 64 fake.recordInvocation("Append", []interface{}{arg1}) 65 fake.appendMutex.Unlock() 66 if fake.AppendStub != nil { 67 return fake.AppendStub(arg1) 68 } 69 if specificReturn { 70 return ret.result1 71 } 72 fakeReturns := fake.appendReturns 73 return fakeReturns.result1 74 } 75 76 func (fake *LedgerResources) AppendCallCount() int { 77 fake.appendMutex.RLock() 78 defer fake.appendMutex.RUnlock() 79 return len(fake.appendArgsForCall) 80 } 81 82 func (fake *LedgerResources) AppendCalls(stub func(*common.Block) error) { 83 fake.appendMutex.Lock() 84 defer fake.appendMutex.Unlock() 85 fake.AppendStub = stub 86 } 87 88 func (fake *LedgerResources) AppendArgsForCall(i int) *common.Block { 89 fake.appendMutex.RLock() 90 defer fake.appendMutex.RUnlock() 91 argsForCall := fake.appendArgsForCall[i] 92 return argsForCall.arg1 93 } 94 95 func (fake *LedgerResources) AppendReturns(result1 error) { 96 fake.appendMutex.Lock() 97 defer fake.appendMutex.Unlock() 98 fake.AppendStub = nil 99 fake.appendReturns = struct { 100 result1 error 101 }{result1} 102 } 103 104 func (fake *LedgerResources) AppendReturnsOnCall(i int, result1 error) { 105 fake.appendMutex.Lock() 106 defer fake.appendMutex.Unlock() 107 fake.AppendStub = nil 108 if fake.appendReturnsOnCall == nil { 109 fake.appendReturnsOnCall = make(map[int]struct { 110 result1 error 111 }) 112 } 113 fake.appendReturnsOnCall[i] = struct { 114 result1 error 115 }{result1} 116 } 117 118 func (fake *LedgerResources) Block(arg1 uint64) *common.Block { 119 fake.blockMutex.Lock() 120 ret, specificReturn := fake.blockReturnsOnCall[len(fake.blockArgsForCall)] 121 fake.blockArgsForCall = append(fake.blockArgsForCall, struct { 122 arg1 uint64 123 }{arg1}) 124 fake.recordInvocation("Block", []interface{}{arg1}) 125 fake.blockMutex.Unlock() 126 if fake.BlockStub != nil { 127 return fake.BlockStub(arg1) 128 } 129 if specificReturn { 130 return ret.result1 131 } 132 fakeReturns := fake.blockReturns 133 return fakeReturns.result1 134 } 135 136 func (fake *LedgerResources) BlockCallCount() int { 137 fake.blockMutex.RLock() 138 defer fake.blockMutex.RUnlock() 139 return len(fake.blockArgsForCall) 140 } 141 142 func (fake *LedgerResources) BlockCalls(stub func(uint64) *common.Block) { 143 fake.blockMutex.Lock() 144 defer fake.blockMutex.Unlock() 145 fake.BlockStub = stub 146 } 147 148 func (fake *LedgerResources) BlockArgsForCall(i int) uint64 { 149 fake.blockMutex.RLock() 150 defer fake.blockMutex.RUnlock() 151 argsForCall := fake.blockArgsForCall[i] 152 return argsForCall.arg1 153 } 154 155 func (fake *LedgerResources) BlockReturns(result1 *common.Block) { 156 fake.blockMutex.Lock() 157 defer fake.blockMutex.Unlock() 158 fake.BlockStub = nil 159 fake.blockReturns = struct { 160 result1 *common.Block 161 }{result1} 162 } 163 164 func (fake *LedgerResources) BlockReturnsOnCall(i int, result1 *common.Block) { 165 fake.blockMutex.Lock() 166 defer fake.blockMutex.Unlock() 167 fake.BlockStub = nil 168 if fake.blockReturnsOnCall == nil { 169 fake.blockReturnsOnCall = make(map[int]struct { 170 result1 *common.Block 171 }) 172 } 173 fake.blockReturnsOnCall[i] = struct { 174 result1 *common.Block 175 }{result1} 176 } 177 178 func (fake *LedgerResources) ChannelID() string { 179 fake.channelIDMutex.Lock() 180 ret, specificReturn := fake.channelIDReturnsOnCall[len(fake.channelIDArgsForCall)] 181 fake.channelIDArgsForCall = append(fake.channelIDArgsForCall, struct { 182 }{}) 183 fake.recordInvocation("ChannelID", []interface{}{}) 184 fake.channelIDMutex.Unlock() 185 if fake.ChannelIDStub != nil { 186 return fake.ChannelIDStub() 187 } 188 if specificReturn { 189 return ret.result1 190 } 191 fakeReturns := fake.channelIDReturns 192 return fakeReturns.result1 193 } 194 195 func (fake *LedgerResources) ChannelIDCallCount() int { 196 fake.channelIDMutex.RLock() 197 defer fake.channelIDMutex.RUnlock() 198 return len(fake.channelIDArgsForCall) 199 } 200 201 func (fake *LedgerResources) ChannelIDCalls(stub func() string) { 202 fake.channelIDMutex.Lock() 203 defer fake.channelIDMutex.Unlock() 204 fake.ChannelIDStub = stub 205 } 206 207 func (fake *LedgerResources) ChannelIDReturns(result1 string) { 208 fake.channelIDMutex.Lock() 209 defer fake.channelIDMutex.Unlock() 210 fake.ChannelIDStub = nil 211 fake.channelIDReturns = struct { 212 result1 string 213 }{result1} 214 } 215 216 func (fake *LedgerResources) ChannelIDReturnsOnCall(i int, result1 string) { 217 fake.channelIDMutex.Lock() 218 defer fake.channelIDMutex.Unlock() 219 fake.ChannelIDStub = nil 220 if fake.channelIDReturnsOnCall == nil { 221 fake.channelIDReturnsOnCall = make(map[int]struct { 222 result1 string 223 }) 224 } 225 fake.channelIDReturnsOnCall[i] = struct { 226 result1 string 227 }{result1} 228 } 229 230 func (fake *LedgerResources) Height() uint64 { 231 fake.heightMutex.Lock() 232 ret, specificReturn := fake.heightReturnsOnCall[len(fake.heightArgsForCall)] 233 fake.heightArgsForCall = append(fake.heightArgsForCall, struct { 234 }{}) 235 fake.recordInvocation("Height", []interface{}{}) 236 fake.heightMutex.Unlock() 237 if fake.HeightStub != nil { 238 return fake.HeightStub() 239 } 240 if specificReturn { 241 return ret.result1 242 } 243 fakeReturns := fake.heightReturns 244 return fakeReturns.result1 245 } 246 247 func (fake *LedgerResources) HeightCallCount() int { 248 fake.heightMutex.RLock() 249 defer fake.heightMutex.RUnlock() 250 return len(fake.heightArgsForCall) 251 } 252 253 func (fake *LedgerResources) HeightCalls(stub func() uint64) { 254 fake.heightMutex.Lock() 255 defer fake.heightMutex.Unlock() 256 fake.HeightStub = stub 257 } 258 259 func (fake *LedgerResources) HeightReturns(result1 uint64) { 260 fake.heightMutex.Lock() 261 defer fake.heightMutex.Unlock() 262 fake.HeightStub = nil 263 fake.heightReturns = struct { 264 result1 uint64 265 }{result1} 266 } 267 268 func (fake *LedgerResources) HeightReturnsOnCall(i int, result1 uint64) { 269 fake.heightMutex.Lock() 270 defer fake.heightMutex.Unlock() 271 fake.HeightStub = nil 272 if fake.heightReturnsOnCall == nil { 273 fake.heightReturnsOnCall = make(map[int]struct { 274 result1 uint64 275 }) 276 } 277 fake.heightReturnsOnCall[i] = struct { 278 result1 uint64 279 }{result1} 280 } 281 282 func (fake *LedgerResources) Invocations() map[string][][]interface{} { 283 fake.invocationsMutex.RLock() 284 defer fake.invocationsMutex.RUnlock() 285 fake.appendMutex.RLock() 286 defer fake.appendMutex.RUnlock() 287 fake.blockMutex.RLock() 288 defer fake.blockMutex.RUnlock() 289 fake.channelIDMutex.RLock() 290 defer fake.channelIDMutex.RUnlock() 291 fake.heightMutex.RLock() 292 defer fake.heightMutex.RUnlock() 293 copiedInvocations := map[string][][]interface{}{} 294 for key, value := range fake.invocations { 295 copiedInvocations[key] = value 296 } 297 return copiedInvocations 298 } 299 300 func (fake *LedgerResources) recordInvocation(key string, args []interface{}) { 301 fake.invocationsMutex.Lock() 302 defer fake.invocationsMutex.Unlock() 303 if fake.invocations == nil { 304 fake.invocations = map[string][][]interface{}{} 305 } 306 if fake.invocations[key] == nil { 307 fake.invocations[key] = [][]interface{}{} 308 } 309 fake.invocations[key] = append(fake.invocations[key], args) 310 } 311 312 var _ follower.LedgerResources = new(LedgerResources)