Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
InfinityTokenBucket = NewInfinity()
)
Functions ¶
This section is empty.
Types ¶
type TokenBucket ¶
type TokenBucket interface { // TryAccept returns true if a token is taken immediately. Otherwise, // it returns false. TryAcquire() bool // Release add a token back to the lock Release() // Resize changes the max in flight lock's capacity Resize(n uint32) }
func New ¶
func New(size uint32) TokenBucket
func NewInfinity ¶
func NewInfinity() TokenBucket
type TokenBucketType ¶
type TokenBucketType string
const ( Atomic TokenBucketType = "atomic" Channel TokenBucketType = "channel" Mutex TokenBucketType = "mutex" Infinity TokenBucketType = "infinity" )
Click to show internal directories.
Click to hide internal directories.