ExMCP.Reliability.CircuitBreaker.Core (ex_mcp v1.0.0-rc.1)
View SourcePure circuit-breaker state machine used by ExMCP.Reliability.CircuitBreaker.
Summary
Functions
Checks if a request should be allowed based on the current circuit state.
Checks if a request should be allowed and returns both the result and updated state.
Forces the circuit breaker to a specific state.
Gets the current state of the circuit breaker.
Gets circuit breaker statistics.
Creates a new circuit breaker with the given configuration.
Records a failed operation and updates the circuit breaker state.
Records a successful operation and updates the circuit breaker state.
Resets the circuit breaker to its initial state.
Types
@type config() :: %{ failure_threshold: non_neg_integer(), success_threshold: non_neg_integer(), timeout: non_neg_integer(), failure_rate_threshold: float(), minimum_throughput: non_neg_integer(), reset_timeout: non_neg_integer() }
@type state() :: :closed | :open | :half_open
@type t() :: %ExMCP.Reliability.CircuitBreaker.Core{ config: map(), failure_count: non_neg_integer(), last_failure_time: integer() | nil, last_success_time: integer() | nil, opened_at: integer() | nil, state: state(), stats: map(), success_count: non_neg_integer() }
Functions
Checks if a request should be allowed based on the current circuit state.
Checks if a request should be allowed and returns both the result and updated state.
Forces the circuit breaker to a specific state.
Gets the current state of the circuit breaker.
Gets circuit breaker statistics.
Creates a new circuit breaker with the given configuration.
Records a failed operation and updates the circuit breaker state.
Records a successful operation and updates the circuit breaker state.
Resets the circuit breaker to its initial state.