rate

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 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 Limit

type Limit interface {
	Wait(ctx context.Context) (err error)
}

Limit is partially representing standard lib's rate limiter

type LimitFactory

type LimitFactory interface {
	Create() Limit
}

LimitFactory is an interface for creating per-connection rate limiters

type Limiter

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

Limiter is wrapper around golang's rate.Limit for more balanced rate limiting among multiple connections

func NewRateLimiter

func NewRateLimiter(freq time.Duration, burstSize int) *Limiter

NewRateLimiter returns a new Limiter

func (*Limiter) Create

func (c *Limiter) Create() Limit

Create returns a new standard lib's rate limiter for each connectin with a given frequency and burstSize

Jump to

Keyboard shortcuts

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