ratelimit

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FixWindowLimiter

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

func NewFixWindowLimiter

func NewFixWindowLimiter(interval time.Duration, rate int64) *FixWindowLimiter

func (*FixWindowLimiter) LimitUnary

type FixWindowLimiterOptions

type FixWindowLimiterOptions func(l *FixWindowLimiter)

func FixWindowMarkFailed

func FixWindowMarkFailed() FixWindowLimiterOptions

type LeakyBucketLimiter

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

func NewLeakyBucketLimiter

func NewLeakyBucketLimiter(interval time.Duration) *LeakyBucketLimiter

func (*LeakyBucketLimiter) Close

func (l *LeakyBucketLimiter) Close() error

func (*LeakyBucketLimiter) LimitUnary

type LeakyBucketLimiterOptions

type LeakyBucketLimiterOptions func(l *LeakyBucketLimiter)

func LeakyBucketMarkFailed

func LeakyBucketMarkFailed() LeakyBucketLimiterOptions

type Limiter

type Limiter interface {
	LimitUnary() grpc.UnaryServerInterceptor
}

type RedisFixWindowLimiter

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

func NewRedisFixWindowLimiter

func NewRedisFixWindowLimiter(client redis.Cmdable, service string,
	interval time.Duration, rate int) *RedisFixWindowLimiter

func NewRedisSlideWindowLimiter

func NewRedisSlideWindowLimiter(client redis.Cmdable, service string,
	interval time.Duration, rate int) *RedisFixWindowLimiter

func (*RedisFixWindowLimiter) LimitUnary

type RedisFixWindowLimiterOptions

type RedisFixWindowLimiterOptions func(l *RedisFixWindowLimiter)

func RedisFixWindowMarkFailed

func RedisFixWindowMarkFailed() RedisFixWindowLimiterOptions

type RedisSlideWindowLimiter

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

func (*RedisSlideWindowLimiter) LimitUnary

type RedisSlideWindowLimiterOptions

type RedisSlideWindowLimiterOptions func(l *RedisSlideWindowLimiter)

func RedisSlideWindowMarkFailed

func RedisSlideWindowMarkFailed() RedisSlideWindowLimiterOptions

type SlideWindowLimiter

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

func NewSlideWindowLimiter

func NewSlideWindowLimiter(interval time.Duration, rate int) *SlideWindowLimiter

func (*SlideWindowLimiter) LimitUnary

type SlideWindowLimiterOptions

type SlideWindowLimiterOptions func(l *SlideWindowLimiter)

func SlideWindowMarkFailed

func SlideWindowMarkFailed() SlideWindowLimiterOptions

type TokenBucketLimiter

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

func NewTokenBucketLimiter

func NewTokenBucketLimiter(capacity int, interval time.Duration) *TokenBucketLimiter

func (*TokenBucketLimiter) Close

func (l *TokenBucketLimiter) Close() error

func (*TokenBucketLimiter) LimitUnary

type TokenBucketLimiterOptions

type TokenBucketLimiterOptions func(l *TokenBucketLimiter)

func TokenBucketMarkFailed

func TokenBucketMarkFailed() TokenBucketLimiterOptions

Jump to

Keyboard shortcuts

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