github.com/lzy4123/fabric@v2.1.1+incompatible/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/hyperledger/fabric/common/metrics"
     8  )
     9  
    10  type Gauge struct {
    11  	AddStub        func(float64)
    12  	addMutex       sync.RWMutex
    13  	addArgsForCall []struct {
    14  		arg1 float64
    15  	}
    16  	SetStub        func(float64)
    17  	setMutex       sync.RWMutex
    18  	setArgsForCall []struct {
    19  		arg1 float64
    20  	}
    21  	WithStub        func(...string) metrics.Gauge
    22  	withMutex       sync.RWMutex
    23  	withArgsForCall []struct {
    24  		arg1 []string
    25  	}
    26  	withReturns struct {
    27  		result1 metrics.Gauge
    28  	}
    29  	withReturnsOnCall map[int]struct {
    30  		result1 metrics.Gauge
    31  	}
    32  	invocations      map[string][][]interface{}
    33  	invocationsMutex sync.RWMutex
    34  }
    35  
    36  func (fake *Gauge) Add(arg1 float64) {
    37  	fake.addMutex.Lock()
    38  	fake.addArgsForCall = append(fake.addArgsForCall, struct {
    39  		arg1 float64
    40  	}{arg1})
    41  	fake.recordInvocation("Add", []interface{}{arg1})
    42  	fake.addMutex.Unlock()
    43  	if fake.AddStub != nil {
    44  		fake.AddStub(arg1)
    45  	}
    46  }
    47  
    48  func (fake *Gauge) AddCallCount() int {
    49  	fake.addMutex.RLock()
    50  	defer fake.addMutex.RUnlock()
    51  	return len(fake.addArgsForCall)
    52  }
    53  
    54  func (fake *Gauge) AddCalls(stub func(float64)) {
    55  	fake.addMutex.Lock()
    56  	defer fake.addMutex.Unlock()
    57  	fake.AddStub = stub
    58  }
    59  
    60  func (fake *Gauge) AddArgsForCall(i int) float64 {
    61  	fake.addMutex.RLock()
    62  	defer fake.addMutex.RUnlock()
    63  	argsForCall := fake.addArgsForCall[i]
    64  	return argsForCall.arg1
    65  }
    66  
    67  func (fake *Gauge) Set(arg1 float64) {
    68  	fake.setMutex.Lock()
    69  	fake.setArgsForCall = append(fake.setArgsForCall, struct {
    70  		arg1 float64
    71  	}{arg1})
    72  	fake.recordInvocation("Set", []interface{}{arg1})
    73  	fake.setMutex.Unlock()
    74  	if fake.SetStub != nil {
    75  		fake.SetStub(arg1)
    76  	}
    77  }
    78  
    79  func (fake *Gauge) SetCallCount() int {
    80  	fake.setMutex.RLock()
    81  	defer fake.setMutex.RUnlock()
    82  	return len(fake.setArgsForCall)
    83  }
    84  
    85  func (fake *Gauge) SetCalls(stub func(float64)) {
    86  	fake.setMutex.Lock()
    87  	defer fake.setMutex.Unlock()
    88  	fake.SetStub = stub
    89  }
    90  
    91  func (fake *Gauge) SetArgsForCall(i int) float64 {
    92  	fake.setMutex.RLock()
    93  	defer fake.setMutex.RUnlock()
    94  	argsForCall := fake.setArgsForCall[i]
    95  	return argsForCall.arg1
    96  }
    97  
    98  func (fake *Gauge) With(arg1 ...string) metrics.Gauge {
    99  	fake.withMutex.Lock()
   100  	ret, specificReturn := fake.withReturnsOnCall[len(fake.withArgsForCall)]
   101  	fake.withArgsForCall = append(fake.withArgsForCall, struct {
   102  		arg1 []string
   103  	}{arg1})
   104  	fake.recordInvocation("With", []interface{}{arg1})
   105  	fake.withMutex.Unlock()
   106  	if fake.WithStub != nil {
   107  		return fake.WithStub(arg1...)
   108  	}
   109  	if specificReturn {
   110  		return ret.result1
   111  	}
   112  	fakeReturns := fake.withReturns
   113  	return fakeReturns.result1
   114  }
   115  
   116  func (fake *Gauge) WithCallCount() int {
   117  	fake.withMutex.RLock()
   118  	defer fake.withMutex.RUnlock()
   119  	return len(fake.withArgsForCall)
   120  }
   121  
   122  func (fake *Gauge) WithCalls(stub func(...string) metrics.Gauge) {
   123  	fake.withMutex.Lock()
   124  	defer fake.withMutex.Unlock()
   125  	fake.WithStub = stub
   126  }
   127  
   128  func (fake *Gauge) WithArgsForCall(i int) []string {
   129  	fake.withMutex.RLock()
   130  	defer fake.withMutex.RUnlock()
   131  	argsForCall := fake.withArgsForCall[i]
   132  	return argsForCall.arg1
   133  }
   134  
   135  func (fake *Gauge) WithReturns(result1 metrics.Gauge) {
   136  	fake.withMutex.Lock()
   137  	defer fake.withMutex.Unlock()
   138  	fake.WithStub = nil
   139  	fake.withReturns = struct {
   140  		result1 metrics.Gauge
   141  	}{result1}
   142  }
   143  
   144  func (fake *Gauge) WithReturnsOnCall(i int, result1 metrics.Gauge) {
   145  	fake.withMutex.Lock()
   146  	defer fake.withMutex.Unlock()
   147  	fake.WithStub = nil
   148  	if fake.withReturnsOnCall == nil {
   149  		fake.withReturnsOnCall = make(map[int]struct {
   150  			result1 metrics.Gauge
   151  		})
   152  	}
   153  	fake.withReturnsOnCall[i] = struct {
   154  		result1 metrics.Gauge
   155  	}{result1}
   156  }
   157  
   158  func (fake *Gauge) Invocations() map[string][][]interface{} {
   159  	fake.invocationsMutex.RLock()
   160  	defer fake.invocationsMutex.RUnlock()
   161  	fake.addMutex.RLock()
   162  	defer fake.addMutex.RUnlock()
   163  	fake.setMutex.RLock()
   164  	defer fake.setMutex.RUnlock()
   165  	fake.withMutex.RLock()
   166  	defer fake.withMutex.RUnlock()
   167  	copiedInvocations := map[string][][]interface{}{}
   168  	for key, value := range fake.invocations {
   169  		copiedInvocations[key] = value
   170  	}
   171  	return copiedInvocations
   172  }
   173  
   174  func (fake *Gauge) recordInvocation(key string, args []interface{}) {
   175  	fake.invocationsMutex.Lock()
   176  	defer fake.invocationsMutex.Unlock()
   177  	if fake.invocations == nil {
   178  		fake.invocations = map[string][][]interface{}{}
   179  	}
   180  	if fake.invocations[key] == nil {
   181  		fake.invocations[key] = [][]interface{}{}
   182  	}
   183  	fake.invocations[key] = append(fake.invocations[key], args)
   184  }
   185  
   186  var _ metrics.Gauge = new(Gauge)