util

package
Version: v0.0.0-...-bfdbfb3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketRateLimiter

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

BucketRateLimiter implements the RateLimiter interface using standard rate.Limiter.

func NewBucketRateLimiter

func NewBucketRateLimiter(r rate.Limit, burst int) *BucketRateLimiter

NewBucketRateLimiter creates a new BucketRateLimiter instance.

func (*BucketRateLimiter) Allow

func (l *BucketRateLimiter) Allow(item interface{}) bool

Allow returns if drops the given item.

type RateLimiter

type RateLimiter interface {
	Allow(item interface{}) bool
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL