Documentation ¶
Index ¶
Constants ¶
View Source
const (
Name = "counter"
)
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
func NewFactory() eosc.IExtenderDriverFactory
func Register ¶
func Register(register eosc.IExtenderDriverRegister)
Types ¶
type Config ¶
type Config struct { Key string `json:"key" label:"格式化Key" required:"true"` Cache eosc.RequireId `json:"cache" label:"缓存计数器" skill:"github.com/eolinker/apinto/resources.resources.ICache" required:"false"` Counter eosc.RequireId `json:"counter" label:"计数器" skill:"github.com/eolinker/apinto/drivers/counter.counter.IClient" required:"false"` Match *Match `json:"match" label:"响应匹配规则"` Count *separator.CountRule `json:"count" label:"计数规则"` }
type IKeyGenerator ¶
type IKeyGenerator interface {
Key(ctx http_service.IHttpContext) string
}
type LocalCounter ¶
type LocalCounter struct {
// contains filtered or unexported fields
}
LocalCounter 本地计数器
func NewLocalCounter ¶
func NewLocalCounter(key string, client scope_manager.IProxyOutput[counter.IClient]) *LocalCounter
func (*LocalCounter) Complete ¶
func (c *LocalCounter) Complete(count int64) error
func (*LocalCounter) Lock ¶
func (c *LocalCounter) Lock(count int64) error
func (*LocalCounter) RollBack ¶
func (c *LocalCounter) RollBack(count int64) error
type Match ¶
type Match struct { Params []*matcher.MatchParam `json:"params" label:"匹配参数列表"` StatusCodes []int `json:"status_codes" label:"匹配响应状态码列表"` Type string `json:"type" label:"匹配类型" enum:"json"` }
func (*Match) GenerateHandler ¶
type RedisCounter ¶
type RedisCounter struct {
// contains filtered or unexported fields
}
func NewRedisCounter ¶
func NewRedisCounter(key string, redis scope_manager.IProxyOutput[resources.ICache], client scope_manager.IProxyOutput[counter.IClient]) *RedisCounter
func (*RedisCounter) Complete ¶
func (r *RedisCounter) Complete(count int64) error
func (*RedisCounter) Lock ¶
func (r *RedisCounter) Lock(count int64) error
func (*RedisCounter) RollBack ¶
func (r *RedisCounter) RollBack(count int64) error
Click to show internal directories.
Click to hide internal directories.