ratelimit

package
v3.60.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewV2ToV1RateLimit

func NewV2ToV1RateLimit(r V2, stats metrics.Type) types.RateLimit

NewV2ToV1RateLimit wraps a ratelimit.V2 with a struct that implements types.RateLimit.

Types

type V2

type V2 interface {
	// Access the rate limited resource. Returns a duration or an error if the
	// rate limit check fails. The returned duration is either zero (meaning the
	// resource can be accessed) or a reasonable length of time to wait before
	// requesting again.
	Access(ctx context.Context) (time.Duration, error)

	// Close the component, blocks until either the underlying resources are
	// cleaned up or the context is cancelled. Returns an error if the context
	// is cancelled.
	Close(ctx context.Context) error
}

V2 is a simpler interface to implement than types.RateLimit.

Jump to

Keyboard shortcuts

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