Conduit.Storage.Postgres
Conduit.Storage.Postgres — Postgres-backed implementation of Conduit.Storage.
Built on the depot library (Connection / Message / Pool). This is the durable, multi-node-safe storage backend; the in-memory VaultStore in the test suite is for unit tests only.
── Status (vertical slice) ────────────────────────────────────────────────── The core JOB LIFECYCLE is fully implemented against a live database: enqueue, fetch_next (SELECT … FOR UPDATE SKIP LOCKED), mark_running, mark_completed, mark_snoozed, heartbeat, schedule_retry, discard, move_to_dead_letter, rescue_stale. The remaining cron / workflow / node / dashboard / event methods return an explicit "not yet implemented" error and are filled in incrementally.
── Conventions ────────────────────────────────────────────────────────────── • Timestamps are stored as BIGINT epoch-SECONDS (DateTime.to_timestamp). Read and write go through the same conversion, so ordering is consistent. • List columns (errors, tags) are stored as a JSON array of strings in a TEXT column, encoded/decoded by pencode_str_list / pdecode_str_list. • Data-path operations use a per-database connection pool (pwith_conn). One pool per (host:port/db@user) is lazily started and stored in a process-wide Vault, so all Store values sharing the same signature share a single pool. • Advisory locks (cron scheduler, leader election) run on a dedicated persistent connection per lock id (pwith_lock_conn) — session-scoped locks must outlive a single operation — giving real cross-node mutual exclusion, not just single-node.
Schema: priv/migrations/001_conduit_schema.sql
Types
Functions
Build a Store for a database on localhost:5432 with no password (trust auth).
Build a Store from explicit connection parameters.
Like new, but every operation opens its own connection and closes it after, instead of going through depot's actor Pool. Use this where the Pool's actor can't answer — notably from HTTP handler threads in a compiled web server, where every Pool.checkout times out ("pool actor: no reply") — e.g. when the dashboard is mounted inside a web app. Costs one connect+auth per operation; fine for dashboard-rate traffic, not for a worker's hot path.