github.com/hellobchain/third_party@v0.0.0-20230331131523-deb0478a2e52/hyperledger/fabric/common/metrics/metricsfakes/gauge.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package metricsfakes 3 4 import ( 5 "sync" 6 7 "github.com/hellobchain/third_party/hyperledger/fabric/common/metrics" 8 ) 9 10 type Gauge struct { 11 WithStub func(labelValues ...string) metrics.Gauge 12 withMutex sync.RWMutex 13 withArgsForCall []struct { 14 labelValues []string 15 } 16 withReturns struct { 17 result1 metrics.Gauge 18 } 19 withReturnsOnCall map[int]struct { 20 result1 metrics.Gauge 21 } 22 AddStub func(delta float64) 23 addMutex sync.RWMutex 24 addArgsForCall []struct { 25 delta float64 26 } 27 SetStub func(value float64) 28 setMutex sync.RWMutex 29 setArgsForCall []struct { 30 value float64 31 } 32 invocations map[string][][]interface{} 33 invocationsMutex sync.RWMutex 34 } 35 36 func (fake *Gauge) With(labelValues ...string) metrics.Gauge { 37 fake.withMutex.Lock() 38 ret, specificReturn := fake.withReturnsOnCall[len(fake.withArgsForCall)] 39 fake.withArgsForCall = append(fake.withArgsForCall, struct { 40 labelValues []string 41 }{labelValues}) 42 fake.recordInvocation("With", []interface{}{labelValues}) 43 fake.withMutex.Unlock() 44 if fake.WithStub != nil { 45 return fake.WithStub(labelValues...) 46 } 47 if specificReturn { 48 return ret.result1 49 } 50 return fake.withReturns.result1 51 } 52 53 func (fake *Gauge) WithCallCount() int { 54 fake.withMutex.RLock() 55 defer fake.withMutex.RUnlock() 56 return len(fake.withArgsForCall) 57 } 58 59 func (fake *Gauge) WithArgsForCall(i int) []string { 60 fake.withMutex.RLock() 61 defer fake.withMutex.RUnlock() 62 return fake.withArgsForCall[i].labelValues 63 } 64 65 func (fake *Gauge) WithReturns(result1 metrics.Gauge) { 66 fake.WithStub = nil 67 fake.withReturns = struct { 68 result1 metrics.Gauge 69 }{result1} 70 } 71 72 func (fake *Gauge) WithReturnsOnCall(i int, result1 metrics.Gauge) { 73 fake.WithStub = nil 74 if fake.withReturnsOnCall == nil { 75 fake.withReturnsOnCall = make(map[int]struct { 76 result1 metrics.Gauge 77 }) 78 } 79 fake.withReturnsOnCall[i] = struct { 80 result1 metrics.Gauge 81 }{result1} 82 } 83 84 func (fake *Gauge) Add(delta float64) { 85 fake.addMutex.Lock() 86 fake.addArgsForCall = append(fake.addArgsForCall, struct { 87 delta float64 88 }{delta}) 89 fake.recordInvocation("Add", []interface{}{delta}) 90 fake.addMutex.Unlock() 91 if fake.AddStub != nil { 92 fake.AddStub(delta) 93 } 94 } 95 96 func (fake *Gauge) AddCallCount() int { 97 fake.addMutex.RLock() 98 defer fake.addMutex.RUnlock() 99 return len(fake.addArgsForCall) 100 } 101 102 func (fake *Gauge) AddArgsForCall(i int) float64 { 103 fake.addMutex.RLock() 104 defer fake.addMutex.RUnlock() 105 return fake.addArgsForCall[i].delta 106 } 107 108 func (fake *Gauge) Set(value float64) { 109 fake.setMutex.Lock() 110 fake.setArgsForCall = append(fake.setArgsForCall, struct { 111 value float64 112 }{value}) 113 fake.recordInvocation("Set", []interface{}{value}) 114 fake.setMutex.Unlock() 115 if fake.SetStub != nil { 116 fake.SetStub(value) 117 } 118 } 119 120 func (fake *Gauge) SetCallCount() int { 121 fake.setMutex.RLock() 122 defer fake.setMutex.RUnlock() 123 return len(fake.setArgsForCall) 124 } 125 126 func (fake *Gauge) SetArgsForCall(i int) float64 { 127 fake.setMutex.RLock() 128 defer fake.setMutex.RUnlock() 129 return fake.setArgsForCall[i].value 130 } 131 132 func (fake *Gauge) Invocations() map[string][][]interface{} { 133 fake.invocationsMutex.RLock() 134 defer fake.invocationsMutex.RUnlock() 135 fake.withMutex.RLock() 136 defer fake.withMutex.RUnlock() 137 fake.addMutex.RLock() 138 defer fake.addMutex.RUnlock() 139 fake.setMutex.RLock() 140 defer fake.setMutex.RUnlock() 141 copiedInvocations := map[string][][]interface{}{} 142 for key, value := range fake.invocations { 143 copiedInvocations[key] = value 144 } 145 return copiedInvocations 146 } 147 148 func (fake *Gauge) recordInvocation(key string, args []interface{}) { 149 fake.invocationsMutex.Lock() 150 defer fake.invocationsMutex.Unlock() 151 if fake.invocations == nil { 152 fake.invocations = map[string][][]interface{}{} 153 } 154 if fake.invocations[key] == nil { 155 fake.invocations[key] = [][]interface{}{} 156 } 157 fake.invocations[key] = append(fake.invocations[key], args) 158 } 159 160 var _ metrics.Gauge = new(Gauge)