resilience

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCircuitOpen = errors.New("circuit breaker is open")

Functions

This section is empty.

Types

type CircuitBreaker

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

func NewCircuitBreaker

func NewCircuitBreaker(inner core.Action, config CircuitBreakerConfig) *CircuitBreaker

NewCircuitBreaker creates a new CircuitBreaker adapter.

func (*CircuitBreaker) Execute

func (c *CircuitBreaker) Execute(ctx context.Context, env core.Envelope) (core.Envelope, error)

Execute runs the inner action if the circuit is closed or half-open.

func (*CircuitBreaker) Metadata

func (c *CircuitBreaker) Metadata() core.ActionMetadata

Metadata delegates to the inner action's Metadata.

type CircuitBreakerConfig

type CircuitBreakerConfig struct {
	FailureThreshold uint64
	ResetTimeout     time.Duration
}

type State

type State int
const (
	StateClosed State = iota
	StateOpen
	StateHalfOpen
)

Jump to

Keyboard shortcuts

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