Expand description
SQL statements for waitpoint + HMAC secret ops (RFC-023 Phase 2b.2.1).
Mirrors ff-backend-postgres/src/signal.rs +
ff-backend-postgres/src/suspend_ops.rs at the statement level;
dialect deltas are the usual jsonb → TEXT, $n → ?n, no
ON CONFLICT (cols) DO UPDATE SET col = EXCLUDED.col array
binding (we bind lists via JSON strings where PG used text[]).
Constants§
- DEACTIVATE_
ALL_ HMAC_ SQL - DELETE_
WAITPOINTS_ BY_ EXEC_ SQL - Delete every waitpoint row for a resolved execution.
- INSERT_
HMAC_ ROW_ SQL - INSERT_
WAITPOINT_ PENDING_ SQL - Fresh pending-waitpoint row for
create_waitpoint— state stayspending, noactivated_at_ms. Binds: 1=partition, 2=waitpoint_id, 3=execution_id, 4=kid, 5=token, 6=created_at_ms, 7=expires_at_ms, 8=waitpoint_key. - SELECT_
ACTIVE_ HMAC_ SQL - SELECT_
ACTIVE_ KID_ SQL - SELECT_
EXEC_ EXISTS_ SQL - Existence probe — matches PG reference’s
EXISTS exec_corepre-check so a non-existent execution surfacesNotFoundrather than an empty page. Binds: ?1 partition_key, ?2 execution_id BLOB. - SELECT_
HMAC_ SECRET_ BY_ KID_ SQL - SELECT_
PENDING_ WAITPOINTS_ PAGE_ SQL - Cursor-paginated scan of
ff_waitpoint_pendingfor one execution. Filters tostate IN ('pending','active')(matches Valkey’s client-side keep filter). Fetcheslimit + 1to detect “more to come” without a second round-trip. - SELECT_
WAITPOINT_ FOR_ DELIVER_ SQL - For deliver_signal: read kid + token + wp_key + bound execution. Returns (token_kid, token, waitpoint_key, execution_id).
- SELECT_
WAITPOINT_ KEY_ BY_ ID_ SQL - SELECT_
WAITPOINT_ TOKEN_ BY_ ID_ SQL - Point-read of a waitpoint’s HMAC token, used by the signal-bridge to authenticate signal-resume requests on SQLite deployments. Binds: 1=partition_key (i64), 2=waitpoint_id (BLOB).
- UPSERT_
WAITPOINT_ PENDING_ ACTIVE_ SQL - Insert-or-overwrite a waitpoint row.
required_signal_namesgoes in as a JSON-encoded TEXT column (SQLite has no native text[]). Binds: 1=partition_key, 2=waitpoint_id, 3=execution_id, 4=token_kid, 5=token, 6=created_at_ms, 7=expires_at_ms, 8=waitpoint_key, 9=required_signal_names_json.