Fork re-derivation: queue ops on contract v1 (stamps, per-row claim visibility, savepoint-guarded dead-letter, both-states sweep, dead-visible get_job, @every scheduler) — ADR-010 §1–§5/§3a/§8, ADR-009 §2–§4, ADR-011/012, task fork-rederive-queue-ops

This commit is contained in:
glm-5.3-flash committed 2026-10-08 04:10:43 +00:00
1 parent 43a135c453
commit 915641bfe6
6 files changed
+2188 -23

No files matched your search

+72 -3
View File
@@ -127,7 +127,10 @@ pub(crate) const BOOTSTRAP_ALKSTORE_SQL: &str = "
max_attempts INTEGER NOT NULL DEFAULT 3,
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
expires_at INTEGER,
claimed_at INTEGER
claimed_at INTEGER,
visibility_timeout_s INTEGER NOT NULL DEFAULT 300,
backoff_base_s INTEGER NOT NULL DEFAULT 5,
dead_letter_retention_s INTEGER
);
CREATE INDEX IF NOT EXISTS __alkstore_live_claim
ON __alkstore_live(queue, priority DESC, run_at, id)
@@ -148,8 +151,15 @@ pub(crate) const BOOTSTRAP_ALKSTORE_SQL: &str = "
max_attempts INTEGER NOT NULL DEFAULT 0,
last_error TEXT,
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
died_at INTEGER NOT NULL DEFAULT (unixepoch())
died_at INTEGER NOT NULL DEFAULT (unixepoch()),
visibility_timeout_s INTEGER NOT NULL DEFAULT 300,
backoff_base_s INTEGER NOT NULL DEFAULT 5,
dead_letter_retention_s INTEGER,
claimed_at INTEGER,
expires_at INTEGER
);
CREATE INDEX IF NOT EXISTS __alkstore_dead_retention
ON __alkstore_dead(queue, died_at);
CREATE TABLE IF NOT EXISTS __alkstore_locks (
name TEXT PRIMARY KEY,
owner TEXT NOT NULL,
@@ -164,7 +174,10 @@ pub(crate) const BOOTSTRAP_ALKSTORE_SQL: &str = "
expires_s INTEGER,
next_fire_at INTEGER NOT NULL,
enabled INTEGER NOT NULL DEFAULT 1,
max_attempts INTEGER NOT NULL DEFAULT 3
max_attempts INTEGER NOT NULL DEFAULT 3,
visibility_timeout_s INTEGER NOT NULL DEFAULT 300,
backoff_base_s INTEGER NOT NULL DEFAULT 5,
dead_letter_retention_s INTEGER
);
CREATE TABLE IF NOT EXISTS __alkstore_stream (
offset INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -235,7 +248,63 @@ pub(crate) fn bootstrap_schema(conn: &Connection) -> Result<(), Error> {
"max_attempts",
"max_attempts INTEGER NOT NULL DEFAULT 3",
)?;
add_column_if_absent(
conn,
"__alkstore_scheduler_tasks",
"visibility_timeout_s",
"visibility_timeout_s INTEGER NOT NULL DEFAULT 300",
)?;
add_column_if_absent(
conn,
"__alkstore_scheduler_tasks",
"backoff_base_s",
"backoff_base_s INTEGER NOT NULL DEFAULT 5",
)?;
add_column_if_absent(
conn,
"__alkstore_scheduler_tasks",
"dead_letter_retention_s",
"dead_letter_retention_s INTEGER",
)?;
add_column_if_absent(conn, "__alkstore_live", "claimed_at", "claimed_at INTEGER")?;
add_column_if_absent(
conn,
"__alkstore_live",
"visibility_timeout_s",
"visibility_timeout_s INTEGER NOT NULL DEFAULT 300",
)?;
add_column_if_absent(
conn,
"__alkstore_live",
"backoff_base_s",
"backoff_base_s INTEGER NOT NULL DEFAULT 5",
)?;
add_column_if_absent(
conn,
"__alkstore_live",
"dead_letter_retention_s",
"dead_letter_retention_s INTEGER",
)?;
add_column_if_absent(
conn,
"__alkstore_dead",
"visibility_timeout_s",
"visibility_timeout_s INTEGER NOT NULL DEFAULT 300",
)?;
add_column_if_absent(
conn,
"__alkstore_dead",
"backoff_base_s",
"backoff_base_s INTEGER NOT NULL DEFAULT 5",
)?;
add_column_if_absent(
conn,
"__alkstore_dead",
"dead_letter_retention_s",
"dead_letter_retention_s INTEGER",
)?;
add_column_if_absent(conn, "__alkstore_dead", "claimed_at", "claimed_at INTEGER")?;
add_column_if_absent(conn, "__alkstore_dead", "expires_at", "expires_at INTEGER")?;
Ok(())
}