unirate

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxQueuingTime *time.Duration `yaml:"maxQueuingTime" json:"maxQueuingTime"`
}

Config 匀速排队限流器配置

func (*Config) SetDefault

func (c *Config) SetDefault()

SetDefault 设置默认值

func (*Config) Verify

func (c *Config) Verify() error

Verify 校验配置值

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

Init 初始化插件

func (*RateLimiterUniformRate) InitQuota

InitQuota 初始化并创建限流窗口 主流程会在首次调用,以及规则对象变更的时候,调用该方法

func (*RateLimiterUniformRate) IsEnable

IsEnable enable ?

func (*RateLimiterUniformRate) Name

func (g *RateLimiterUniformRate) Name() string

Name 插件名,一个类型下插件名唯一

func (*RateLimiterUniformRate) Type

Type 插件类型

Jump to

Keyboard shortcuts

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