Documentation
¶
Overview ¶
Package limiter provides simple rate limiting primitives backed by a synchronous token bucket.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter interface {
Allow() bool
}
Limiter is used to abstract the rate limiter implementation to only expose the needed function for rate limiting. This is for example useful for testing, allowing us to use a modified rate limiter tuned for testing through the same interface.
func NewTokenTicker ¶
NewTokenTicker is a utility function that allocates a token ticker, initializes necessary fields and returns it
Click to show internal directories.
Click to hide internal directories.