chronon_backend_sql_common/lib.rs
1//! Shared SQL [`SchedulerStore`](chronon_core::store::SchedulerStore) for `PostgreSQL` and `SQLite`.
2//!
3//! **Audience:** backend and platform engineers implementing or extending SQL persistence.
4//!
5//! ## Stack position
6//!
7//! ```text
8//! chronon-backend-{postgres,sqlite} → chronon-backend-sql-common → chronon-core
9//! ```
10//!
11//! Integrators typically use the thin wrapper crates
12//! [`chronon_backend_postgres`](https://docs.rs/chronon-backend-postgres) or
13//! [`chronon_backend_sqlite`](https://docs.rs/chronon-backend-sqlite) rather than
14//! depending on this crate directly.
15//!
16//! ## Entry points
17//!
18//! - [`SqlSchedulerStore`] — connect, schema bootstrap, and trait implementation
19//! - [`SqlDialect`] / [`SqlPool`] — engine selection and pool wrapper
20//! - [`bind_sql`] — dialect-specific placeholder rewriting (`?` → `$1`, …)
21//!
22//! ## Prerequisites
23//!
24//! Schema bootstrap runs on connect. For parallel Postgres tests use
25//! [`SqlSchedulerStore::connect_postgres_isolated`].
26//!
27//! ## Example
28//!
29//! ```rust,no_run
30//! use chronon_backend_sql_common::SqlSchedulerStore;
31//!
32//! # async fn example() -> chronon_core::Result<()> {
33//! let store = SqlSchedulerStore::connect_sqlite("sqlite://:memory:").await?;
34//! # Ok(())
35//! # }
36//! ```
37
38mod backend;
39mod claims;
40mod coordinator;
41mod delegate;
42mod error_map;
43mod jobs;
44mod macros;
45mod row;
46mod runs;
47mod schema;
48mod store_impl;
49
50#[cfg(test)]
51mod store_smoke;
52
53pub use backend::{bind_sql, SqlDialect, SqlPool, SqlSchedulerStore};
54pub use coordinator::LEADER_ROW_ID;
55pub use row::run_pool_key;
56pub use row::{row_to_worker, SchedulerLeaderRow};