Documentation ¶
Overview ¶
Package qps supply functionality about QPS for example rate limiting
Index ¶
Constants ¶
View Source
const (
DefaultRate = 2147483647
)
constant qps default rate
View Source
const Prefix = "cse.flowcontrol"
Prefix is const
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsumerKeys ¶
type ConsumerKeys struct { MicroServiceName string SchemaQualifiedName string OperationQualifiedName string }
ConsumerKeys contain consumer keys
func GetConsumerKey ¶
func GetConsumerKey(sourceName, serviceName, schemaID, OperationID string) *ConsumerKeys
GetConsumerKey get specific key for consumer
func (*ConsumerKeys) GetMicroServiceName ¶
func (op *ConsumerKeys) GetMicroServiceName() string
GetMicroServiceName get micro-service name
func (*ConsumerKeys) GetMicroServiceSchemaOpQualifiedName ¶
func (op *ConsumerKeys) GetMicroServiceSchemaOpQualifiedName() string
GetMicroServiceSchemaOpQualifiedName get micro-service schema operation qualified name
func (*ConsumerKeys) GetSchemaQualifiedName ¶
func (op *ConsumerKeys) GetSchemaQualifiedName() string
GetSchemaQualifiedName get schema qualified name
type ProviderKeys ¶
ProviderKeys contain provider keys
func GetProviderKey ¶
func GetProviderKey(sourceServiceName string) *ProviderKeys
GetProviderKey get specific key for provider
type RateLimiters ¶
RateLimiters qps limiter map struct
func (*RateLimiters) DeleteRateLimiter ¶
func (qpsL *RateLimiters) DeleteRateLimiter(key string)
DeleteRateLimiter delete rate limiter
func (*RateLimiters) GetQPSRateWithPriority ¶
func (qpsL *RateLimiters) GetQPSRateWithPriority(cmd ...string) (int, string)
GetQPSRateWithPriority get qps rate with priority
func (*RateLimiters) TryAccept ¶
func (qpsL *RateLimiters) TryAccept(key string, qpsRate int) bool
TryAccept process qps token request
func (*RateLimiters) UpdateRateLimit ¶
func (qpsL *RateLimiters) UpdateRateLimit(key string, value interface{})
UpdateRateLimit update or add rate limiter
Click to show internal directories.
Click to hide internal directories.