Lines
50 %
Functions
Branches
100 %
//! Per-user connection routing.
//!
//! [`registry`] owns the bookkeeping — residency, expiry and eviction — and is
//! always compiled so it can be tested directly. [`live`] holds everything that
//! touches a database and is excluded from server's own `cfg(test)` runs, where
//! `User::get_connection` short-circuits to the injected test pool.
pub(crate) mod registry;
#[cfg(not(test))]
mod live;
pub(in crate::user) use live::get_connection;
/// Connections of the tenant pools resident in this process.
pub(crate) fn tenant_usage() -> crate::telemetry::pools::PoolUsage {
live::usage()
}
/// Server's own tests never build tenant pools.
#[cfg(test)]
crate::telemetry::pools::PoolUsage::default()