SQLite Functions
The absurd-sqlite-extension provides a collection of SQLite functions to interact with the durable workflow system. The schema and base settings of the workflow system are managed by a few “meta” functions.
Durable Workflow Functions
Section titled “Durable Workflow Functions”absurd_cancel_task(queue_name, task_id): cancel a task and any active runs.absurd_cleanup_events(queue_name, ttl_seconds[, limit]): delete events older than TTL.absurd_cleanup_tasks(queue_name, ttl_seconds[, limit]): delete terminal tasks older than TTL, including runs/checkpoints/waits.absurd_complete_run(queue_name, run_id, result_json_or_null): mark a running run as completed and store its result payload.absurd_create_queue(queue_name): create a queue if it does not exist.absurd_drop_queue(queue_name): drop a queue and return the number of rows removed.absurd_emit_event(queue_name, event_name[, payload_json]): emit or update an event payload and wake waiting runs.absurd_extend_claim(queue_name, run_id, extend_by_secs): extend a running claim by N seconds.absurd_fail_run(queue_name, run_id, reason[, retry_at_ms]): mark a run as failed and optionally schedule a retry timestamp.absurd_schedule_run(queue_name, run_id, wake_at_ms): put a running run to sleep until the given timestamp.absurd_set_task_checkpoint_state(queue_name, task_id, step_name, state_json, owner_run_id[, extend_claim_by_secs]): store checkpoint state for a step; optionally extend the run claim.absurd_await_event(queue_name, task_id, run_id, step_name, event_name[, timeout_secs]): await an event or timeout; returns should_suspend and payload.absurd_claim_task(queue_name[, worker_id, claim_timeout_secs, qty]): claim available runs for a worker (defaults: worker, 30s, qty=1).absurd_get_task_checkpoint_state(queue_name, task_id, step_name[, include_pending]): fetch checkpoint state for a step (returns status and metadata).absurd_get_task_checkpoint_states(queue_name, task_id[, run_id]): list checkpoint states for a task.absurd_list_queues(): list queues with creation timestamps.absurd_spawn_task(queue_name, task_name, params_json[, options_json]): create a task and its initial run; options may include headers, retry_strategy, max_attempts, cancellation, and idempotency_key.
Schema Management
Section titled “Schema Management”absurd_apply_migrations([target_version]): apply schema migrations up to the target version.absurd_migration_records(): list applied migrations (id, introduced_version, applied_time).
Meta Functions
Section titled “Meta Functions”absurd_set_fake_now(fake_now_ms_or_null): override or clear the engine’s time source for testing.absurd_version(): return extension version and git commit.