Expand description
RFC-025 Phase 3 — Postgres worker-registry bodies + TTL-sweep.
Backs the five EngineBackend worker-registry methods
(register_worker, heartbeat_worker, mark_worker_dead,
list_expired_leases, list_workers) on Postgres, plus the
worker_registry_ttl_sweep reconciler that prunes rows whose
last_heartbeat_ms + liveness_ttl_ms has elapsed.
Schema shape lives in migrations/0021_worker_registry.sql
(current-state table + append-only event log). Partition key is
(fnv1a_u64(worker_instance_id.as_bytes()) % 256) as i16 — identical
to the Valkey-side hashing so register / heartbeat /
mark_dead / ttl_sweep all land on the same row for the same
instance id.
Functions§
- heartbeat_
worker - list_
expired_ leases - list_
workers - mark_
worker_ dead - register_
worker - ttl_
sweep_ tick - Per-partition TTL sweep. Mirrors Valkey’s native PEXPIRE behaviour
for PG/SQLite: rows whose
last_heartbeat_ms + liveness_ttl_msfalls strictly belownow_msare deleted and attl_sweptevent is appended to the audit log. - worker_
partition_ key - Derive the
ff_worker_registry.partition_keyfor an instance id. Must match the Valkey-side hashing (both paths own the same row).