pub struct ConnectionPool<T: PooledConnection + Clone> { /* private fields */ }Expand description
Advanced connection pool implementation with monitoring and load balancing
Implementations§
Source§impl<T: PooledConnection + Clone> ConnectionPool<T>
impl<T: PooledConnection + Clone> ConnectionPool<T>
Sourcepub async fn new(
config: PoolConfig,
factory: Arc<dyn ConnectionFactory<T>>,
) -> Result<Self>
pub async fn new( config: PoolConfig, factory: Arc<dyn ConnectionFactory<T>>, ) -> Result<Self>
Create a new advanced connection pool with monitoring and circuit breaker
Sourcepub async fn get_connection(&self) -> Result<PooledConnectionHandle<T>>
pub async fn get_connection(&self) -> Result<PooledConnectionHandle<T>>
Get a connection from the pool with advanced load balancing and monitoring
Sourcepub async fn status(&self) -> PoolStatus
pub async fn status(&self) -> PoolStatus
Get comprehensive pool status with advanced metrics
Source§impl<T: PooledConnection + Clone> ConnectionPool<T>
Helper for creating connection pools from stream config
impl<T: PooledConnection + Clone> ConnectionPool<T>
Helper for creating connection pools from stream config
Sourcepub async fn new_from_config(
config: &StreamConfig,
factory: Arc<dyn ConnectionFactory<T>>,
) -> Result<Self>
pub async fn new_from_config( config: &StreamConfig, factory: Arc<dyn ConnectionFactory<T>>, ) -> Result<Self>
Create a connection pool from stream configuration
Sourcepub async fn health_check(&self) -> PoolStatus
pub async fn health_check(&self) -> PoolStatus
Health check with enhanced status
Sourcepub async fn get_detailed_metrics(&self) -> DetailedPoolMetrics
pub async fn get_detailed_metrics(&self) -> DetailedPoolMetrics
Get detailed pool metrics for monitoring
Sourcepub async fn reset_statistics(&self)
pub async fn reset_statistics(&self)
Reset pool statistics
Sourcepub async fn new_with_failover(
config: PoolConfig,
primary_factory: Arc<dyn ConnectionFactory<T>>,
secondary_factory: Arc<dyn ConnectionFactory<T>>,
failover_config: FailoverConfig,
) -> Result<Self>
pub async fn new_with_failover( config: PoolConfig, primary_factory: Arc<dyn ConnectionFactory<T>>, secondary_factory: Arc<dyn ConnectionFactory<T>>, failover_config: FailoverConfig, ) -> Result<Self>
Create a connection pool with failover support
Sourcepub async fn get_health_statistics(&self) -> OverallHealthStatistics
pub async fn get_health_statistics(&self) -> OverallHealthStatistics
Get health statistics from the health monitor
Sourcepub async fn get_reconnection_statistics(&self) -> ReconnectStatistics
pub async fn get_reconnection_statistics(&self) -> ReconnectStatistics
Get reconnection statistics
Sourcepub async fn get_failover_statistics(&self) -> Option<FailoverStatistics>
pub async fn get_failover_statistics(&self) -> Option<FailoverStatistics>
Get failover statistics if failover is enabled
Sourcepub async fn register_failure_callback<F>(&self, callback: F)
pub async fn register_failure_callback<F>(&self, callback: F)
Register a connection failure callback for automatic reconnection
Sourcepub async fn trigger_failover(&self) -> Result<()>
pub async fn trigger_failover(&self) -> Result<()>
Manually trigger failover (if configured)
Sourcepub fn has_failover(&self) -> bool
pub fn has_failover(&self) -> bool
Check if the pool has failover configured
Sourcepub async fn get_unhealthy_connections(&self) -> Vec<String>
pub async fn get_unhealthy_connections(&self) -> Vec<String>
Get unhealthy connections from health monitor
Sourcepub fn subscribe_health_events(&self) -> Receiver<HealthEvent>
pub fn subscribe_health_events(&self) -> Receiver<HealthEvent>
Subscribe to health monitoring events
Sourcepub fn subscribe_reconnect_events(&self) -> Receiver<ReconnectEvent>
pub fn subscribe_reconnect_events(&self) -> Receiver<ReconnectEvent>
Subscribe to reconnection events
Auto Trait Implementations§
impl<T> Freeze for ConnectionPool<T>
impl<T> !RefUnwindSafe for ConnectionPool<T>
impl<T> Send for ConnectionPool<T>
impl<T> Sync for ConnectionPool<T>
impl<T> Unpin for ConnectionPool<T>
impl<T> UnsafeUnpin for ConnectionPool<T>
impl<T> !UnwindSafe for ConnectionPool<T>
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.