pub struct PoolRegistry { /* private fields */ }Expand description
Pools per tenant, with both caps applied.
Implementations§
Source§impl PoolRegistry
impl PoolRegistry
Sourcepub fn new(dsns: Arc<dyn TenantDsns>, clock: Arc<dyn Clock>) -> Self
pub fn new(dsns: Arc<dyn TenantDsns>, clock: Arc<dyn Clock>) -> Self
A registry with the default caps.
Sourcepub fn with_limits(
dsns: Arc<dyn TenantDsns>,
clock: Arc<dyn Clock>,
limits: PoolLimits,
total: usize,
idle: Duration,
) -> Self
pub fn with_limits( dsns: Arc<dyn TenantDsns>, clock: Arc<dyn Clock>, limits: PoolLimits, total: usize, idle: Duration, ) -> Self
A registry with explicit caps.
Sourcepub fn open_pools(&self) -> usize
pub fn open_pools(&self) -> usize
How many pools are open right now. For tests and /__health;
never a correctness signal — TENANT-ROUTING.md §12 makes the
registry row authoritative, precisely so that pool presence
cannot be mistaken for tenant health.
§Panics
If the pool map’s lock was poisoned by a panic in another thread. Poisoning here means a previous handout panicked mid-map, and continuing on a map in an unknown state is worse than stopping.
Trait Implementations§
Source§impl TenantDatabases for PoolRegistry
impl TenantDatabases for PoolRegistry
Source§fn database<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 Tenant,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Database>, TenantDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn database<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant: &'life1 Tenant,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Database>, TenantDbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
The tenant half, and all of it: a tenant’s key is its id.
Every way the lookup can miss is one answer to the caller — the tenant’s database is unreachable — because the distinction between “no DSN recorded” and “the server refused” is an operator’s question, not the caller’s, and answering it in a response body would describe the deployment to a stranger.
Auto Trait Implementations§
impl !Freeze for PoolRegistry
impl !RefUnwindSafe for PoolRegistry
impl !UnwindSafe for PoolRegistry
impl Send for PoolRegistry
impl Sync for PoolRegistry
impl Unpin for PoolRegistry
impl UnsafeUnpin for PoolRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more