# `AdyenClient.CircuitBreaker`
[🔗](https://github.com/iamkanishka/adyen_client/blob/v1.0.0/lib/adyen_client/circuit_breaker.ex#L1)

Simple circuit breaker protecting against Adyen API outages.

States: `:closed` (normal) → `:open` (blocking) → `:half_open` (probing)

Opens after `failure_threshold` consecutive failures.
Moves to `:half_open` after `reset_timeout_ms`.
Closes after one successful request in `:half_open`.

# `allow?`

```elixir
@spec allow?() :: :ok | {:error, :circuit_open}
```

Returns `:ok` if request may proceed, `{:error, :circuit_open}` if blocked.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `failure`

```elixir
@spec failure() :: :ok
```

Record a failed request.

# `start_link`

# `state`

```elixir
@spec state() :: :closed | :open | :half_open
```

Current circuit state.

# `success`

```elixir
@spec success() :: :ok
```

Record a successful request.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
