github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/validation_state.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 validation "github.com/hyperledger/fabric/core/handlers/validation/api/state" 8 ) 9 10 type ValidationState struct { 11 DoneStub func() 12 doneMutex sync.RWMutex 13 doneArgsForCall []struct { 14 } 15 GetPrivateDataMetadataByHashStub func(string, string, []byte) (map[string][]byte, error) 16 getPrivateDataMetadataByHashMutex sync.RWMutex 17 getPrivateDataMetadataByHashArgsForCall []struct { 18 arg1 string 19 arg2 string 20 arg3 []byte 21 } 22 getPrivateDataMetadataByHashReturns struct { 23 result1 map[string][]byte 24 result2 error 25 } 26 getPrivateDataMetadataByHashReturnsOnCall map[int]struct { 27 result1 map[string][]byte 28 result2 error 29 } 30 GetStateMetadataStub func(string, string) (map[string][]byte, error) 31 getStateMetadataMutex sync.RWMutex 32 getStateMetadataArgsForCall []struct { 33 arg1 string 34 arg2 string 35 } 36 getStateMetadataReturns struct { 37 result1 map[string][]byte 38 result2 error 39 } 40 getStateMetadataReturnsOnCall map[int]struct { 41 result1 map[string][]byte 42 result2 error 43 } 44 GetStateMultipleKeysStub func(string, []string) ([][]byte, error) 45 getStateMultipleKeysMutex sync.RWMutex 46 getStateMultipleKeysArgsForCall []struct { 47 arg1 string 48 arg2 []string 49 } 50 getStateMultipleKeysReturns struct { 51 result1 [][]byte 52 result2 error 53 } 54 getStateMultipleKeysReturnsOnCall map[int]struct { 55 result1 [][]byte 56 result2 error 57 } 58 GetStateRangeScanIteratorStub func(string, string, string) (validation.ResultsIterator, error) 59 getStateRangeScanIteratorMutex sync.RWMutex 60 getStateRangeScanIteratorArgsForCall []struct { 61 arg1 string 62 arg2 string 63 arg3 string 64 } 65 getStateRangeScanIteratorReturns struct { 66 result1 validation.ResultsIterator 67 result2 error 68 } 69 getStateRangeScanIteratorReturnsOnCall map[int]struct { 70 result1 validation.ResultsIterator 71 result2 error 72 } 73 invocations map[string][][]interface{} 74 invocationsMutex sync.RWMutex 75 } 76 77 func (fake *ValidationState) Done() { 78 fake.doneMutex.Lock() 79 fake.doneArgsForCall = append(fake.doneArgsForCall, struct { 80 }{}) 81 fake.recordInvocation("Done", []interface{}{}) 82 fake.doneMutex.Unlock() 83 if fake.DoneStub != nil { 84 fake.DoneStub() 85 } 86 } 87 88 func (fake *ValidationState) DoneCallCount() int { 89 fake.doneMutex.RLock() 90 defer fake.doneMutex.RUnlock() 91 return len(fake.doneArgsForCall) 92 } 93 94 func (fake *ValidationState) DoneCalls(stub func()) { 95 fake.doneMutex.Lock() 96 defer fake.doneMutex.Unlock() 97 fake.DoneStub = stub 98 } 99 100 func (fake *ValidationState) GetPrivateDataMetadataByHash(arg1 string, arg2 string, arg3 []byte) (map[string][]byte, error) { 101 var arg3Copy []byte 102 if arg3 != nil { 103 arg3Copy = make([]byte, len(arg3)) 104 copy(arg3Copy, arg3) 105 } 106 fake.getPrivateDataMetadataByHashMutex.Lock() 107 ret, specificReturn := fake.getPrivateDataMetadataByHashReturnsOnCall[len(fake.getPrivateDataMetadataByHashArgsForCall)] 108 fake.getPrivateDataMetadataByHashArgsForCall = append(fake.getPrivateDataMetadataByHashArgsForCall, struct { 109 arg1 string 110 arg2 string 111 arg3 []byte 112 }{arg1, arg2, arg3Copy}) 113 fake.recordInvocation("GetPrivateDataMetadataByHash", []interface{}{arg1, arg2, arg3Copy}) 114 fake.getPrivateDataMetadataByHashMutex.Unlock() 115 if fake.GetPrivateDataMetadataByHashStub != nil { 116 return fake.GetPrivateDataMetadataByHashStub(arg1, arg2, arg3) 117 } 118 if specificReturn { 119 return ret.result1, ret.result2 120 } 121 fakeReturns := fake.getPrivateDataMetadataByHashReturns 122 return fakeReturns.result1, fakeReturns.result2 123 } 124 125 func (fake *ValidationState) GetPrivateDataMetadataByHashCallCount() int { 126 fake.getPrivateDataMetadataByHashMutex.RLock() 127 defer fake.getPrivateDataMetadataByHashMutex.RUnlock() 128 return len(fake.getPrivateDataMetadataByHashArgsForCall) 129 } 130 131 func (fake *ValidationState) GetPrivateDataMetadataByHashCalls(stub func(string, string, []byte) (map[string][]byte, error)) { 132 fake.getPrivateDataMetadataByHashMutex.Lock() 133 defer fake.getPrivateDataMetadataByHashMutex.Unlock() 134 fake.GetPrivateDataMetadataByHashStub = stub 135 } 136 137 func (fake *ValidationState) GetPrivateDataMetadataByHashArgsForCall(i int) (string, string, []byte) { 138 fake.getPrivateDataMetadataByHashMutex.RLock() 139 defer fake.getPrivateDataMetadataByHashMutex.RUnlock() 140 argsForCall := fake.getPrivateDataMetadataByHashArgsForCall[i] 141 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 142 } 143 144 func (fake *ValidationState) GetPrivateDataMetadataByHashReturns(result1 map[string][]byte, result2 error) { 145 fake.getPrivateDataMetadataByHashMutex.Lock() 146 defer fake.getPrivateDataMetadataByHashMutex.Unlock() 147 fake.GetPrivateDataMetadataByHashStub = nil 148 fake.getPrivateDataMetadataByHashReturns = struct { 149 result1 map[string][]byte 150 result2 error 151 }{result1, result2} 152 } 153 154 func (fake *ValidationState) GetPrivateDataMetadataByHashReturnsOnCall(i int, result1 map[string][]byte, result2 error) { 155 fake.getPrivateDataMetadataByHashMutex.Lock() 156 defer fake.getPrivateDataMetadataByHashMutex.Unlock() 157 fake.GetPrivateDataMetadataByHashStub = nil 158 if fake.getPrivateDataMetadataByHashReturnsOnCall == nil { 159 fake.getPrivateDataMetadataByHashReturnsOnCall = make(map[int]struct { 160 result1 map[string][]byte 161 result2 error 162 }) 163 } 164 fake.getPrivateDataMetadataByHashReturnsOnCall[i] = struct { 165 result1 map[string][]byte 166 result2 error 167 }{result1, result2} 168 } 169 170 func (fake *ValidationState) GetStateMetadata(arg1 string, arg2 string) (map[string][]byte, error) { 171 fake.getStateMetadataMutex.Lock() 172 ret, specificReturn := fake.getStateMetadataReturnsOnCall[len(fake.getStateMetadataArgsForCall)] 173 fake.getStateMetadataArgsForCall = append(fake.getStateMetadataArgsForCall, struct { 174 arg1 string 175 arg2 string 176 }{arg1, arg2}) 177 fake.recordInvocation("GetStateMetadata", []interface{}{arg1, arg2}) 178 fake.getStateMetadataMutex.Unlock() 179 if fake.GetStateMetadataStub != nil { 180 return fake.GetStateMetadataStub(arg1, arg2) 181 } 182 if specificReturn { 183 return ret.result1, ret.result2 184 } 185 fakeReturns := fake.getStateMetadataReturns 186 return fakeReturns.result1, fakeReturns.result2 187 } 188 189 func (fake *ValidationState) GetStateMetadataCallCount() int { 190 fake.getStateMetadataMutex.RLock() 191 defer fake.getStateMetadataMutex.RUnlock() 192 return len(fake.getStateMetadataArgsForCall) 193 } 194 195 func (fake *ValidationState) GetStateMetadataCalls(stub func(string, string) (map[string][]byte, error)) { 196 fake.getStateMetadataMutex.Lock() 197 defer fake.getStateMetadataMutex.Unlock() 198 fake.GetStateMetadataStub = stub 199 } 200 201 func (fake *ValidationState) GetStateMetadataArgsForCall(i int) (string, string) { 202 fake.getStateMetadataMutex.RLock() 203 defer fake.getStateMetadataMutex.RUnlock() 204 argsForCall := fake.getStateMetadataArgsForCall[i] 205 return argsForCall.arg1, argsForCall.arg2 206 } 207 208 func (fake *ValidationState) GetStateMetadataReturns(result1 map[string][]byte, result2 error) { 209 fake.getStateMetadataMutex.Lock() 210 defer fake.getStateMetadataMutex.Unlock() 211 fake.GetStateMetadataStub = nil 212 fake.getStateMetadataReturns = struct { 213 result1 map[string][]byte 214 result2 error 215 }{result1, result2} 216 } 217 218 func (fake *ValidationState) GetStateMetadataReturnsOnCall(i int, result1 map[string][]byte, result2 error) { 219 fake.getStateMetadataMutex.Lock() 220 defer fake.getStateMetadataMutex.Unlock() 221 fake.GetStateMetadataStub = nil 222 if fake.getStateMetadataReturnsOnCall == nil { 223 fake.getStateMetadataReturnsOnCall = make(map[int]struct { 224 result1 map[string][]byte 225 result2 error 226 }) 227 } 228 fake.getStateMetadataReturnsOnCall[i] = struct { 229 result1 map[string][]byte 230 result2 error 231 }{result1, result2} 232 } 233 234 func (fake *ValidationState) GetStateMultipleKeys(arg1 string, arg2 []string) ([][]byte, error) { 235 var arg2Copy []string 236 if arg2 != nil { 237 arg2Copy = make([]string, len(arg2)) 238 copy(arg2Copy, arg2) 239 } 240 fake.getStateMultipleKeysMutex.Lock() 241 ret, specificReturn := fake.getStateMultipleKeysReturnsOnCall[len(fake.getStateMultipleKeysArgsForCall)] 242 fake.getStateMultipleKeysArgsForCall = append(fake.getStateMultipleKeysArgsForCall, struct { 243 arg1 string 244 arg2 []string 245 }{arg1, arg2Copy}) 246 fake.recordInvocation("GetStateMultipleKeys", []interface{}{arg1, arg2Copy}) 247 fake.getStateMultipleKeysMutex.Unlock() 248 if fake.GetStateMultipleKeysStub != nil { 249 return fake.GetStateMultipleKeysStub(arg1, arg2) 250 } 251 if specificReturn { 252 return ret.result1, ret.result2 253 } 254 fakeReturns := fake.getStateMultipleKeysReturns 255 return fakeReturns.result1, fakeReturns.result2 256 } 257 258 func (fake *ValidationState) GetStateMultipleKeysCallCount() int { 259 fake.getStateMultipleKeysMutex.RLock() 260 defer fake.getStateMultipleKeysMutex.RUnlock() 261 return len(fake.getStateMultipleKeysArgsForCall) 262 } 263 264 func (fake *ValidationState) GetStateMultipleKeysCalls(stub func(string, []string) ([][]byte, error)) { 265 fake.getStateMultipleKeysMutex.Lock() 266 defer fake.getStateMultipleKeysMutex.Unlock() 267 fake.GetStateMultipleKeysStub = stub 268 } 269 270 func (fake *ValidationState) GetStateMultipleKeysArgsForCall(i int) (string, []string) { 271 fake.getStateMultipleKeysMutex.RLock() 272 defer fake.getStateMultipleKeysMutex.RUnlock() 273 argsForCall := fake.getStateMultipleKeysArgsForCall[i] 274 return argsForCall.arg1, argsForCall.arg2 275 } 276 277 func (fake *ValidationState) GetStateMultipleKeysReturns(result1 [][]byte, result2 error) { 278 fake.getStateMultipleKeysMutex.Lock() 279 defer fake.getStateMultipleKeysMutex.Unlock() 280 fake.GetStateMultipleKeysStub = nil 281 fake.getStateMultipleKeysReturns = struct { 282 result1 [][]byte 283 result2 error 284 }{result1, result2} 285 } 286 287 func (fake *ValidationState) GetStateMultipleKeysReturnsOnCall(i int, result1 [][]byte, result2 error) { 288 fake.getStateMultipleKeysMutex.Lock() 289 defer fake.getStateMultipleKeysMutex.Unlock() 290 fake.GetStateMultipleKeysStub = nil 291 if fake.getStateMultipleKeysReturnsOnCall == nil { 292 fake.getStateMultipleKeysReturnsOnCall = make(map[int]struct { 293 result1 [][]byte 294 result2 error 295 }) 296 } 297 fake.getStateMultipleKeysReturnsOnCall[i] = struct { 298 result1 [][]byte 299 result2 error 300 }{result1, result2} 301 } 302 303 func (fake *ValidationState) GetStateRangeScanIterator(arg1 string, arg2 string, arg3 string) (validation.ResultsIterator, error) { 304 fake.getStateRangeScanIteratorMutex.Lock() 305 ret, specificReturn := fake.getStateRangeScanIteratorReturnsOnCall[len(fake.getStateRangeScanIteratorArgsForCall)] 306 fake.getStateRangeScanIteratorArgsForCall = append(fake.getStateRangeScanIteratorArgsForCall, struct { 307 arg1 string 308 arg2 string 309 arg3 string 310 }{arg1, arg2, arg3}) 311 fake.recordInvocation("GetStateRangeScanIterator", []interface{}{arg1, arg2, arg3}) 312 fake.getStateRangeScanIteratorMutex.Unlock() 313 if fake.GetStateRangeScanIteratorStub != nil { 314 return fake.GetStateRangeScanIteratorStub(arg1, arg2, arg3) 315 } 316 if specificReturn { 317 return ret.result1, ret.result2 318 } 319 fakeReturns := fake.getStateRangeScanIteratorReturns 320 return fakeReturns.result1, fakeReturns.result2 321 } 322 323 func (fake *ValidationState) GetStateRangeScanIteratorCallCount() int { 324 fake.getStateRangeScanIteratorMutex.RLock() 325 defer fake.getStateRangeScanIteratorMutex.RUnlock() 326 return len(fake.getStateRangeScanIteratorArgsForCall) 327 } 328 329 func (fake *ValidationState) GetStateRangeScanIteratorCalls(stub func(string, string, string) (validation.ResultsIterator, error)) { 330 fake.getStateRangeScanIteratorMutex.Lock() 331 defer fake.getStateRangeScanIteratorMutex.Unlock() 332 fake.GetStateRangeScanIteratorStub = stub 333 } 334 335 func (fake *ValidationState) GetStateRangeScanIteratorArgsForCall(i int) (string, string, string) { 336 fake.getStateRangeScanIteratorMutex.RLock() 337 defer fake.getStateRangeScanIteratorMutex.RUnlock() 338 argsForCall := fake.getStateRangeScanIteratorArgsForCall[i] 339 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 340 } 341 342 func (fake *ValidationState) GetStateRangeScanIteratorReturns(result1 validation.ResultsIterator, result2 error) { 343 fake.getStateRangeScanIteratorMutex.Lock() 344 defer fake.getStateRangeScanIteratorMutex.Unlock() 345 fake.GetStateRangeScanIteratorStub = nil 346 fake.getStateRangeScanIteratorReturns = struct { 347 result1 validation.ResultsIterator 348 result2 error 349 }{result1, result2} 350 } 351 352 func (fake *ValidationState) GetStateRangeScanIteratorReturnsOnCall(i int, result1 validation.ResultsIterator, result2 error) { 353 fake.getStateRangeScanIteratorMutex.Lock() 354 defer fake.getStateRangeScanIteratorMutex.Unlock() 355 fake.GetStateRangeScanIteratorStub = nil 356 if fake.getStateRangeScanIteratorReturnsOnCall == nil { 357 fake.getStateRangeScanIteratorReturnsOnCall = make(map[int]struct { 358 result1 validation.ResultsIterator 359 result2 error 360 }) 361 } 362 fake.getStateRangeScanIteratorReturnsOnCall[i] = struct { 363 result1 validation.ResultsIterator 364 result2 error 365 }{result1, result2} 366 } 367 368 func (fake *ValidationState) Invocations() map[string][][]interface{} { 369 fake.invocationsMutex.RLock() 370 defer fake.invocationsMutex.RUnlock() 371 fake.doneMutex.RLock() 372 defer fake.doneMutex.RUnlock() 373 fake.getPrivateDataMetadataByHashMutex.RLock() 374 defer fake.getPrivateDataMetadataByHashMutex.RUnlock() 375 fake.getStateMetadataMutex.RLock() 376 defer fake.getStateMetadataMutex.RUnlock() 377 fake.getStateMultipleKeysMutex.RLock() 378 defer fake.getStateMultipleKeysMutex.RUnlock() 379 fake.getStateRangeScanIteratorMutex.RLock() 380 defer fake.getStateRangeScanIteratorMutex.RUnlock() 381 copiedInvocations := map[string][][]interface{}{} 382 for key, value := range fake.invocations { 383 copiedInvocations[key] = value 384 } 385 return copiedInvocations 386 } 387 388 func (fake *ValidationState) recordInvocation(key string, args []interface{}) { 389 fake.invocationsMutex.Lock() 390 defer fake.invocationsMutex.Unlock() 391 if fake.invocations == nil { 392 fake.invocations = map[string][][]interface{}{} 393 } 394 if fake.invocations[key] == nil { 395 fake.invocations[key] = [][]interface{}{} 396 } 397 fake.invocations[key] = append(fake.invocations[key], args) 398 }