Raxol.Workflow.Checkpoint (Raxol v2.6.0)

View Source

An append-only snapshot of a workflow run's state at a specific step.

Each successful node completion produces one checkpoint when a Raxol.Workflow.Checkpoint.Saver is configured on the compiled graph's opts. Checkpoints are keyed by (thread_id, step):

  • thread_id -- the run id; one workflow execution corresponds to one thread. Resuming an interrupted run reuses the same thread_id so the new checkpoints chain onto the existing series.
  • step -- a monotonic counter starting at 0 for the first checkpoint of a thread.
  • state -- the workflow state immediately after the node ran.
  • metadata -- arbitrary map; the runtime stores %{node_id, run_id, graph_id}.
  • parent_step -- the previous step in the same thread, or nil for the first checkpoint.
  • created_at -- DateTime in UTC when the runtime wrote this record.

Append-only semantics: Saver.put/3 never overwrites a prior checkpoint with the same (thread_id, step); time-travel (replay from a prior step) is a property of the data model, not a feature flag.

Summary

Functions

Construct a checkpoint. created_at defaults to DateTime.utc_now/0.

Types

step()

@type step() :: non_neg_integer()

t()

@type t() :: %Raxol.Workflow.Checkpoint{
  created_at: DateTime.t(),
  metadata: map(),
  parent_step: step() | nil,
  state: any(),
  step: step(),
  thread_id: thread_id()
}

thread_id()

@type thread_id() :: binary()

Functions

new(opts)

@spec new(keyword()) :: t()

Construct a checkpoint. created_at defaults to DateTime.utc_now/0.