rate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 6 Imported by: 1

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

The Limit that permits one token every interval. An interval of zero or less is unlimited.

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