Skip to main content

Crate runledger_postgres

Crate runledger_postgres 

Source
Expand description

PostgreSQL persistence layer for Runledger durable execution.

This crate owns the SQLx-backed storage and query helpers used by the runtime and application crates. The main entrypoint is the jobs module, which exposes APIs for:

  • queueing, claiming, heartbeating, and completing jobs
  • listing admin/job log data and runtime configuration
  • enqueueing and querying workflow runs and steps
  • applying or validating the bundled Runledger schema migrations

Typical consumers share a DbPool with runledger-runtime, then call the exported jobs functions from application setup, admin APIs, or tests.

For simple embedding, call migrate during startup:

let pool = sqlx::PgPool::connect("postgres://localhost/runledger").await?;
runledger_postgres::migrate(&pool).await?;

For deployments that manage DDL elsewhere, call ensure_schema_compatible instead to fail fast if the schema is missing or drifted. That check is read-only, but it expects the database to retain SQLx migration history in _sqlx_migrations and, when available, Runledger-owned migration state in runledger_migration_history.

Modules§

jobs

Structs§

FrameworkConstraintSpec
QueryError

Enums§

Error
QueryErrorCategory
SchemaCompatibilityError

Statics§

MIGRATOR

Functions§

classify_framework_constraint
classify_query_error
classify_query_error_with_constraint_classifier
ensure_schema_compatible
Validate that the target database’s SQLx migration history matches the bundled Runledger migrations.
has_framework_constraint_classifier
migrate
Apply the bundled Runledger schema migrations to a PostgreSQL pool.

Type Aliases§

DbPool
DbTx
Result