pub struct Backend {
pub sticky_id: Option<String>,
pub backend_id: String,
pub address: SocketAddr,
pub status: BackendStatus,
pub retry_policy: RetryPolicyWrapper,
pub active_connections: usize,
pub active_requests: usize,
pub failures: usize,
pub load_balancing_parameters: Option<LoadBalancingParams>,
pub backup: bool,
pub connection_time: PeakEWMA,
pub health: HealthState,
}Fields§
§sticky_id: Option<String>§backend_id: String§address: SocketAddr§status: BackendStatus§retry_policy: RetryPolicyWrapper§active_connections: usize§active_requests: usize§failures: usize§load_balancing_parameters: Option<LoadBalancingParams>§backup: bool§connection_time: PeakEWMA§health: HealthStateImplementations§
Source§impl Backend
impl Backend
pub fn new( backend_id: &str, address: SocketAddr, sticky_id: Option<String>, load_balancing_parameters: Option<LoadBalancingParams>, backup: Option<bool>, ) -> Backend
pub fn set_closing(&mut self)
pub fn retry_policy(&mut self) -> &mut RetryPolicyWrapper
pub fn can_open(&self) -> bool
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Canonical “available” check used by per-backend metrics and cluster
availability accounting. Slightly more permissive than can_open():
a backend currently in an exponential-backoff wait window still
counts as available because the next call after the window ends
will route to it without operator intervention. The dashboard
reading must reflect “operationally up, not exhausted” rather than
“ready to receive this request” — flicking the gauge to 0 on
every transient backoff would drown out genuine is_down()
transitions. Pairs with BackendList::evaluate_availability,
which applies the same predicate cluster-wide.
pub fn inc_connections(&mut self) -> Option<usize>
Sourcepub fn dec_connections(&mut self) -> Option<usize>
pub fn dec_connections(&mut self) -> Option<usize>
TODO: normalize with saturating_sub()
pub fn set_connection_time(&mut self, dur: Duration)
pub fn peak_ewma_connection(&mut self) -> f64
pub fn try_connect(&mut self) -> Result<TcpStream, BackendError>
Trait Implementations§
impl StructuralPartialEq for Backend
Auto Trait Implementations§
impl Freeze for Backend
impl RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnsafeUnpin for Backend
impl UnwindSafe for Backend
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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