limiter

package
v0.0.0-...-dde7ba0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	B float64
	R float64
	// contains filtered or unexported fields
}

func NewBucket

func NewBucket(rate float64, burst int) *Bucket

func (*Bucket) Allow

func (b *Bucket) Allow() (bool, error)

func (*Bucket) AllowN

func (b *Bucket) AllowN(n int) (bool, error)

type Limiter

type Limiter interface {
	Allow() (bool, error)
}

type SimpleLimiter

type SimpleLimiter interface {
	Allow() bool
}

type SimpleLimiterAdapter

type SimpleLimiterAdapter struct {
	SimpleLimiter
}

func NewSimpleLimiterAdapter

func NewSimpleLimiterAdapter(l SimpleLimiter) *SimpleLimiterAdapter

func (SimpleLimiterAdapter) Allow

func (s SimpleLimiterAdapter) Allow() (bool, error)

Jump to

Keyboard shortcuts

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