helpers

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiLimiter added in v1.8.0

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

ApiLimiter allows to rate limit API calls

func NewApiLimiter added in v1.8.0

func NewApiLimiter(metrics MetricsAPI, rateLimit float64, burst int) *ApiLimiter

NewApiLimiter returns a new API limiter with the specific rate limit and burst configuration. The MetricsAPI interface is called to allow for metrics accounting.

func (*ApiLimiter) Limit added in v1.8.0

func (l *ApiLimiter) Limit(ctx context.Context, operation string)

Limit applies the rate limiting configuration for the given operation

type