concurrent_limiter

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: GPL-3.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 ClientQueryLimiter

type ClientQueryLimiter struct {
	// contains filtered or unexported fields
}

func NewClientQueryLimiter

func NewClientQueryLimiter(maxQueries int) *ClientQueryLimiter

func (*ClientQueryLimiter) Acquire

func (l *ClientQueryLimiter) Acquire(key string) bool

func (*ClientQueryLimiter) Done

func (l *ClientQueryLimiter) Done(key string)

type ConcurrentLimiter

type ConcurrentLimiter struct {
	// contains filtered or unexported fields
}

ConcurrentLimiter is a soft limiter.

func NewConcurrentLimiter

func NewConcurrentLimiter(max int) *ConcurrentLimiter

NewConcurrentLimiter returns a ConcurrentLimiter, max must > 0.

func (*ConcurrentLimiter) Available

func (l *ConcurrentLimiter) Available() int

func (*ConcurrentLimiter) Done

func (l *ConcurrentLimiter) Done()

func (*ConcurrentLimiter) Max

func (l *ConcurrentLimiter) Max() int

func (*ConcurrentLimiter) Running

func (l *ConcurrentLimiter) Running() int32

func (*ConcurrentLimiter) Wait

func (l *ConcurrentLimiter) Wait() chan<- struct{}

Jump to

Keyboard shortcuts

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