github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/consensus/etcdraft/mocks/inactive_chain_registry.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/consensus/etcdraft" 9 ) 10 11 type InactiveChainRegistry struct { 12 StopStub func() 13 stopMutex sync.RWMutex 14 stopArgsForCall []struct { 15 } 16 TrackChainStub func(string, *common.Block, func()) 17 trackChainMutex sync.RWMutex 18 trackChainArgsForCall []struct { 19 arg1 string 20 arg2 *common.Block 21 arg3 func() 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *InactiveChainRegistry) Stop() { 28 fake.stopMutex.Lock() 29 fake.stopArgsForCall = append(fake.stopArgsForCall, struct { 30 }{}) 31 fake.recordInvocation("Stop", []interface{}{}) 32 fake.stopMutex.Unlock() 33 if fake.StopStub != nil { 34 fake.StopStub() 35 } 36 } 37 38 func (fake *InactiveChainRegistry) StopCallCount() int { 39 fake.stopMutex.RLock() 40 defer fake.stopMutex.RUnlock() 41 return len(fake.stopArgsForCall) 42 } 43 44 func (fake *InactiveChainRegistry) StopCalls(stub func()) { 45 fake.stopMutex.Lock() 46 defer fake.stopMutex.Unlock() 47 fake.StopStub = stub 48 } 49 50 func (fake *InactiveChainRegistry) TrackChain(arg1 string, arg2 *common.Block, arg3 func()) { 51 fake.trackChainMutex.Lock() 52 fake.trackChainArgsForCall = append(fake.trackChainArgsForCall, struct { 53 arg1 string 54 arg2 *common.Block 55 arg3 func() 56 }{arg1, arg2, arg3}) 57 fake.recordInvocation("TrackChain", []interface{}{arg1, arg2, arg3}) 58 fake.trackChainMutex.Unlock() 59 if fake.TrackChainStub != nil { 60 fake.TrackChainStub(arg1, arg2, arg3) 61 } 62 } 63 64 func (fake *InactiveChainRegistry) TrackChainCallCount() int { 65 fake.trackChainMutex.RLock() 66 defer fake.trackChainMutex.RUnlock() 67 return len(fake.trackChainArgsForCall) 68 } 69 70 func (fake *InactiveChainRegistry) TrackChainCalls(stub func(string, *common.Block, func())) { 71 fake.trackChainMutex.Lock() 72 defer fake.trackChainMutex.Unlock() 73 fake.TrackChainStub = stub 74 } 75 76 func (fake *InactiveChainRegistry) TrackChainArgsForCall(i int) (string, *common.Block, func()) { 77 fake.trackChainMutex.RLock() 78 defer fake.trackChainMutex.RUnlock() 79 argsForCall := fake.trackChainArgsForCall[i] 80 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 81 } 82 83 func (fake *InactiveChainRegistry) Invocations() map[string][][]interface{} { 84 fake.invocationsMutex.RLock() 85 defer fake.invocationsMutex.RUnlock() 86 fake.stopMutex.RLock() 87 defer fake.stopMutex.RUnlock() 88 fake.trackChainMutex.RLock() 89 defer fake.trackChainMutex.RUnlock() 90 copiedInvocations := map[string][][]interface{}{} 91 for key, value := range fake.invocations { 92 copiedInvocations[key] = value 93 } 94 return copiedInvocations 95 } 96 97 func (fake *InactiveChainRegistry) recordInvocation(key string, args []interface{}) { 98 fake.invocationsMutex.Lock() 99 defer fake.invocationsMutex.Unlock() 100 if fake.invocations == nil { 101 fake.invocations = map[string][][]interface{}{} 102 } 103 if fake.invocations[key] == nil { 104 fake.invocations[key] = [][]interface{}{} 105 } 106 fake.invocations[key] = append(fake.invocations[key], args) 107 } 108 109 var _ etcdraft.InactiveChainRegistry = new(InactiveChainRegistry)