PlaidEx.Reliability.CircuitBreakerSupervisor (plaid_ex v1.0.0)

Copy Markdown View Source

DynamicSupervisor managing per-environment circuit breakers.

Starts a CircuitBreaker process for each Plaid environment on demand. Circuit breakers are never restarted automatically (:temporary) because their state would reset on restart anyway.

Summary

Functions

Returns a specification to start this module under a supervisor.

Ensures a circuit breaker exists for the given environment. Safe to call multiple times — idempotent.

Functions

check(environment, config)

@spec check(atom(), PlaidEx.Config.t()) :: :ok | {:error, :circuit_open}

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

ensure_started(environment, config)

@spec ensure_started(atom(), PlaidEx.Config.t()) :: {:ok, pid()} | {:error, term()}

Ensures a circuit breaker exists for the given environment. Safe to call multiple times — idempotent.

record_failure(environment, error, config)

@spec record_failure(atom(), PlaidEx.Error.t(), PlaidEx.Config.t()) :: :ok

record_success(environment)

@spec record_success(atom()) :: :ok

start_link(opts)

@spec start_link(keyword()) :: Supervisor.on_start()