github.com/anjalikarhana/fabric@v2.1.1+incompatible/orderer/common/broadcast/mock/metrics_provider.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric/common/metrics" 8 ) 9 10 type MetricsProvider struct { 11 NewCounterStub func(metrics.CounterOpts) metrics.Counter 12 newCounterMutex sync.RWMutex 13 newCounterArgsForCall []struct { 14 arg1 metrics.CounterOpts 15 } 16 newCounterReturns struct { 17 result1 metrics.Counter 18 } 19 newCounterReturnsOnCall map[int]struct { 20 result1 metrics.Counter 21 } 22 NewGaugeStub func(metrics.GaugeOpts) metrics.Gauge 23 newGaugeMutex sync.RWMutex 24 newGaugeArgsForCall []struct { 25 arg1 metrics.GaugeOpts 26 } 27 newGaugeReturns struct { 28 result1 metrics.Gauge 29 } 30 newGaugeReturnsOnCall map[int]struct { 31 result1 metrics.Gauge 32 } 33 NewHistogramStub func(metrics.HistogramOpts) metrics.Histogram 34 newHistogramMutex sync.RWMutex 35 newHistogramArgsForCall []struct { 36 arg1 metrics.HistogramOpts 37 } 38 newHistogramReturns struct { 39 result1 metrics.Histogram 40 } 41 newHistogramReturnsOnCall map[int]struct { 42 result1 metrics.Histogram 43 } 44 invocations map[string][][]interface{} 45 invocationsMutex sync.RWMutex 46 } 47 48 func (fake *MetricsProvider) NewCounter(arg1 metrics.CounterOpts) metrics.Counter { 49 fake.newCounterMutex.Lock() 50 ret, specificReturn := fake.newCounterReturnsOnCall[len(fake.newCounterArgsForCall)] 51 fake.newCounterArgsForCall = append(fake.newCounterArgsForCall, struct { 52 arg1 metrics.CounterOpts 53 }{arg1}) 54 fake.recordInvocation("NewCounter", []interface{}{arg1}) 55 fake.newCounterMutex.Unlock() 56 if fake.NewCounterStub != nil { 57 return fake.NewCounterStub(arg1) 58 } 59 if specificReturn { 60 return ret.result1 61 } 62 fakeReturns := fake.newCounterReturns 63 return fakeReturns.result1 64 } 65 66 func (fake *MetricsProvider) NewCounterCallCount() int { 67 fake.newCounterMutex.RLock() 68 defer fake.newCounterMutex.RUnlock() 69 return len(fake.newCounterArgsForCall) 70 } 71 72 func (fake *MetricsProvider) NewCounterCalls(stub func(metrics.CounterOpts) metrics.Counter) { 73 fake.newCounterMutex.Lock() 74 defer fake.newCounterMutex.Unlock() 75 fake.NewCounterStub = stub 76 } 77 78 func (fake *MetricsProvider) NewCounterArgsForCall(i int) metrics.CounterOpts { 79 fake.newCounterMutex.RLock() 80 defer fake.newCounterMutex.RUnlock() 81 argsForCall := fake.newCounterArgsForCall[i] 82 return argsForCall.arg1 83 } 84 85 func (fake *MetricsProvider) NewCounterReturns(result1 metrics.Counter) { 86 fake.newCounterMutex.Lock() 87 defer fake.newCounterMutex.Unlock() 88 fake.NewCounterStub = nil 89 fake.newCounterReturns = struct { 90 result1 metrics.Counter 91 }{result1} 92 } 93 94 func (fake *MetricsProvider) NewCounterReturnsOnCall(i int, result1 metrics.Counter) { 95 fake.newCounterMutex.Lock() 96 defer fake.newCounterMutex.Unlock() 97 fake.NewCounterStub = nil 98 if fake.newCounterReturnsOnCall == nil { 99 fake.newCounterReturnsOnCall = make(map[int]struct { 100 result1 metrics.Counter 101 }) 102 } 103 fake.newCounterReturnsOnCall[i] = struct { 104 result1 metrics.Counter 105 }{result1} 106 } 107 108 func (fake *MetricsProvider) NewGauge(arg1 metrics.GaugeOpts) metrics.Gauge { 109 fake.newGaugeMutex.Lock() 110 ret, specificReturn := fake.newGaugeReturnsOnCall[len(fake.newGaugeArgsForCall)] 111 fake.newGaugeArgsForCall = append(fake.newGaugeArgsForCall, struct { 112 arg1 metrics.GaugeOpts 113 }{arg1}) 114 fake.recordInvocation("NewGauge", []interface{}{arg1}) 115 fake.newGaugeMutex.Unlock() 116 if fake.NewGaugeStub != nil { 117 return fake.NewGaugeStub(arg1) 118 } 119 if specificReturn { 120 return ret.result1 121 } 122 fakeReturns := fake.newGaugeReturns 123 return fakeReturns.result1 124 } 125 126 func (fake *MetricsProvider) NewGaugeCallCount() int { 127 fake.newGaugeMutex.RLock() 128 defer fake.newGaugeMutex.RUnlock() 129 return len(fake.newGaugeArgsForCall) 130 } 131 132 func (fake *MetricsProvider) NewGaugeCalls(stub func(metrics.GaugeOpts) metrics.Gauge) { 133 fake.newGaugeMutex.Lock() 134 defer fake.newGaugeMutex.Unlock() 135 fake.NewGaugeStub = stub 136 } 137 138 func (fake *MetricsProvider) NewGaugeArgsForCall(i int) metrics.GaugeOpts { 139 fake.newGaugeMutex.RLock() 140 defer fake.newGaugeMutex.RUnlock() 141 argsForCall := fake.newGaugeArgsForCall[i] 142 return argsForCall.arg1 143 } 144 145 func (fake *MetricsProvider) NewGaugeReturns(result1 metrics.Gauge) { 146 fake.newGaugeMutex.Lock() 147 defer fake.newGaugeMutex.Unlock() 148 fake.NewGaugeStub = nil 149 fake.newGaugeReturns = struct { 150 result1 metrics.Gauge 151 }{result1} 152 } 153 154 func (fake *MetricsProvider) NewGaugeReturnsOnCall(i int, result1 metrics.Gauge) { 155 fake.newGaugeMutex.Lock() 156 defer fake.newGaugeMutex.Unlock() 157 fake.NewGaugeStub = nil 158 if fake.newGaugeReturnsOnCall == nil { 159 fake.newGaugeReturnsOnCall = make(map[int]struct { 160 result1 metrics.Gauge 161 }) 162 } 163 fake.newGaugeReturnsOnCall[i] = struct { 164 result1 metrics.Gauge 165 }{result1} 166 } 167 168 func (fake *MetricsProvider) NewHistogram(arg1 metrics.HistogramOpts) metrics.Histogram { 169 fake.newHistogramMutex.Lock() 170 ret, specificReturn := fake.newHistogramReturnsOnCall[len(fake.newHistogramArgsForCall)] 171 fake.newHistogramArgsForCall = append(fake.newHistogramArgsForCall, struct { 172 arg1 metrics.HistogramOpts 173 }{arg1}) 174 fake.recordInvocation("NewHistogram", []interface{}{arg1}) 175 fake.newHistogramMutex.Unlock() 176 if fake.NewHistogramStub != nil { 177 return fake.NewHistogramStub(arg1) 178 } 179 if specificReturn { 180 return ret.result1 181 } 182 fakeReturns := fake.newHistogramReturns 183 return fakeReturns.result1 184 } 185 186 func (fake *MetricsProvider) NewHistogramCallCount() int { 187 fake.newHistogramMutex.RLock() 188 defer fake.newHistogramMutex.RUnlock() 189 return len(fake.newHistogramArgsForCall) 190 } 191 192 func (fake *MetricsProvider) NewHistogramCalls(stub func(metrics.HistogramOpts) metrics.Histogram) { 193 fake.newHistogramMutex.Lock() 194 defer fake.newHistogramMutex.Unlock() 195 fake.NewHistogramStub = stub 196 } 197 198 func (fake *MetricsProvider) NewHistogramArgsForCall(i int) metrics.HistogramOpts { 199 fake.newHistogramMutex.RLock() 200 defer fake.newHistogramMutex.RUnlock() 201 argsForCall := fake.newHistogramArgsForCall[i] 202 return argsForCall.arg1 203 } 204 205 func (fake *MetricsProvider) NewHistogramReturns(result1 metrics.Histogram) { 206 fake.newHistogramMutex.Lock() 207 defer fake.newHistogramMutex.Unlock() 208 fake.NewHistogramStub = nil 209 fake.newHistogramReturns = struct { 210 result1 metrics.Histogram 211 }{result1} 212 } 213 214 func (fake *MetricsProvider) NewHistogramReturnsOnCall(i int, result1 metrics.Histogram) { 215 fake.newHistogramMutex.Lock() 216 defer fake.newHistogramMutex.Unlock() 217 fake.NewHistogramStub = nil 218 if fake.newHistogramReturnsOnCall == nil { 219 fake.newHistogramReturnsOnCall = make(map[int]struct { 220 result1 metrics.Histogram 221 }) 222 } 223 fake.newHistogramReturnsOnCall[i] = struct { 224 result1 metrics.Histogram 225 }{result1} 226 } 227 228 func (fake *MetricsProvider) Invocations() map[string][][]interface{} { 229 fake.invocationsMutex.RLock() 230 defer fake.invocationsMutex.RUnlock() 231 fake.newCounterMutex.RLock() 232 defer fake.newCounterMutex.RUnlock() 233 fake.newGaugeMutex.RLock() 234 defer fake.newGaugeMutex.RUnlock() 235 fake.newHistogramMutex.RLock() 236 defer fake.newHistogramMutex.RUnlock() 237 copiedInvocations := map[string][][]interface{}{} 238 for key, value := range fake.invocations { 239 copiedInvocations[key] = value 240 } 241 return copiedInvocations 242 } 243 244 func (fake *MetricsProvider) recordInvocation(key string, args []interface{}) { 245 fake.invocationsMutex.Lock() 246 defer fake.invocationsMutex.Unlock() 247 if fake.invocations == nil { 248 fake.invocations = map[string][][]interface{}{} 249 } 250 if fake.invocations[key] == nil { 251 fake.invocations[key] = [][]interface{}{} 252 } 253 fake.invocations[key] = append(fake.invocations[key], args) 254 }