github.com/chenbh/concourse/v6@v6.4.2/atc/lidar/lidarfakes/fake_rate_calculator.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package lidarfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/chenbh/concourse/v6/atc/lidar"
     8  )
     9  
    10  type FakeRateCalculator struct {
    11  	RateLimiterStub        func() (lidar.Limiter, error)
    12  	rateLimiterMutex       sync.RWMutex
    13  	rateLimiterArgsForCall []struct {
    14  	}
    15  	rateLimiterReturns struct {
    16  		result1 lidar.Limiter
    17  		result2 error
    18  	}
    19  	rateLimiterReturnsOnCall map[int]struct {
    20  		result1 lidar.Limiter
    21  		result2 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *FakeRateCalculator) RateLimiter() (lidar.Limiter, error) {
    28  	fake.rateLimiterMutex.Lock()
    29  	ret, specificReturn := fake.rateLimiterReturnsOnCall[len(fake.rateLimiterArgsForCall)]
    30  	fake.rateLimiterArgsForCall = append(fake.rateLimiterArgsForCall, struct {
    31  	}{})
    32  	fake.recordInvocation("RateLimiter", []interface{}{})
    33  	fake.rateLimiterMutex.Unlock()
    34  	if fake.RateLimiterStub != nil {
    35  		return fake.RateLimiterStub()
    36  	}
    37  	if specificReturn {
    38  		return ret.result1, ret.result2
    39  	}
    40  	fakeReturns := fake.rateLimiterReturns
    41  	return fakeReturns.result1, fakeReturns.result2
    42  }
    43  
    44  func (fake *FakeRateCalculator) RateLimiterCallCount() int {
    45  	fake.rateLimiterMutex.RLock()
    46  	defer fake.rateLimiterMutex.RUnlock()
    47  	return len(fake.rateLimiterArgsForCall)
    48  }
    49  
    50  func (fake *FakeRateCalculator) RateLimiterCalls(stub func() (lidar.Limiter, error)) {
    51  	fake.rateLimiterMutex.Lock()
    52  	defer fake.rateLimiterMutex.Unlock()
    53  	fake.RateLimiterStub = stub
    54  }
    55  
    56  func (fake *FakeRateCalculator) RateLimiterReturns(result1 lidar.Limiter, result2 error) {
    57  	fake.rateLimiterMutex.Lock()
    58  	defer fake.rateLimiterMutex.Unlock()
    59  	fake.RateLimiterStub = nil
    60  	fake.rateLimiterReturns = struct {
    61  		result1 lidar.Limiter
    62  		result2 error
    63  	}{result1, result2}
    64  }
    65  
    66  func (fake *FakeRateCalculator) RateLimiterReturnsOnCall(i int, result1 lidar.Limiter, result2 error) {
    67  	fake.rateLimiterMutex.Lock()
    68  	defer fake.rateLimiterMutex.Unlock()
    69  	fake.RateLimiterStub = nil
    70  	if fake.rateLimiterReturnsOnCall == nil {
    71  		fake.rateLimiterReturnsOnCall = make(map[int]struct {
    72  			result1 lidar.Limiter
    73  			result2 error
    74  		})
    75  	}
    76  	fake.rateLimiterReturnsOnCall[i] = struct {
    77  		result1 lidar.Limiter
    78  		result2 error
    79  	}{result1, result2}
    80  }
    81  
    82  func (fake *FakeRateCalculator) Invocations() map[string][][]interface{} {
    83  	fake.invocationsMutex.RLock()
    84  	defer fake.invocationsMutex.RUnlock()
    85  	fake.rateLimiterMutex.RLock()
    86  	defer fake.rateLimiterMutex.RUnlock()
    87  	copiedInvocations := map[string][][]interface{}{}
    88  	for key, value := range fake.invocations {
    89  		copiedInvocations[key] = value
    90  	}
    91  	return copiedInvocations
    92  }
    93  
    94  func (fake *FakeRateCalculator) recordInvocation(key string, args []interface{}) {
    95  	fake.invocationsMutex.Lock()
    96  	defer fake.invocationsMutex.Unlock()
    97  	if fake.invocations == nil {
    98  		fake.invocations = map[string][][]interface{}{}
    99  	}
   100  	if fake.invocations[key] == nil {
   101  		fake.invocations[key] = [][]interface{}{}
   102  	}
   103  	fake.invocations[key] = append(fake.invocations[key], args)
   104  }
   105  
   106  var _ lidar.RateCalculator = new(FakeRateCalculator)