windowlimiter

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResetLimiter

type ResetLimiter interface {
	Threshold(ctx context.Context) uint64
}

type WindowLimiter

type WindowLimiter interface {
	Start(ctx context.Context, delay int64) error
	Inc()
	TrySetThreshold(ctx context.Context, startTime time.Time) error
	Duration() time.Duration
	TooFast(ctx context.Context) (uint64, error)
	Threshold(ctx context.Context) uint64
	Temp(ctx context.Context) float64
	SetResetLimiter(resetLimiter ResetLimiter)
}

func NewLimiter

func NewLimiter(duration, resetDuration time.Duration, id string, repo repo, logger log.Logger) WindowLimiter

Jump to

Keyboard shortcuts

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