Expand description
Unified database facade — one handle, three ecosystems.
ArclyDbPool is the single type user code injects regardless of which
driver is compiled in (db-sqlx, db-seaorm, db-diesel). It implements
DataSource, so it slots straight into the existing
DataSourceRegistry — tenant routing, read/write splitting, and
ReadAfterWritePin all apply unchanged, because primary/replica selection
happens here at the facade, before any driver is touched.
§Zero-lock guarantees
- Replica selection: one
AtomicUsizeround-robin. - SQLx / SeaORM pools are internally lock-free async acquires.
- Diesel (sync core) never runs on a worker thread: both
pool.get()and the query closure execute insidespawn_blocking(seedata::drivers::diesel).
§Feature gating
This module always compiles. Driver variants exist only when their Cargo
feature is enabled; with no db-* feature, the enums are uninhabited and
every operation reports a configuration error at the call site.
Structs§
- Arcly
DbPool - Primary + replicas for one logical database. Build at boot (plugin
on_init), register intoDataSourceRegistry<ArclyDbPool>, freeze. - DbHealth
Check - Readiness probe over every pool in a
DataSourceRegistry: pings each primary and reports the first failure asUnhealthynaming the pool.
Enums§
- DbDriver
- One concrete connection pool. Variants are feature-gated; constructors
live in
data::drivers::*. - Owned
DbConn - An acquired handle, decoupled from the pool’s lifetime so it can be held
across
.awaitpoints and moved into transactions.