Skip to main content

Crate chronon_backend_sql_common

Crate chronon_backend_sql_common 

Source
Expand description

Shared SQL SchedulerStore for PostgreSQL and SQLite.

Audience: backend and platform engineers implementing or extending SQL persistence.

§Stack position

chronon-backend-{postgres,sqlite} → chronon-backend-sql-common → chronon-core

Integrators typically use the thin wrapper crates chronon_backend_postgres or chronon_backend_sqlite rather than depending on this crate directly.

§Entry points

§Prerequisites

Schema bootstrap runs on connect. For parallel Postgres tests use SqlSchedulerStore::connect_postgres_isolated.

§Example

use chronon_backend_sql_common::SqlSchedulerStore;

let store = SqlSchedulerStore::connect_sqlite("sqlite://:memory:").await?;

Macros§

delegate_scheduler_store
Delegate every SchedulerStore method to $field.
sql_execute
Execute a parameterized SQL statement on the store pool.
sql_fetch_all_map
Fetch all rows and map each through a closure.
sql_fetch_one_map
Fetch exactly one row and map it through a closure.
sql_fetch_optional_map
Fetch zero or one row and map it through a closure.

Structs§

SchedulerLeaderRow
SQL row shape for SchedulerLeader.
SqlSchedulerStore
SQL-backed SchedulerStore (PostgreSQL or SQLite).

Enums§

SqlDialect
SQL dialect for query variants.
SqlPool
Connection pool for a SQL backend.

Constants§

LEADER_ROW_ID
Fixed primary key for the singleton leader election row.

Functions§

bind_sql
SQLite uses ? placeholders; PostgreSQL uses $1, $2, …
row_to_worker
Map a SQL row to a Worker.
run_pool_key
Resolve the Redis / queue pool key for a run ("general" when unset).