qpslimiter

package
Version: v0.0.0-...-5e0f84c Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRate = 2147483647
)

constant qps default rate

Variables

This section is empty.

Functions

func GetQPSRate

func GetQPSRate(rateConfig string) (int, bool)

GetQPSRate get qps rate

func GetSpecificKey

func GetSpecificKey(sourceName, serviceType, serviceName, schemaID, OperationID string) string

GetSpecificKey get specific key

Types

type OperationMeta

type OperationMeta struct {
	MicroServiceName       string
	SchemaQualifiedName    string
	OperationQualifiedName string
}

OperationMeta operation meta struct

func InitSchemaOperations

func InitSchemaOperations(i *invocation.Invocation) *OperationMeta

InitSchemaOperations initialize schema operations

func (*OperationMeta) GetMicroServiceName

func (op *OperationMeta) GetMicroServiceName() string

GetMicroServiceName get micro-service name

func (*OperationMeta) GetMicroServiceSchemaOpQualifiedName

func (op *OperationMeta) GetMicroServiceSchemaOpQualifiedName() string

GetMicroServiceSchemaOpQualifiedName get micro-service schema operation qualified name

func (*OperationMeta) GetSchemaQualifiedName

func (op *OperationMeta) GetSchemaQualifiedName() string

GetSchemaQualifiedName get schema qualified name

type QPSLimiterMap

type QPSLimiterMap struct {
	KeyMap map[string]ratelimit.Limiter
	sync.RWMutex
}

QPSLimiterMap qps limiter map struct

func GetQPSTrafficLimiter

func GetQPSTrafficLimiter() *QPSLimiterMap

GetQPSTrafficLimiter get qps traffic limiter

func (*QPSLimiterMap) DeleteRateLimiter

func (qpsL *QPSLimiterMap) DeleteRateLimiter(key string)

DeleteRateLimiter delete rate limiter

func (*QPSLimiterMap) GetQPSRateWithPriority

func (qpsL *QPSLimiterMap) GetQPSRateWithPriority(op *OperationMeta) (int, string)

GetQPSRateWithPriority get qps rate with priority

func (*QPSLimiterMap) ProcessDefaultRateRpsTokenReq

func (qpsL *QPSLimiterMap) ProcessDefaultRateRpsTokenReq(key string, qpsRate int)

ProcessDefaultRateRpsTokenReq process default rate pps token request

func (*QPSLimiterMap) ProcessQPSTokenReq

func (qpsL *QPSLimiterMap) ProcessQPSTokenReq(key string, qpsRate int)

ProcessQPSTokenReq process qps token request

func (*QPSLimiterMap) UpdateRateLimit

func (qpsL *QPSLimiterMap) UpdateRateLimit(key string, value interface{})

UpdateRateLimit update rate limit

Jump to

Keyboard shortcuts

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