Documentation ¶
Index ¶
- Constants
- func GetQPSRate(rateConfig string) (int, bool)
- func GetSpecificKey(sourceName, serviceType, serviceName, schemaID, OperationID string) string
- type Clock
- type Limiter
- type OperationMeta
- type Option
- type QPSLimiterMap
- func (qpsL *QPSLimiterMap) DeleteRateLimiter(key string)
- func (qpsL *QPSLimiterMap) GetQPSRateWithPriority(op *OperationMeta) (int, string)
- func (qpsL *QPSLimiterMap) ProcessDefaultRateRpsTokenReq(key string, qpsRate int)
- func (qpsL *QPSLimiterMap) ProcessQPSTokenReq(key string, qpsRate int)
- func (qpsL *QPSLimiterMap) UpdateRateLimit(key string, value interface{})
Constants ¶
const (
DefaultRate = 2147483647
)
constant qps default rate
Variables ¶
This section is empty.
Functions ¶
func GetSpecificKey ¶
GetSpecificKey get specific key
Types ¶
type Clock ¶
Clock is the minimum necessary interface to instantiate a rate limiter with a clock or mock clock, compatible with clocks created using github.com/andres-erbsen/clock.
type Limiter ¶
Limiter is used to rate-limit some process, possibly across goroutines. The process is expected to call Take() before every iteration, which may block to throttle the goroutine.
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 Option ¶
type Option func(l *limiter)
Option configures a Limiter.
var WithoutSlack Option = withoutSlackOption
WithoutSlack is an option for ratelimit.New that initializes the limiter without any initial tolerance for bursts of traffic.
type QPSLimiterMap ¶
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