Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorFull is returned when the amount requested to add exceeds the remaining space in the bucket. ErrorFull = errors.New("add exceeds free capacity") )
Functions ¶
This section is empty.
Types ¶
type BucketI ¶
type BucketI interface { // Capacity of the bucket. Capacity() uint // Remaining space in the bucket. Remaining() uint // Reset returns when the bucket will be drained. Reset() time.Time // Add to the bucket. Returns bucket state after adding. Add(uint) (BucketState, error) }
BucketI interface for interacting with leaky buckets: https://en.wikipedia.org/wiki/Leaky_bucket
type BucketState ¶
BucketState is a snapshot of a bucket's properties.
Click to show internal directories.
Click to hide internal directories.