quasar_postgres
Cluster-safe PostgreSQL durable Store.
Types
pub type MigrationError {
MigrationUnavailable
Database(pog.QueryError)
}
Constructors
-
MigrationUnavailable -
Database(pog.QueryError)
Values
pub fn migrate(
connection: pog.Connection,
) -> Result(Nil, MigrationError)
Applies all pending packaged migrations in version order.
The migration history and a shared advisory lock make concurrent startup
safe when multiple application instances share one database. Migrations are
applied strictly in version order; online migrations run outside a database
transaction so PostgreSQL can execute CONCURRENTLY statements.
pub fn new(connection: pog.Connection) -> store.Store
Builds a Store backed by an existing Pog connection pool.
The Pog pool remains application-owned and is not stopped when this Store
closes. Run migrate and start quasar_postgres/reaper before Quasar.
Claim no longer recovers expired jobs; recovery is independent maintenance.
pub fn new_with_pools(
producer: pog.Connection,
execution: pog.Connection,
control: pog.Connection,
) -> store.Store
Isolates producer/status traffic, completion writes, and claim/heartbeat traffic. All pools MUST address the same database and schema. A separate reaper runtime is required, including when all three pools are identical.
pub fn transactional_worker(
connection: pog.Connection,
name name: String,
encode encode: fn(input) -> String,
decode decode: fn(String) -> Result(input, String),
perform perform: fn(input, worker.Context, pog.Connection) -> Result(
Nil,
String,
),
) -> worker.Worker(input)
Builds a worker whose PostgreSQL business effect and fenced job completion commit in the same transaction.
This is intentionally PostgreSQL-specific. Use a regular worker.new when
effects live outside this database and make those effects idempotent.