github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/ledger/kvledger/txmgmt/privacyenabledstate/mock/channelinfo_provider.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hechain20/hechain/core/ledger/kvledger/txmgmt/statedb" 8 ) 9 10 type ChannelInfoProvider struct { 11 NamespacesAndCollectionsStub func(statedb.VersionedDB) (map[string][]string, error) 12 namespacesAndCollectionsMutex sync.RWMutex 13 namespacesAndCollectionsArgsForCall []struct { 14 arg1 statedb.VersionedDB 15 } 16 namespacesAndCollectionsReturns struct { 17 result1 map[string][]string 18 result2 error 19 } 20 namespacesAndCollectionsReturnsOnCall map[int]struct { 21 result1 map[string][]string 22 result2 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *ChannelInfoProvider) NamespacesAndCollections(arg1 statedb.VersionedDB) (map[string][]string, error) { 29 fake.namespacesAndCollectionsMutex.Lock() 30 ret, specificReturn := fake.namespacesAndCollectionsReturnsOnCall[len(fake.namespacesAndCollectionsArgsForCall)] 31 fake.namespacesAndCollectionsArgsForCall = append(fake.namespacesAndCollectionsArgsForCall, struct { 32 arg1 statedb.VersionedDB 33 }{arg1}) 34 fake.recordInvocation("NamespacesAndCollections", []interface{}{arg1}) 35 fake.namespacesAndCollectionsMutex.Unlock() 36 if fake.NamespacesAndCollectionsStub != nil { 37 return fake.NamespacesAndCollectionsStub(arg1) 38 } 39 if specificReturn { 40 return ret.result1, ret.result2 41 } 42 fakeReturns := fake.namespacesAndCollectionsReturns 43 return fakeReturns.result1, fakeReturns.result2 44 } 45 46 func (fake *ChannelInfoProvider) NamespacesAndCollectionsCallCount() int { 47 fake.namespacesAndCollectionsMutex.RLock() 48 defer fake.namespacesAndCollectionsMutex.RUnlock() 49 return len(fake.namespacesAndCollectionsArgsForCall) 50 } 51 52 func (fake *ChannelInfoProvider) NamespacesAndCollectionsCalls(stub func(statedb.VersionedDB) (map[string][]string, error)) { 53 fake.namespacesAndCollectionsMutex.Lock() 54 defer fake.namespacesAndCollectionsMutex.Unlock() 55 fake.NamespacesAndCollectionsStub = stub 56 } 57 58 func (fake *ChannelInfoProvider) NamespacesAndCollectionsArgsForCall(i int) statedb.VersionedDB { 59 fake.namespacesAndCollectionsMutex.RLock() 60 defer fake.namespacesAndCollectionsMutex.RUnlock() 61 argsForCall := fake.namespacesAndCollectionsArgsForCall[i] 62 return argsForCall.arg1 63 } 64 65 func (fake *ChannelInfoProvider) NamespacesAndCollectionsReturns(result1 map[string][]string, result2 error) { 66 fake.namespacesAndCollectionsMutex.Lock() 67 defer fake.namespacesAndCollectionsMutex.Unlock() 68 fake.NamespacesAndCollectionsStub = nil 69 fake.namespacesAndCollectionsReturns = struct { 70 result1 map[string][]string 71 result2 error 72 }{result1, result2} 73 } 74 75 func (fake *ChannelInfoProvider) NamespacesAndCollectionsReturnsOnCall(i int, result1 map[string][]string, result2 error) { 76 fake.namespacesAndCollectionsMutex.Lock() 77 defer fake.namespacesAndCollectionsMutex.Unlock() 78 fake.NamespacesAndCollectionsStub = nil 79 if fake.namespacesAndCollectionsReturnsOnCall == nil { 80 fake.namespacesAndCollectionsReturnsOnCall = make(map[int]struct { 81 result1 map[string][]string 82 result2 error 83 }) 84 } 85 fake.namespacesAndCollectionsReturnsOnCall[i] = struct { 86 result1 map[string][]string 87 result2 error 88 }{result1, result2} 89 } 90 91 func (fake *ChannelInfoProvider) Invocations() map[string][][]interface{} { 92 fake.invocationsMutex.RLock() 93 defer fake.invocationsMutex.RUnlock() 94 fake.namespacesAndCollectionsMutex.RLock() 95 defer fake.namespacesAndCollectionsMutex.RUnlock() 96 copiedInvocations := map[string][][]interface{}{} 97 for key, value := range fake.invocations { 98 copiedInvocations[key] = value 99 } 100 return copiedInvocations 101 } 102 103 func (fake *ChannelInfoProvider) recordInvocation(key string, args []interface{}) { 104 fake.invocationsMutex.Lock() 105 defer fake.invocationsMutex.Unlock() 106 if fake.invocations == nil { 107 fake.invocations = map[string][][]interface{}{} 108 } 109 if fake.invocations[key] == nil { 110 fake.invocations[key] = [][]interface{}{} 111 } 112 fake.invocations[key] = append(fake.invocations[key], args) 113 }