rate

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Limit

type Limit float64

func Every

func Every(interval time.Duration) Limit

type Limiter

type Limiter struct {
	// contains filtered or unexported fields
}

func NewLimiter

func NewLimiter(rate Limit, burst numTokens) *Limiter

func (*Limiter) Allow

func (rl *Limiter) Allow() bool

func (*Limiter) AllowN

func (rl *Limiter) AllowN(n numTokens) bool

func (*Limiter) AllowStm

func (rl *Limiter) AllowStm(tx *stm.Tx) bool

func (*Limiter) Wait

func (rl *Limiter) Wait(ctx context.Context) error

func (*Limiter) WaitN

func (rl *Limiter) WaitN(ctx context.Context, n int) error

Jump to

Keyboard shortcuts

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