github.com/true-sqn/fabric@v2.1.1+incompatible/core/deliverservice/fake/ledger_info.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package fake 3 4 import ( 5 "sync" 6 ) 7 8 type LedgerInfo struct { 9 LedgerHeightStub func() (uint64, error) 10 ledgerHeightMutex sync.RWMutex 11 ledgerHeightArgsForCall []struct { 12 } 13 ledgerHeightReturns struct { 14 result1 uint64 15 result2 error 16 } 17 ledgerHeightReturnsOnCall map[int]struct { 18 result1 uint64 19 result2 error 20 } 21 invocations map[string][][]interface{} 22 invocationsMutex sync.RWMutex 23 } 24 25 func (fake *LedgerInfo) LedgerHeight() (uint64, error) { 26 fake.ledgerHeightMutex.Lock() 27 ret, specificReturn := fake.ledgerHeightReturnsOnCall[len(fake.ledgerHeightArgsForCall)] 28 fake.ledgerHeightArgsForCall = append(fake.ledgerHeightArgsForCall, struct { 29 }{}) 30 fake.recordInvocation("LedgerHeight", []interface{}{}) 31 fake.ledgerHeightMutex.Unlock() 32 if fake.LedgerHeightStub != nil { 33 return fake.LedgerHeightStub() 34 } 35 if specificReturn { 36 return ret.result1, ret.result2 37 } 38 fakeReturns := fake.ledgerHeightReturns 39 return fakeReturns.result1, fakeReturns.result2 40 } 41 42 func (fake *LedgerInfo) LedgerHeightCallCount() int { 43 fake.ledgerHeightMutex.RLock() 44 defer fake.ledgerHeightMutex.RUnlock() 45 return len(fake.ledgerHeightArgsForCall) 46 } 47 48 func (fake *LedgerInfo) LedgerHeightCalls(stub func() (uint64, error)) { 49 fake.ledgerHeightMutex.Lock() 50 defer fake.ledgerHeightMutex.Unlock() 51 fake.LedgerHeightStub = stub 52 } 53 54 func (fake *LedgerInfo) LedgerHeightReturns(result1 uint64, result2 error) { 55 fake.ledgerHeightMutex.Lock() 56 defer fake.ledgerHeightMutex.Unlock() 57 fake.LedgerHeightStub = nil 58 fake.ledgerHeightReturns = struct { 59 result1 uint64 60 result2 error 61 }{result1, result2} 62 } 63 64 func (fake *LedgerInfo) LedgerHeightReturnsOnCall(i int, result1 uint64, result2 error) { 65 fake.ledgerHeightMutex.Lock() 66 defer fake.ledgerHeightMutex.Unlock() 67 fake.LedgerHeightStub = nil 68 if fake.ledgerHeightReturnsOnCall == nil { 69 fake.ledgerHeightReturnsOnCall = make(map[int]struct { 70 result1 uint64 71 result2 error 72 }) 73 } 74 fake.ledgerHeightReturnsOnCall[i] = struct { 75 result1 uint64 76 result2 error 77 }{result1, result2} 78 } 79 80 func (fake *LedgerInfo) Invocations() map[string][][]interface{} { 81 fake.invocationsMutex.RLock() 82 defer fake.invocationsMutex.RUnlock() 83 fake.ledgerHeightMutex.RLock() 84 defer fake.ledgerHeightMutex.RUnlock() 85 copiedInvocations := map[string][][]interface{}{} 86 for key, value := range fake.invocations { 87 copiedInvocations[key] = value 88 } 89 return copiedInvocations 90 } 91 92 func (fake *LedgerInfo) recordInvocation(key string, args []interface{}) { 93 fake.invocationsMutex.Lock() 94 defer fake.invocationsMutex.Unlock() 95 if fake.invocations == nil { 96 fake.invocations = map[string][][]interface{}{} 97 } 98 if fake.invocations[key] == nil { 99 fake.invocations[key] = [][]interface{}{} 100 } 101 fake.invocations[key] = append(fake.invocations[key], args) 102 }