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

import (
	"sync"

	"code.cloudfoundry.org/guardian/throttle"
)

type FakeMemoryProvider struct {
	TotalMemoryStub        func() (uint64, error)
	totalMemoryMutex       sync.RWMutex
	totalMemoryArgsForCall []struct {
	}
	totalMemoryReturns struct {
		result1 uint64
		result2 error
	}
	totalMemoryReturnsOnCall map[int]struct {
		result1 uint64
		result2 error
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeMemoryProvider) TotalMemory() (uint64, error) {
	fake.totalMemoryMutex.Lock()
	ret, specificReturn := fake.totalMemoryReturnsOnCall[len(fake.totalMemoryArgsForCall)]
	fake.totalMemoryArgsForCall = append(fake.totalMemoryArgsForCall, struct {
	}{})
	stub := fake.TotalMemoryStub
	fakeReturns := fake.totalMemoryReturns
	fake.recordInvocation("TotalMemory", []interface{}{})
	fake.totalMemoryMutex.Unlock()
	if stub != nil {
		return stub()
	}
	if specificReturn {
		return ret.result1, ret.result2
	}
	return fakeReturns.result1, fakeReturns.result2
}

func (fake *FakeMemoryProvider) TotalMemoryCallCount() int {
	fake.totalMemoryMutex.RLock()
	defer fake.totalMemoryMutex.RUnlock()
	return len(fake.totalMemoryArgsForCall)
}

func (fake *FakeMemoryProvider) TotalMemoryCalls(stub func() (uint64, error)) {
	fake.totalMemoryMutex.Lock()
	defer fake.totalMemoryMutex.Unlock()
	fake.TotalMemoryStub = stub
}

func (fake *FakeMemoryProvider) TotalMemoryReturns(result1 uint64, result2 error) {
	fake.totalMemoryMutex.Lock()
	defer fake.totalMemoryMutex.Unlock()
	fake.TotalMemoryStub = nil
	fake.totalMemoryReturns = struct {
		result1 uint64
		result2 error
	}{result1, result2}
}

func (fake *FakeMemoryProvider) TotalMemoryReturnsOnCall(i int, result1 uint64, result2 error) {
	fake.totalMemoryMutex.Lock()
	defer fake.totalMemoryMutex.Unlock()
	fake.TotalMemoryStub = nil
	if fake.totalMemoryReturnsOnCall == nil {
		fake.totalMemoryReturnsOnCall = make(map[int]struct {
			result1 uint64
			result2 error
		})
	}
	fake.totalMemoryReturnsOnCall[i] = struct {
		result1 uint64
		result2 error
	}{result1, result2}
}

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

func (fake *FakeMemoryProvider) 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 _ throttle.MemoryProvider = new(FakeMemoryProvider)
