Versions in this module Expand all Collapse all v4 v4.0.0 Jan 19, 2024 Changes in this version + func IsBadRequest(err error) bool + type BadRequest interface + BadRequest func() bool + type Circuit struct + CircuitMetricsCollector MetricsCollection + ClosedToOpen ClosedToOpen + CmdMetricCollector RunMetricsCollection + FallbackMetricCollector FallbackMetricsCollection + OpenToClose OpenToClosed + func NewCircuitFromConfig(name string, config Config) *Circuit + func (c *Circuit) CloseCircuit(ctx context.Context) + func (c *Circuit) ConcurrentCommands() int64 + func (c *Circuit) ConcurrentFallbacks() int64 + func (c *Circuit) Config() Config + func (c *Circuit) Execute(ctx context.Context, runFunc func(context.Context) error, ...) error + func (c *Circuit) Go(ctx context.Context, runFunc func(context.Context) error, ...) error + func (c *Circuit) IsOpen() bool + func (c *Circuit) Name() string + func (c *Circuit) OpenCircuit(ctx context.Context) + func (c *Circuit) Run(ctx context.Context, runFunc func(context.Context) error) error + func (c *Circuit) SetConfigNotThreadSafe(config Config) + func (c *Circuit) SetConfigThreadSafe(config Config) + func (c *Circuit) Var() expvar.Var + type ClosedToOpen interface + Prevent func(ctx context.Context, now time.Time) bool + ShouldOpen func(ctx context.Context, now time.Time) bool + type CommandPropertiesConstructor func(circuitName string) Config + type Config struct + Execution ExecutionConfig + Fallback FallbackConfig + General GeneralConfig + Metrics MetricsCollectors + func (c *Config) Merge(other Config) *Config + type Configurable interface + SetConfigNotThreadSafe func(props Config) + SetConfigThreadSafe func(props Config) + type Error interface + CircuitOpen func() bool + ConcurrencyLimitReached func() bool + type ExecutionConfig struct + IgnoreInterrupts bool + IsErrInterrupt func(originalContextError error) bool + MaxConcurrentRequests int64 + Timeout time.Duration + type FallbackConfig struct + Disabled bool + MaxConcurrentRequests int64 + type FallbackMetrics interface + ErrConcurrencyLimitReject func(ctx context.Context, now time.Time) + ErrFailure func(ctx context.Context, now time.Time, duration time.Duration) + Success func(ctx context.Context, now time.Time, duration time.Duration) + type FallbackMetricsCollection []FallbackMetrics + func (r FallbackMetricsCollection) ErrConcurrencyLimitReject(ctx context.Context, now time.Time) + func (r FallbackMetricsCollection) ErrFailure(ctx context.Context, now time.Time, duration time.Duration) + func (r FallbackMetricsCollection) Success(ctx context.Context, now time.Time, duration time.Duration) + func (r FallbackMetricsCollection) Var() expvar.Var + type GeneralConfig struct + ClosedToOpenFactory func() ClosedToOpen + CustomConfig map[interface{}]interface{} + Disabled bool + ForceOpen bool + ForcedClosed bool + GoLostErrors func(err error, panics interface{}) + OpenToClosedFactory func() OpenToClosed + TimeKeeper TimeKeeper + type Manager struct + DefaultCircuitProperties []CommandPropertiesConstructor + func (h *Manager) AllCircuits() []*Circuit + func (h *Manager) CreateCircuit(name string, configs ...Config) (*Circuit, error) + func (h *Manager) GetCircuit(name string) *Circuit + func (h *Manager) MustCreateCircuit(name string, config ...Config) *Circuit + func (h *Manager) Var() expvar.Var + type Metrics interface + Closed func(ctx context.Context, now time.Time) + Opened func(ctx context.Context, now time.Time) + type MetricsCollection []Metrics + func (r MetricsCollection) Closed(ctx context.Context, now time.Time) + func (r MetricsCollection) Opened(ctx context.Context, now time.Time) + type MetricsCollectors struct + Circuit []Metrics + Fallback []FallbackMetrics + Run []RunMetrics + type OpenToClosed interface + Allow func(ctx context.Context, now time.Time) bool + ShouldClose func(ctx context.Context, now time.Time) bool + type RunMetrics interface + ErrBadRequest func(ctx context.Context, now time.Time, duration time.Duration) + ErrConcurrencyLimitReject func(ctx context.Context, now time.Time) + ErrFailure func(ctx context.Context, now time.Time, duration time.Duration) + ErrInterrupt func(ctx context.Context, now time.Time, duration time.Duration) + ErrShortCircuit func(ctx context.Context, now time.Time) + ErrTimeout func(ctx context.Context, now time.Time, duration time.Duration) + Success func(ctx context.Context, now time.Time, duration time.Duration) + type RunMetricsCollection []RunMetrics + func (r RunMetricsCollection) ErrBadRequest(ctx context.Context, now time.Time, duration time.Duration) + func (r RunMetricsCollection) ErrConcurrencyLimitReject(ctx context.Context, now time.Time) + func (r RunMetricsCollection) ErrFailure(ctx context.Context, now time.Time, duration time.Duration) + func (r RunMetricsCollection) ErrInterrupt(ctx context.Context, now time.Time, duration time.Duration) + func (r RunMetricsCollection) ErrShortCircuit(ctx context.Context, now time.Time) + func (r RunMetricsCollection) ErrTimeout(ctx context.Context, now time.Time, duration time.Duration) + func (r RunMetricsCollection) Success(ctx context.Context, now time.Time, duration time.Duration) + func (r RunMetricsCollection) Var() expvar.Var + type SimpleBadRequest struct + Err error + func (s SimpleBadRequest) BadRequest() bool + func (s SimpleBadRequest) Cause() error + func (s SimpleBadRequest) Error() string + type TimeKeeper struct + AfterFunc func(time.Duration, func()) *time.Timer + Now func() time.Time Other modules containing this package github.com/cep21/circuit github.com/cep21/circuit/v3