ExMCP.Reliability.CircuitBreaker (ex_mcp v0.9.2)
View SourceCircuit breaker GenServer wrapper for ExMCP.Transport.Beam.CircuitBreaker.
Provides a GenServer-based interface to the circuit breaker pattern for protecting MCP services from cascading failures.
Summary
Functions
Executes a function through the circuit breaker.
Executes a function through the circuit breaker with timeout.
Returns a specification to start this module under a supervisor.
Manually closes the circuit breaker.
Gets the current state of the circuit breaker.
Gets circuit breaker statistics.
Manually opens the circuit breaker.
Resets the circuit breaker to initial state.
Starts a circuit breaker process.
Manually trips (opens) the circuit breaker. Alias for open/1 to match test expectations.
Types
@type options() :: [ failure_threshold: non_neg_integer(), success_threshold: non_neg_integer(), timeout: non_neg_integer(), reset_timeout: non_neg_integer(), error_filter: (any() -> boolean()) ]
Functions
@spec call(GenServer.server(), (-> any())) :: any()
Executes a function through the circuit breaker.
@spec call(GenServer.server(), (-> any()), timeout()) :: any()
Executes a function through the circuit breaker with timeout.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec close(GenServer.server()) :: :ok
Manually closes the circuit breaker.
@spec get_state(GenServer.server()) :: ExMCP.Transport.Beam.CircuitBreaker.state()
Gets the current state of the circuit breaker.
@spec get_stats(GenServer.server()) :: map()
Gets circuit breaker statistics.
@spec open(GenServer.server()) :: :ok
Manually opens the circuit breaker.
@spec reset(GenServer.server()) :: :ok
Resets the circuit breaker to initial state.
@spec start_link(options()) :: GenServer.on_start()
Starts a circuit breaker process.
@spec trip(GenServer.server()) :: :ok
Manually trips (opens) the circuit breaker. Alias for open/1 to match test expectations.