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