// Code generated by counterfeiter. DO NOT EDIT.
package mock

import (
	"sync"

	"github.com/hyperledger/fabric/orderer/common/server"
)

type RateLimiter struct {
	LimitRateStub        func(string)
	limitRateMutex       sync.RWMutex
	limitRateArgsForCall []struct {
		arg1 string
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *RateLimiter) LimitRate(arg1 string) {
	fake.limitRateMutex.Lock()
	fake.limitRateArgsForCall = append(fake.limitRateArgsForCall, struct {
		arg1 string
	}{arg1})
	fake.recordInvocation("LimitRate", []interface{}{arg1})
	fake.limitRateMutex.Unlock()
	if fake.LimitRateStub != nil {
		fake.LimitRateStub(arg1)
	}
}

func (fake *RateLimiter) LimitRateCallCount() int {
	fake.limitRateMutex.RLock()
	defer fake.limitRateMutex.RUnlock()
	return len(fake.limitRateArgsForCall)
}

func (fake *RateLimiter) LimitRateCalls(stub func(string)) {
	fake.limitRateMutex.Lock()
	defer fake.limitRateMutex.Unlock()
	fake.LimitRateStub = stub
}

func (fake *RateLimiter) LimitRateArgsForCall(i int) string {
	fake.limitRateMutex.RLock()
	defer fake.limitRateMutex.RUnlock()
	argsForCall := fake.limitRateArgsForCall[i]
	return argsForCall.arg1
}

func (fake *RateLimiter) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.limitRateMutex.RLock()
	defer fake.limitRateMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *RateLimiter) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ server.RateLimiter = new(RateLimiter)
