Documentation ¶
Index ¶
- type Config
- type LeakyBucket
- func (l *LeakyBucket) GetAmountInfos() []ratelimiter.AmountInfo
- func (l *LeakyBucket) GetQuota(curTimeMs int64, token uint32) *model.QuotaResponse
- func (l *LeakyBucket) GetQuotaUsed(curTimeMilli int64) ratelimiter.UsageInfo
- func (l *LeakyBucket) OnRemoteUpdate(remoteQuota ratelimiter.RemoteQuotaResult)
- func (l *LeakyBucket) Release()
- type RateLimiterUniformRate
- func (g *RateLimiterUniformRate) Destroy() error
- func (g *RateLimiterUniformRate) Init(ctx *plugin.InitContext) error
- func (g *RateLimiterUniformRate) InitQuota(criteria *ratelimiter.InitCriteria) ratelimiter.QuotaBucket
- func (g *RateLimiterUniformRate) IsEnable(cfg config.Configuration) bool
- func (g *RateLimiterUniformRate) Name() string
- func (g *RateLimiterUniformRate) Type() common.Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LeakyBucket ¶ added in v1.2.0
type LeakyBucket struct {
// contains filtered or unexported fields
}
LeakyBucket 远程配额分配的算法桶
func (*LeakyBucket) GetAmountInfos ¶ added in v1.2.0
func (l *LeakyBucket) GetAmountInfos() []ratelimiter.AmountInfo
GetAmountInfos 获取规则的限流阈值信息
func (*LeakyBucket) GetQuota ¶ added in v1.2.0
func (l *LeakyBucket) GetQuota(curTimeMs int64, token uint32) *model.QuotaResponse
GetQuota 在令牌桶/漏桶中进行单个配额的划扣,并返回本次分配的结果
func (*LeakyBucket) GetQuotaUsed ¶ added in v1.2.0
func (l *LeakyBucket) GetQuotaUsed(curTimeMilli int64) ratelimiter.UsageInfo
GetQuotaUsed 拉取本地使用配额情况以供上报
func (*LeakyBucket) OnRemoteUpdate ¶ added in v1.2.0
func (l *LeakyBucket) OnRemoteUpdate(remoteQuota ratelimiter.RemoteQuotaResult)
OnRemoteUpdate 远程配额更新
func (*LeakyBucket) Release ¶ added in v1.2.0
func (l *LeakyBucket) Release()
Release 释放配额(仅对于并发数限流有用)
type RateLimiterUniformRate ¶
type RateLimiterUniformRate struct { *plugin.PluginBase // contains filtered or unexported fields }
RateLimiterUniformRate 基于匀速排队策略的限流控制器
func (*RateLimiterUniformRate) Destroy ¶
func (g *RateLimiterUniformRate) Destroy() error
Destroy 销毁插件,可用于释放资源
func (*RateLimiterUniformRate) Init ¶
func (g *RateLimiterUniformRate) Init(ctx *plugin.InitContext) error
Init 初始化插件
func (*RateLimiterUniformRate) InitQuota ¶
func (g *RateLimiterUniformRate) InitQuota(criteria *ratelimiter.InitCriteria) ratelimiter.QuotaBucket
InitQuota 初始化并创建限流窗口 主流程会在首次调用,以及规则对象变更的时候,调用该方法
func (*RateLimiterUniformRate) IsEnable ¶
func (g *RateLimiterUniformRate) IsEnable(cfg config.Configuration) bool
IsEnable enable ?
func (*RateLimiterUniformRate) Name ¶
func (g *RateLimiterUniformRate) Name() string
Name 插件名,一个类型下插件名唯一
Click to show internal directories.
Click to hide internal directories.