1 Star 0 Fork 2

QunXiongZhuLu / kratos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
limiter.go 653 Bytes
一键复制 编辑 原始数据 按行查看 历史
package ratelimit
import (
"context"
)
// Op operations type.
type Op int
const (
// Success opertion type: success
Success Op = iota
// Ignore opertion type: ignore
Ignore
// Drop opertion type: drop
Drop
)
type allowOptions struct{}
// AllowOptions allow options.
type AllowOption interface {
Apply(*allowOptions)
}
// DoneInfo done info.
type DoneInfo struct {
Err error
Op Op
}
// DefaultAllowOpts returns the default allow options.
func DefaultAllowOpts() allowOptions {
return allowOptions{}
}
// Limiter limit interface.
type Limiter interface {
Allow(ctx context.Context, opts ...AllowOption) (func(info DoneInfo), error)
}
1
https://gitee.com/QunXiongZhuLu/kratos.git
git@gitee.com:QunXiongZhuLu/kratos.git
QunXiongZhuLu
kratos
kratos
v0.6.2

搜索帮助