pub trait HealthCheck {
// Required methods
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Backend,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn health_threshold(&self, success: bool) -> usize;
// Provided method
fn health_status_change<'life0, 'life1, 'async_trait>(
&'life0 self,
_target: &'life1 Backend,
_healthy: bool,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
HealthCheck is the interface to implement health check for backends
Required Methods§
Sourcefn check<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Backend,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Backend,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check the given backend.
`Ok(())`` if the check passes, otherwise the check fails.
Sourcefn health_threshold(&self, success: bool) -> usize
fn health_threshold(&self, success: bool) -> usize
This function defines how many consecutive checks should flip the health of a backend.
For example: with success``:
true`: this function should return the
number of check need to flip from unhealthy to healthy.