Registry / utility / cockroachdb-tokenbucket

cockroachdb-tokenbucket

JSON →
library0.0.0-20230807174530-cc333fc44b06gogounverified

Package tokenbucket implements a token bucket rate limiter.

go get github.com/cockroachdb/tokenbucket
INSTALL
IMPORT
SIG · COCKROACHDB-TOKENB
C
cockroachdb-tokenbucket
utilitygov0.0.0-20230807174530-cc333fc44b06
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tokenbucket
github.com/cockroachdb/tokenbucket

Creates a token bucket with capacity 10 and refill rate 1 per second, then tries to consume one token.

package main import ( "fmt" "time" "github.com/cockroachdb/tokenbucket" ) func main() { tb := tokenbucket.New(10, time.Second) fmt.Println(tb.TryConsume(1)) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.0.0-20230807174530-cc333fc44b06latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
cockroachdb-tokenbucket — go get cockroachdb-tokenbucket · libregistry