Docket.Checkpoint.Context (docket v0.1.0)

Copy Markdown View Source

Context passed to observers and processless test sinks alongside each checkpoint.

checkpoint_seq is the committed run fence and graph_step is the proposed run's committed graph position. active_superstep, when present, exposes the stable identities of scheduled retry tasks and results awaiting the barrier. node_attempts describes only the attempt outcomes newly represented by this moment. These fields let durable drivers and observers identify retry work without interpreting Docket-owned run state or parsing task IDs.

application carries the caller-supplied application context from the run options; Docket does not interpret it.

Summary

Types

active_superstep()

@type active_superstep() :: %{
  step: non_neg_integer(),
  tasks: [superstep_task()],
  pending_attempts: [pending_attempt()]
}

node_attempt()

@type node_attempt() :: %{
  task_id: String.t(),
  node_id: String.t(),
  attempted: pos_integer(),
  outcome:
    :completed | :failed | :interrupted | :pending_update | :pending_interrupt,
  next_scheduled_attempt: pos_integer() | nil
}

pending_attempt()

@type pending_attempt() :: %{
  task_id: String.t(),
  node_id: String.t(),
  attempted: pos_integer(),
  kind: :update | :interrupt,
  idempotency_key: String.t()
}

superstep_task()

@type superstep_task() :: %{
  task_id: String.t(),
  node_id: String.t(),
  scheduled_attempt: pos_integer(),
  idempotency_key: String.t()
}

t()

@type t() :: %Docket.Checkpoint.Context{
  active_superstep: active_superstep() | nil,
  application: map(),
  checkpoint_seq: pos_integer() | nil,
  graph_hash: String.t() | nil,
  graph_id: String.t(),
  graph_step: non_neg_integer() | nil,
  node_attempts: [node_attempt()],
  run_id: String.t()
}