Documentation ¶
Index ¶
Constants ¶
View Source
const Type = "cbreaker"
Variables ¶
This section is empty.
Functions ¶
func FromCli ¶
func FromCli(c *cli.Context) (plugin.Middleware, error)
FromCli constructs the middleware from the command line arguments
func FromOther ¶
func FromOther(c Spec) (plugin.Middleware, error)
FromOther is used to read spec from the serialized format
func GetSpec ¶
func GetSpec() *plugin.MiddlewareSpec
Types ¶
type Spec ¶
type Spec struct { // Condition is a JSON dictionary formula to set circuit breaker in "Tripped" state Condition string // Fallback is a JSON dictionary with fallback action, such as response or redirect Fallback interface{} // OnTripped defines JSON dict with action executed after (Standby -> Tripped) transition takes place OnTripped interface{} // OnStandby defines JSON dict with action executed after (Recovering -> Standby) transition takes place) OnStandby interface{} // FallbackDuration defines time period for circuit breaker to activate fallback scenario for all requests FallbackDuration time.Duration // Recovery duration defines time period for circuit breaker to increase traffic to the original upstream. RecoveryDuration time.Duration // CheckPeriod defines the period between circuit breaker checks CheckPeriod time.Duration }
Spec defines circuit breaker middleware parameters
func NewSpec ¶
func NewSpec(condition string, fallback, onTripped, onStandby interface{}, fallbackDuration, recoveryDuration, checkPeriod time.Duration) (*Spec, error)
NewSpec check parameters and returns new specification for the middleware
func (*Spec) NewHandler ¶
NewMiddleware vulcan library compatible middleware
Click to show internal directories.
Click to hide internal directories.