pub struct ConnectionPoolManager { /* private fields */ }Expand description
Connection pool manager with mode awareness
Manages connection leases across multiple nodes with support for different pooling modes (session, transaction, statement).
Implementations§
Source§impl ConnectionPoolManager
impl ConnectionPoolManager
Sourcepub fn new(config: PoolModeConfig) -> Self
pub fn new(config: PoolModeConfig) -> Self
Create a new connection pool manager
Sourcepub async fn add_node(&self, node: &NodeEndpoint)
pub async fn add_node(&self, node: &NodeEndpoint)
Add a node to the pool manager
Sourcepub async fn remove_node(&self, node_id: &NodeId)
pub async fn remove_node(&self, node_id: &NodeId)
Remove a node from the pool manager
Sourcepub async fn acquire(
&self,
client_id: ClientId,
node_id: &NodeId,
) -> Result<ConnectionLease>
pub async fn acquire( &self, client_id: ClientId, node_id: &NodeId, ) -> Result<ConnectionLease>
Sourcepub async fn acquire_with_mode(
&self,
client_id: ClientId,
node_id: &NodeId,
mode: PoolingMode,
) -> Result<ConnectionLease>
pub async fn acquire_with_mode( &self, client_id: ClientId, node_id: &NodeId, mode: PoolingMode, ) -> Result<ConnectionLease>
Acquire a connection lease with specific mode
Sourcepub async fn release(&self, lease: ConnectionLease)
pub async fn release(&self, lease: ConnectionLease)
Release a connection lease
The connection will be reset and returned to the pool.
Sourcepub async fn release_and_close(&self, lease: ConnectionLease)
pub async fn release_and_close(&self, lease: ConnectionLease)
Release a connection lease and close it (don’t return to pool)
Sourcepub fn on_statement_complete(
&self,
lease: &mut ConnectionLease,
sql: &str,
) -> LeaseAction
pub fn on_statement_complete( &self, lease: &mut ConnectionLease, sql: &str, ) -> LeaseAction
Sourcepub fn metrics(&self) -> &PoolModeMetrics
pub fn metrics(&self) -> &PoolModeMetrics
Get metrics
Sourcepub fn config(&self) -> &PoolModeConfig
pub fn config(&self) -> &PoolModeConfig
Get configuration
Sourcepub fn default_mode(&self) -> PoolingMode
pub fn default_mode(&self) -> PoolingMode
Get default pooling mode
Sourcepub fn has_active_lease(&self, client_id: &ClientId) -> bool
pub fn has_active_lease(&self, client_id: &ClientId) -> bool
Check if a client has an active lease
Sourcepub fn active_lease_count(&self) -> usize
pub fn active_lease_count(&self) -> usize
Get the number of active leases
Sourcepub async fn evict_idle(&self)
pub async fn evict_idle(&self)
Evict idle connections from all pools
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectionPoolManager
impl !RefUnwindSafe for ConnectionPoolManager
impl Send for ConnectionPoolManager
impl Sync for ConnectionPoolManager
impl Unpin for ConnectionPoolManager
impl UnsafeUnpin for ConnectionPoolManager
impl !UnwindSafe for ConnectionPoolManager
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