AshCircuitBreaker (ash_circuit_breaker v0.1.0)

An extension for Ash.Resource which adds the ability to wrap actions in circuit breakers to allow for graceful handling of and recovery from failures.

Summary

Functions

Generates a name for the circuit breaker based on the action input or changeset.

Types

error_matcher()

@type error_matcher() :: (any() -> boolean())

namefun()

@type namefun() ::
  (Ash.Changeset.t() | Ash.ActionInput.t() -> atom())
  | (Ash.Changeset.t() | Ash.ActionInput.t(), map() -> atom())

t()

@type t() :: %AshCircuitBreaker{
  __identifier__: any(),
  action: atom(),
  limit: pos_integer(),
  name: atom() | namefun(),
  per: pos_integer(),
  reset_after: pos_integer(),
  should_break?: error_matcher() | nil
}

Functions

circuit(body)

(macro)

name_for_breaker(action_input_or_changeset)

Generates a name for the circuit breaker based on the action input or changeset.