mule/engines/postgres

Values

pub fn from_connection(
  connection connection: pog.Connection,
) -> engine.Engine

Build the engine over an already-resolved pog.Connection, skipping the rows_as_map check. Prefer new(config); reach for this only when you hold a Connection rather than the Config that produced it.

pub fn from_connection_clustered(
  connection connection: pog.Connection,
  insert_channel insert_channel: String,
  instance_name instance_name: String,
  node node: String,
) -> engine.Engine

Like from_connection, but with the clustered, transactional staging path: stage_jobs promotes due jobs and emits the wake-up pg_notify in ONE statement (so they commit together — no lost or spurious wake-up across the UPDATE/notify boundary), gated in SQL on this node holding a live mule_peers lease. Pair this with the Postgres notifier (the in-SQL pg_notify only reaches producers that LISTEN) and the lease-election peer.

insert_channel MUST equal the Postgres notifier’s prefixed Insert channel (notifiers/postgres.prefixed_channel(prefix, notifier.Insert)), or producers never hear the wake-up. instance_name/node identify this node’s lease row. With the Stager-notifies path (from_connection) the caller’s notifier is responsible for the wake-up instead.

pub fn from_connection_clustered_with_prefix(
  connection connection: pog.Connection,
  insert_channel insert_channel: String,
  instance_name instance_name: String,
  node node: String,
  prefix prefix: String,
) -> engine.Engine

from_connection_clustered against a non-public Postgres schema. The schema prefix qualifies the tables; insert_channel stays the caller’s because the notifier’s channel prefix is its own wiring (usually the same string).

pub fn from_connection_with_prefix(
  connection connection: pog.Connection,
  prefix prefix: String,
) -> engine.Engine

from_connection against a non-public Postgres schema.

pub fn new(config: pog.Config) -> engine.Engine

Build the Postgres engine from your pool’s pog.Config, validating the one requirement the engine places on it: rows_as_map must be True, because the engine decodes result rows by column name. A misconfigured pool panics here (at mule.start) with a clear message, rather than failing later with a cryptic decode error on the first query. pog.default_config leaves rows_as_map False, so this is easy to forget.

pub fn new_with_prefix(
  config: pog.Config,
  prefix prefix: String,
) -> engine.Engine

new against a Postgres schema other than public — the port of Oban’s prefix: option. Pair it with a migration run under the same prefix (migration.migrate_with(connection, options: [Prefix(prefix)])); the notifier’s channel prefix is wired separately (and per-database channels only need to differ when two instances share one database).

Search Document