pub struct ConnectionHealthValidator { /* private fields */ }Expand description
Connection health validator
Validates that connections are healthy before returning them from the pool.
Implementations§
Source§impl ConnectionHealthValidator
impl ConnectionHealthValidator
Sourcepub fn new(validation_query: impl Into<String>, timeout: Duration) -> Self
pub fn new(validation_query: impl Into<String>, timeout: Duration) -> Self
Create a new health validator
Sourcepub fn validation_query(&self) -> &str
pub fn validation_query(&self) -> &str
Get the validation query
Sourcepub fn record_validation(&self, success: bool)
pub fn record_validation(&self, success: bool)
Record a validation attempt
Sourcepub fn stats(&self) -> ValidationStats
pub fn stats(&self) -> ValidationStats
Get validation statistics
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Calculate success rate
Trait Implementations§
Source§impl Debug for ConnectionHealthValidator
impl Debug for ConnectionHealthValidator
Auto Trait Implementations§
impl !Freeze for ConnectionHealthValidator
impl RefUnwindSafe for ConnectionHealthValidator
impl Send for ConnectionHealthValidator
impl Sync for ConnectionHealthValidator
impl Unpin for ConnectionHealthValidator
impl UnsafeUnpin for ConnectionHealthValidator
impl UnwindSafe for ConnectionHealthValidator
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