Documentation ¶
Index ¶
- Constants
- func MatchStatusCode(matchStatusCodes string, ctx http_service.IHttpContext) bool
- func Register(register eosc.IExtenderDriverRegister)
- type CircuitBreaker
- func (c *CircuitBreaker) CheckSkill(skill string) bool
- func (c *CircuitBreaker) Destroy()
- func (c *CircuitBreaker) DoFilter(ctx http_service.IHttpContext, next http_service.IChain) (err error)
- func (c *CircuitBreaker) Id() string
- func (c *CircuitBreaker) Reset(v interface{}, workers map[eosc.RequireId]interface{}) error
- func (c *CircuitBreaker) Start() error
- func (c *CircuitBreaker) Stop() error
- type CircuitBreakerInfo
- type Config
- type Driver
- type Factory
Constants ¶
View Source
const ( BreakerDisable = 0 BreakerEnable = 1 BreakerRecovering = 2 )
View Source
const (
Name = "circuit_breaker"
)
Variables ¶
This section is empty.
Functions ¶
func MatchStatusCode ¶
func MatchStatusCode(matchStatusCodes string, ctx http_service.IHttpContext) bool
匹配接口状态码
func Register ¶
func Register(register eosc.IExtenderDriverRegister)
Types ¶
type CircuitBreaker ¶
type CircuitBreaker struct { *Driver // contains filtered or unexported fields }
func (*CircuitBreaker) CheckSkill ¶
func (c *CircuitBreaker) CheckSkill(skill string) bool
func (*CircuitBreaker) Destroy ¶
func (c *CircuitBreaker) Destroy()
func (*CircuitBreaker) DoFilter ¶
func (c *CircuitBreaker) DoFilter(ctx http_service.IHttpContext, next http_service.IChain) (err error)
func (*CircuitBreaker) Id ¶
func (c *CircuitBreaker) Id() string
func (*CircuitBreaker) Reset ¶
func (c *CircuitBreaker) Reset(v interface{}, workers map[eosc.RequireId]interface{}) error
func (*CircuitBreaker) Start ¶
func (c *CircuitBreaker) Start() error
func (*CircuitBreaker) Stop ¶
func (c *CircuitBreaker) Stop() error
type CircuitBreakerInfo ¶
type CircuitBreakerInfo struct { CircuitBreakerState int `json:"circuit_breaker_state"` FailCounts int `json:"fail_counts"` SuccessCounts int `json:"success_counts"` TripTime int64 `json:"trip_time"` StartTime int64 `json:"start_time"` RecoveringSuccessCounts int `json:"recovering_success_counts"` }
func (*CircuitBreakerInfo) ResetCircuitBreakerInfo ¶
func (cb *CircuitBreakerInfo) ResetCircuitBreakerInfo(state int, resetStartTime bool)
重置熔断当前状态信息
type Config ¶
type Config struct { MatchCodes string `json:"match_codes"` MonitorPeriod int `json:"monitor_period"` MinimumRequests int `json:"minimum_requests"` FailurePercent float64 `json:"failure_percent"` BreakPeriod int64 `json:"break_period"` SuccessCounts int `json:"success_counts"` BreakerCode int `json:"breaker_code"` Headers map[string]string `json:"headers"` Body string `json:"body"` }
Click to show internal directories.
Click to hide internal directories.