Ash.Reactor.Step behaviour (ash v3.24.3)

Copy Markdown View Source

Minimal behaviour for reactor step modules invoked by Ash.Reactor.AshStep.

Step modules passed via ash_step name, impl: MyStep are called through the wrappers in this module so that return values are validated. The callbacks mirror the interface expected by Reactor.Step (run/3, compensate/4, undo/4).

Summary

Types

compensate_result()

@type compensate_result() ::
  :ok
  | :retry
  | {:continue, term()}
  | {:error, term()}
  | {:retry, term()}
  | {:ok, term(), list()}
  | {:ok, term(), list(), list()}

run_result()

@type run_result() ::
  {:ok, term()}
  | {:ok, term(), list()}
  | {:ok, term(), list(), list()}
  | {:error, term()}
  | :retry
  | {:halt | :error | :retry, term()}

undo_result()

@type undo_result() ::
  :ok
  | :retry
  | {:error, term()}
  | {:retry, term()}
  | {:ok, term(), list()}
  | {:ok, term(), list(), list()}

Callbacks

compensate(any, inputs, context, keyword)

(optional)
@callback compensate(any(), Reactor.inputs(), Reactor.context(), keyword()) ::
  compensate_result()

run(inputs, context, keyword)

@callback run(Reactor.inputs(), Reactor.context(), keyword()) :: run_result()

undo(any, inputs, context, keyword)

(optional)
@callback undo(any(), Reactor.inputs(), Reactor.context(), keyword()) :: undo_result()