Expand description
§mempill-postgres
PostgreSQL-backed PersistencePort adapter for mempill.
§Usage
use mempill_postgres::{open_postgres, PostgresEngine};
use mempill_core::{EngineConfig, NoOpOracle, NoOpVector};
use std::sync::Arc;
let conn_str = "host=localhost port=5432 user=mempill dbname=mempill password=secret";
let engine: PostgresEngine<NoOpOracle, NoOpVector> = open_postgres(conn_str, None, None, EngineConfig::default())?;§Topology-b vs topology-a
One backend per deployment: downstream consumers depend on EITHER mempill-sqlite
OR mempill-postgres, never both.
§Concurrency model
- r2d2 pool (max 20 connections) enables concurrent cross-agent transactions.
pg_advisory_xact_lock(hashtext(agent_id)::bigint)serializes same-agent writes at the DB level.UNIQUE(agent_id, stream_seq)onledger_entriesprovides OCC belt-and-suspenders against duplicate sequence numbers.requires_global_write_serialization()returnsfalse— EngineHandle skips the global write lock, enabling true Postgres concurrency across agents.
Modules§
Structs§
- Postgres
Pending Store - PostgreSQL-backed
PendingAdjudicationPortimplementation. - Postgres
Persistence Store - The PostgreSQL-backed
PersistencePortimplementation. - Postgres
Txn - An open, uncommitted Postgres transaction scoped to one
agent_id.
Enums§
- Postgres
Store Error - Error type for PostgresPersistenceStore operations.
Functions§
- open_
postgres - Convenience constructor: build a
PostgresEngine<O, V>(anEngineHandlebacked byPostgresPersistenceStore) from a connection string. - open_
postgres_ with_ oracle - Convenience constructor: build a
PostgresEngine<O, V>wired with a real oracle and the Postgres-backed pending-adjudication store.
Type Aliases§
- Postgres
Engine - Type alias for an
EngineHandlebacked byPostgresPersistenceStore.