feat: persist resumable client script uploads

This commit is contained in:
2026-09-06 06:39:12 +00:00
parent 6539b9e965
commit 62c0052979
5 changed files with 447 additions and 2 deletions
+13
View File
@@ -84,6 +84,19 @@ CREATE TABLE events (
UNIQUE(issue_uuid, event_seq)
) STRICT, WITHOUT ROWID;
CREATE INDEX events_send_window ON events(issue_uuid, event_seq, local_ordinal);
CREATE TABLE scripts (
issue_uuid BLOB PRIMARY KEY REFERENCES commands(issue_uuid) ON DELETE CASCADE CHECK(length(issue_uuid) = 16),
declared_raw_bytes INTEGER NOT NULL CHECK(declared_raw_bytes >= 0),
declared_sha256 BLOB NOT NULL CHECK(length(declared_sha256) = 32),
received_raw_bytes INTEGER NOT NULL DEFAULT 0 CHECK(received_raw_bytes >= 0),
stored_bytes INTEGER NOT NULL CHECK(stored_bytes >= 0),
compression INTEGER NOT NULL CHECK(compression = 2),
stored_data BLOB NOT NULL,
charged_bytes INTEGER NOT NULL CHECK(charged_bytes > 0),
committed INTEGER NOT NULL DEFAULT 0 CHECK(committed IN (0, 1)),
CHECK(received_raw_bytes <= declared_raw_bytes),
CHECK((committed = 0) OR received_raw_bytes = declared_raw_bytes)
) STRICT, WITHOUT ROWID;
CREATE TABLE spool_counters (
singleton INTEGER PRIMARY KEY CHECK(singleton = 1),
client_total_charged_bytes INTEGER NOT NULL CHECK(client_total_charged_bytes >= 0),