throttle

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultiOperationMatch

func NewMultiOperationMatch(strs ...string) string

NewMultiOperationMatch will create a multi operation matching.

Types

type OperationLimiter

type OperationLimiter struct {
	Operation  string
	RefillRate rate.Limit
	Burst      int
	// contains filtered or unexported fields
}

OperationLimiter defines the specs of an operation limiter.

func (*OperationLimiter) Match

func (o *OperationLimiter) Match(r *request.Request) (bool, error)

Match will match a request.

func (*OperationLimiter) Wait

func (o *OperationLimiter) Wait(r *request.Request) error

Wait will wait on a request.

type ServiceLimiter

type ServiceLimiter []*OperationLimiter

ServiceLimiter defines a buffer of operation limiters.

func (ServiceLimiter) LimitRequest

func (s ServiceLimiter) LimitRequest(r *request.Request)

LimitRequest will limit a request.

func (ServiceLimiter) ReviewResponse

func (s ServiceLimiter) ReviewResponse(r *request.Request)

ReviewResponse will review the limits of a Request's response.

type ServiceLimiters

type ServiceLimiters map[string]*ServiceLimiter

ServiceLimiters defines a mapping of service limiters.

Jump to

Keyboard shortcuts

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