GenDurable.Outcome (gen_durable v0.1.2)

Copy Markdown View Source

The five step/handle outcomes from the spec §3, with shape validation.

{:next, step, state}        # transition, runnable, attempt := 0
{:replay, state, delay_ms}  # same step, runnable, attempt += 1, eligible_at += delay
{:await, signal_name, state} # park, awaiting_signal
{:done, result}             # terminal, done
{:stop, reason}             # terminal, failed

Step names and signal names are normalized to strings.

Summary

Functions

The outcome's tag, for telemetry/metadata.

Types

t()

@type t() ::
  {:next, String.t(), term()}
  | {:replay, term(), non_neg_integer()}
  | {:await, String.t(), term()}
  | {:schedule_childs, String.t(), [term()], term()}
  | {:done, map()}
  | {:stop, term()}

Functions

kind(outcome)

The outcome's tag, for telemetry/metadata.

validate(other)

@spec validate(term()) :: {:ok, t()} | {:error, {:bad_outcome, term()}}

validate!(outcome)

@spec validate!(term()) :: t()