Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket represents a token bucket.
func New ¶
New initiates a token bucket with a maximum capacity that refills at a certain interval.
func (*Bucket) Delay ¶
TODO: accurate compute for multiple takes
func (*Bucket) Empty ¶
Empty checks whether the bucket is currently empty.
func (*Bucket) SetInterval ¶
SetInterval changes the refill interval. Mostly useful for testing.
Click to show internal directories.
Click to hide internal directories.