Documentation
¶
Overview ¶
Package leakybucket provides a leaky bucket implementation with support for various backends.
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 Bucket ¶
type Bucket 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. MUST return bucket state after adding, even if an error was encountered
Add(uint) (BucketState, error)
}
Bucket interface for interacting with leaky buckets: https://en.wikipedia.org/wiki/Leaky_bucket
type BucketState ¶
BucketState is a snapshot of a bucket's properties.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dynamodb provides a leaky bucket implementation backed by AWS DynamoDB
|
Package dynamodb provides a leaky bucket implementation backed by AWS DynamoDB |
|
Package memory provides a leaky bucket implementation backed by an in-memory data store.
|
Package memory provides a leaky bucket implementation backed by an in-memory data store. |
|
Package redis provides a leaky bucket implementation backed by redis.
|
Package redis provides a leaky bucket implementation backed by redis. |
|
Package test provides generic tests of the leakybucket interface.
|
Package test provides generic tests of the leakybucket interface. |
Click to show internal directories.
Click to hide internal directories.
