Skip to main content

Module waitpoint

Module waitpoint 

Source
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 stays pending, no activated_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_core pre-check so a non-existent execution surfaces NotFound rather 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_pending for one execution. Filters to state IN ('pending','active') (matches Valkey’s client-side keep filter). Fetches limit + 1 to 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_names goes 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.