circuit_breaker

package
v0.0.0-...-034c2bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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"`
}

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func (*Driver) Check

func (d *Driver) Check(v interface{}, workers map[eosc.RequireId]interface{}) error

func (*Driver) ConfigType

func (d *Driver) ConfigType() reflect.Type

func (*Driver) Create

func (d *Driver) Create(id, name string, v interface{}, workers map[eosc.RequireId]interface{}) (eosc.IWorker, error)

type Factory

type Factory struct {
}

func NewFactory

func NewFactory() *Factory

func (*Factory) Create

func (f *Factory) Create(profession string, name string, label string, desc string, params map[string]interface{}) (eosc.IExtenderDriver, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL