Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

tokenbucket source pure

Variables 1

Functions 1

func New

1func New(capacity *u256.Uint, refillRate *u256.Uint, now *u256.Uint) (*TokenBucket, error)
source

Types 1

type TokenBucket

struct
1type TokenBucket struct {
2	Capacity   *u256.Uint
3	Available  *u256.Uint
4	RefillRate *u256.Uint
5	LastRefill *u256.Uint
6}
source

Methods on TokenBucket

func RateLimit

method on TokenBucket
1func (tb *TokenBucket) RateLimit(amount *u256.Uint, now *u256.Uint) error
source

func Refill

method on TokenBucket
1func (tb *TokenBucket) Refill(now *u256.Uint)
source

func Update

method on TokenBucket
1func (tb *TokenBucket) Update(capacity *u256.Uint, refillRate *u256.Uint, reset bool) error
source

Imports 2

Source Files 2