Documentation
¶
Overview ¶
Reference uber ratelimit, the different is support no wait take func
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) SetLimit(rate int) SetBurst(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) EXPECT ¶
func (m *MockLeakyBucket) EXPECT() *MockLeakyBucketMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLeakyBucket) SetBurst ¶
func (m *MockLeakyBucket) SetBurst(burst int)
SetBurst mocks base method.
func (*MockLeakyBucket) SetLimit ¶
func (m *MockLeakyBucket) SetLimit(rate int)
SetLimit 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) SetBurst ¶
func (mr *MockLeakyBucketMockRecorder) SetBurst(burst interface{}) *gomock.Call
SetBurst indicates an expected call of SetBurst.
func (*MockLeakyBucketMockRecorder) SetLimit ¶
func (mr *MockLeakyBucketMockRecorder) SetLimit(rate interface{}) *gomock.Call
SetLimit indicates an expected call of SetLimit.
Click to show internal directories.
Click to hide internal directories.