Skip to main content

Module sqlite

Module sqlite 

Source
Expand description

SqliteTaskStore — SQLite-backed TaskStore using [rusqlite-isle].

The Connection is confined to a dedicated OS thread by AsyncIsle; every call is a typed closure dispatched over a bounded channel. blueprint_ref / input_ctx / task_input_spec are stored as JSON blobs (all three are already serde_json::Value on TaskRecord), so schema evolution of the caller-side selector / spec shape never requires a migration here.

§Schema

CREATE TABLE IF NOT EXISTS tasks (
  id                    TEXT PRIMARY KEY,
  goal                  TEXT NOT NULL,
  blueprint_ref_json    TEXT NOT NULL,
  input_ctx_json        TEXT NOT NULL,
  status                TEXT NOT NULL,      -- JSON-encoded `TaskRecordStatus`
  created_at            INTEGER NOT NULL,
  updated_at            INTEGER NOT NULL,
  task_input_spec_json  TEXT                 -- nullable; JSON-encoded `TaskInputSpec`
);
CREATE INDEX IF NOT EXISTS ix_tasks_created_at ON tasks(created_at);

Issue #19 ST4: task_input_spec_json is a nullable column added after the original schema shipped. A fresh open/open_in_memory gets it straight from CREATE TABLE IF NOT EXISTS above; a database file created before ST4 already has a tasks table without it, so [ensure_task_input_spec_column] runs an ALTER TABLE ... ADD COLUMN backfill guarded by a PRAGMA table_info existence check (idempotent — safe to run against both pre-ST4 and post-ST4 files).

Structs§

SqliteTaskStore
SQLite-backed persistent TaskStore.