pub struct ManagedPool { /* private fields */ }Expand description
Managed connection pool wrapper with statistics and health monitoring
Implementations§
Source§impl ManagedPool
impl ManagedPool
pub fn new(pool: Arc<dyn DatabasePoolTrait>, config: DatabasePoolConfig) -> Self
Sourcepub fn pool(&self) -> &dyn DatabasePoolTrait
pub fn pool(&self) -> &dyn DatabasePoolTrait
Get the underlying pool
Sourcepub async fn acquire(&self) -> Result<Box<dyn DatabaseConnection>, PoolError>
pub async fn acquire(&self) -> Result<Box<dyn DatabaseConnection>, PoolError>
Acquire a connection from the pool with statistics tracking and enhanced error handling
Sourcepub async fn execute(
&self,
sql: &str,
params: &[DatabaseValue],
) -> Result<u64, PoolError>
pub async fn execute( &self, sql: &str, params: &[DatabaseValue], ) -> Result<u64, PoolError>
Execute a query directly with the pool
Sourcepub async fn begin_transaction(
&self,
) -> Result<Box<dyn DatabaseTransaction>, PoolError>
pub async fn begin_transaction( &self, ) -> Result<Box<dyn DatabaseTransaction>, PoolError>
Begin a database transaction with statistics tracking
Sourcepub fn extended_stats(&self) -> ExtendedPoolStats
pub fn extended_stats(&self) -> ExtendedPoolStats
Get pool statistics with extended metrics
Sourcepub fn stats(&self) -> DatabasePoolStats
pub fn stats(&self) -> DatabasePoolStats
Get current pool statistics (legacy method for backward compatibility)
Sourcepub async fn health_check(&self) -> Result<Duration, PoolError>
pub async fn health_check(&self) -> Result<Duration, PoolError>
Check pool health with comprehensive error reporting
Sourcepub async fn detailed_health_check(&self) -> Result<PoolHealthReport, PoolError>
pub async fn detailed_health_check(&self) -> Result<PoolHealthReport, PoolError>
Check pool health and log detailed statistics
Sourcepub fn config(&self) -> &DatabasePoolConfig
pub fn config(&self) -> &DatabasePoolConfig
Get connection pool configuration
Auto Trait Implementations§
impl !Freeze for ManagedPool
impl !RefUnwindSafe for ManagedPool
impl Send for ManagedPool
impl Sync for ManagedPool
impl Unpin for ManagedPool
impl !UnwindSafe for ManagedPool
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