interfaces

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	Allow() bool
	AllowN(t time.Time, n int) bool
	Burst() int
	Limit() rate.Limit
	Reserve() Reservation
	ReserveN(t time.Time, n int) Reservation
	SetBurst(newBurst int)
	SetBurstAt(t time.Time, newBurst int)
	SetLimit(newLimit rate.Limit)
	SetLimitAt(t time.Time, newLimit rate.Limit)
	Tokens() float64
	TokensAt(t time.Time) float64
	Wait(ctx context.Context) (err error)
	WaitN(ctx context.Context, n int) (err error)
}

type Reservation

type Reservation interface {
	Cancel()
	CancelAt(t time.Time)
	Delay() time.Duration
	DelayFrom(t time.Time) time.Duration
	OK() bool
}

Jump to

Keyboard shortcuts

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