Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrReject = errors.New("reject") ErrTooMany = errors.New("too many request") )
Functions ¶
Types ¶
type Breaker ¶
type Breaker interface { Allow() error Mark(err error) MarkSuccess() MarkFailure() String() string }
Breaker
Breaker仅仅是一个状态机 使用Allow判断能否通过,使用MarkSuccess,MarkFailure反馈成功或失败结果 Mark仅仅是MarkSuccess和MarkFailure的封装,方便外部操作
type Group ¶
type Group interface { Get(key string) Breaker Reload(cfg *Config) Exec(key string, run, fallback func() error) error }
Breaker分组,共享一份配置
Click to show internal directories.
Click to hide internal directories.