March Docs

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

typeStoreStore = {#

Functions

fnlocallocal(user : String, database : String) : Store#

Build a Store for a database on localhost:5432 with no password (trust auth).

fnnewnew(host : String, port : Int, user : String, database : String, password : Option(String)) : Store#

Build a Store from explicit connection parameters.