Versions in this module Expand all Collapse all v1 v1.0.2 Oct 2, 2019 v1.0.1 Oct 26, 2017 Changes in this version + func Reader(r io.Reader, bucket *Bucket) io.Reader + func Writer(w io.Writer, bucket *Bucket) io.Writer + type Bucket struct + func NewBucket(fillInterval time.Duration, capacity int64) *Bucket + func NewBucketWithClock(fillInterval time.Duration, capacity int64, clock Clock) *Bucket + func NewBucketWithQuantum(fillInterval time.Duration, capacity, quantum int64) *Bucket + func NewBucketWithQuantumAndClock(fillInterval time.Duration, capacity, quantum int64, clock Clock) *Bucket + func NewBucketWithRate(rate float64, capacity int64) *Bucket + func NewBucketWithRateAndClock(rate float64, capacity int64, clock Clock) *Bucket + func (tb *Bucket) Available() int64 + func (tb *Bucket) Capacity() int64 + func (tb *Bucket) Rate() float64 + func (tb *Bucket) Take(count int64) time.Duration + func (tb *Bucket) TakeAvailable(count int64) int64 + func (tb *Bucket) TakeMaxDuration(count int64, maxWait time.Duration) (time.Duration, bool) + func (tb *Bucket) Wait(count int64) + func (tb *Bucket) WaitMaxDuration(count int64, maxWait time.Duration) bool + type Clock interface + Now func() time.Time + Sleep func(d time.Duration)