maxinflight

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL