pub struct TenantPool { /* private fields */ }Expand description
Per-tenant connection pool
Implementations§
Source§impl TenantPool
impl TenantPool
Sourcepub fn new(tenant_id: TenantId, config: TenantPoolConfig) -> Self
pub fn new(tenant_id: TenantId, config: TenantPoolConfig) -> Self
Create a new tenant pool
Sourcepub fn config(&self) -> &TenantPoolConfig
pub fn config(&self) -> &TenantPoolConfig
Get pool configuration
Sourcepub fn active_count(&self) -> u32
pub fn active_count(&self) -> u32
Get active connection count
Sourcepub fn idle_count(&self) -> u32
pub fn idle_count(&self) -> u32
Get idle connection count
Sourcepub fn total_count(&self) -> u32
pub fn total_count(&self) -> u32
Get total connection count
Sourcepub fn waiting_count(&self) -> u32
pub fn waiting_count(&self) -> u32
Get waiting requests count
Sourcepub fn is_at_capacity(&self) -> bool
pub fn is_at_capacity(&self) -> bool
Check if pool is at capacity
Sourcepub fn can_create_connection(&self) -> bool
pub fn can_create_connection(&self) -> bool
Check if pool can accept new connection
Sourcepub fn has_available(&self) -> bool
pub fn has_available(&self) -> bool
Check if pool has available connections
Sourcepub fn record_acquire(&self)
pub fn record_acquire(&self)
Record connection acquired
Sourcepub fn record_release(&self)
pub fn record_release(&self)
Record connection released
Sourcepub fn record_created(&self)
pub fn record_created(&self)
Record connection created
Sourcepub fn record_closed(&self, was_active: bool)
pub fn record_closed(&self, was_active: bool)
Record connection closed
Sourcepub fn record_waiting(&self)
pub fn record_waiting(&self)
Record waiting request
Sourcepub fn record_not_waiting(&self)
pub fn record_not_waiting(&self)
Record request no longer waiting
Sourcepub fn utilization(&self) -> f32
pub fn utilization(&self) -> f32
Get pool utilization (0.0 to 1.0)
Sourcepub fn stats(&self) -> TenantPoolStats
pub fn stats(&self) -> TenantPoolStats
Get statistics snapshot
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TenantPool
impl RefUnwindSafe for TenantPool
impl Send for TenantPool
impl Sync for TenantPool
impl Unpin for TenantPool
impl UnsafeUnpin for TenantPool
impl UnwindSafe for TenantPool
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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