Documentation ¶
Index ¶
- Constants
- Variables
- func Check(cfg *Config, workers map[eosc.RequireId]eosc.IWorker) error
- func Create(id, name string, v *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)
- func DoStrategy(ctx eocontext.EoContext, next eocontext.IChain, scalars *Scalars) error
- func NewActuator() *actuatorHttp
- func Register(register eosc.IExtenderDriverRegister)
- func RegisterActuator(handler ActuatorsHandler)
- type ActuatorSet
- type ActuatorsHandler
- type Config
- type Controller
- func (c *Controller) AllWorkers() []string
- func (c *Controller) Check(cfg interface{}) (profession, name, driver, desc string, err error)
- func (c *Controller) ConfigType() reflect.Type
- func (c *Controller) Del(id string)
- func (c *Controller) Get() interface{}
- func (c *Controller) Mode() eosc.SettingMode
- func (c *Controller) Set(conf interface{}) (err error)
- func (c *Controller) Store(id string)
- type Limiting
- type LimitingHandler
- type Rule
- type Scalars
- type Set
- type Threshold
- type ThresholdUint
Constants ¶
View Source
const Name = "strategy-limiting"
Variables ¶
View Source
var (
ErrorLimitingRefuse = errors.New("refuse by limiting strategy")
)
Functions ¶
func DoStrategy ¶ added in v0.9.0
func NewActuator ¶
func NewActuator() *actuatorHttp
func RegisterActuator ¶
func RegisterActuator(handler ActuatorsHandler)
Types ¶
type ActuatorSet ¶
type ActuatorsHandler ¶
type Config ¶
type Config struct { Name string `json:"name" skip:"skip"` Description string `json:"description" skip:"skip"` Stop bool `json:"stop" label:"禁用"` Priority int `json:"priority" label:"优先级" description:"1-999"` Filters strategy.FilterConfig `json:"filters" label:"过滤规则"` Rule Rule `json:"limiting" label:"限流规则" description:"限流规则"` }
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController() *Controller
func (*Controller) AllWorkers ¶
func (c *Controller) AllWorkers() []string
func (*Controller) Check ¶
func (c *Controller) Check(cfg interface{}) (profession, name, driver, desc string, err error)
func (*Controller) ConfigType ¶
func (c *Controller) ConfigType() reflect.Type
func (*Controller) Del ¶
func (c *Controller) Del(id string)
func (*Controller) Get ¶
func (c *Controller) Get() interface{}
func (*Controller) Mode ¶
func (c *Controller) Mode() eosc.SettingMode
func (*Controller) Set ¶
func (c *Controller) Set(conf interface{}) (err error)
func (*Controller) Store ¶
func (c *Controller) Store(id string)
type Limiting ¶
type Limiting struct { drivers.WorkerBase // contains filtered or unexported fields }
func (*Limiting) CheckSkill ¶
type LimitingHandler ¶
type LimitingHandler struct {
// contains filtered or unexported fields
}
func NewLimitingHandler ¶
func NewLimitingHandler(name string, conf *Config) (*LimitingHandler, error)
func (*LimitingHandler) Filter ¶
func (l *LimitingHandler) Filter() strategy.IFilter
func (*LimitingHandler) Metrics ¶
func (l *LimitingHandler) Metrics() metrics.Metrics
func (*LimitingHandler) Name ¶
func (l *LimitingHandler) Name() string
func (*LimitingHandler) Priority ¶
func (l *LimitingHandler) Priority() int
func (*LimitingHandler) Response ¶ added in v0.9.0
func (l *LimitingHandler) Response() response.IResponse
func (*LimitingHandler) Stop ¶
func (l *LimitingHandler) Stop() bool
type ThresholdUint ¶
Click to show internal directories.
Click to hide internal directories.