gabsurd/checkpoint

Checkpoint operations for the Absurd durable workflow system. Provides functions for setting and getting task checkpoint state.

Checkpoints serve a dual purpose in Absurd:

  1. They persist step results so completed steps are skipped on retry.
  2. They extend the worker’s claim lease by extend_claim_by seconds.

The second behaviour is the primary lease extension mechanism — every checkpoint write keeps the worker’s claim alive, so tasks with many short steps never time out. For handlers that do a single long-running operation without checkpoints, see gabsurd/task.extend_claim.

Types

A checkpoint record.

pub type Checkpoint {
  Checkpoint(
    checkpoint_name: String,
    state: String,
    status: String,
    owner_run_id: BitArray,
    updated_at: timestamp.Timestamp,
  )
}

Constructors

  • Checkpoint(
      checkpoint_name: String,
      state: String,
      status: String,
      owner_run_id: BitArray,
      updated_at: timestamp.Timestamp,
    )

Values

pub fn get(
  db: client.Db,
  queue_name: String,
  task_id: BitArray,
  step_name: String,
  include_pending: Bool,
) -> Result(option.Option(Checkpoint), client.GabsurdError)

Get a checkpoint for a task step. Returns Ok(Some(checkpoint)) if found, Ok(None) if not found, or Error(GabsurdError) on database failure.

pub fn set(
  db: client.Db,
  queue_name: String,
  task_id: BitArray,
  step_name: String,
  state: json.Json,
  owner_run_id: BitArray,
  extend_claim_by: Int,
) -> Result(Nil, client.GabsurdError)

Set a checkpoint for a task step.

extend_claim_by is the number of seconds to extend the worker’s claim lease. Pass your worker’s claim_timeout value here so that every checkpoint write keeps the lease alive. Pass 0 to skip extension.

Search Document