throttle

package
v1.4.0-rc1.0...-b3f6615 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
	After(d time.Duration) <-chan time.Time
}

Clock observes time

type SharedRateLimiter

type SharedRateLimiter struct {
	// Time is how this rate limiter observes time
	Time Clock
	// Limit is the total limit of throughput for all clients
	Limit int
	// InactivityTimeout is the inactivity time after which a client is pruned from memory
	InactivityTimeout time.Duration
	// contains filtered or unexported fields
}

func (*SharedRateLimiter) LimitRate

func (srl *SharedRateLimiter) LimitRate(client string)

func (*SharedRateLimiter) Stop

func (srl *SharedRateLimiter) Stop() error

Stop stops the shared rate limiter. Not thread safe.

Jump to

Keyboard shortcuts

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