leakybucket

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package leakybucket is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLimiter

func NewLimiter(client *redis.Client) *leakyBucketLimiter

Types

type LeakyBucket

type LeakyBucket interface {
	Allow(ctx context.Context, key string, requestCount int) (bool, error)
	SetRate(rate int)
	SetVolume(burst int)
}

func NewLeakyBucket

func NewLeakyBucket(rate, volume int, client *redis.Client, opts ...Option) LeakyBucket

type MockLeakyBucket

type MockLeakyBucket struct {
	// contains filtered or unexported fields
}

MockLeakyBucket is a mock of LeakyBucket interface.

func NewMockLeakyBucket

func NewMockLeakyBucket(ctrl *gomock.Controller) *MockLeakyBucket

NewMockLeakyBucket creates a new mock instance.

func (*MockLeakyBucket) Allow

func (m *MockLeakyBucket) Allow(ctx context.Context, key string, requestCount int) (bool, error)

Allow mocks base method.

func (*MockLeakyBucket) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLeakyBucket) SetRate added in v1.0.7

func (m *MockLeakyBucket) SetRate(rate int)

SetRate mocks base method.

func (*MockLeakyBucket) SetVolume added in v1.0.7

func (m *MockLeakyBucket) SetVolume(burst int)

SetVolume mocks base method.

type MockLeakyBucketMockRecorder

type MockLeakyBucketMockRecorder struct {
	// contains filtered or unexported fields
}

MockLeakyBucketMockRecorder is the mock recorder for MockLeakyBucket.

func (*MockLeakyBucketMockRecorder) Allow

func (mr *MockLeakyBucketMockRecorder) Allow(ctx, key, requestCount interface{}) *gomock.Call

Allow indicates an expected call of Allow.

func (*MockLeakyBucketMockRecorder) SetRate added in v1.0.7

func (mr *MockLeakyBucketMockRecorder) SetRate(rate interface{}) *gomock.Call

SetRate indicates an expected call of SetRate.

func (*MockLeakyBucketMockRecorder) SetVolume added in v1.0.7

func (mr *MockLeakyBucketMockRecorder) SetVolume(burst interface{}) *gomock.Call

SetVolume indicates an expected call of SetVolume.

type Option

type Option func(o *option)

func WithClock

func WithClock(clock clock.Clock) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL