pub struct UpstreamPool {
pub backends: Vec<Backend>,
pub client: Client<HttpsConnector<HttpConnector>, Body>,
pub healthy: Vec<AtomicBool>,
pub active_conns: Vec<AtomicUsize>,
pub max_connections: Option<usize>,
}Expand description
Pool of upstream backends with a shared HTTP client, health status, and active-connection counters.
Fields§
§backends: Vec<Backend>§client: Client<HttpsConnector<HttpConnector>, Body>§healthy: Vec<AtomicBool>Per-backend health flag. true = healthy, false = unhealthy.
active_conns: Vec<AtomicUsize>Per-backend active connection count (used by LeastConn).
max_connections: Option<usize>Optional total connection limit across all backends.
Implementations§
Source§impl UpstreamPool
impl UpstreamPool
pub fn from_config(config: &ProxyConfig) -> Self
Sourcepub fn is_healthy(&self, idx: usize) -> bool
pub fn is_healthy(&self, idx: usize) -> bool
Returns true if the backend at idx is currently marked healthy.
Sourcepub fn set_healthy(&self, idx: usize, val: bool)
pub fn set_healthy(&self, idx: usize, val: bool)
Mark a backend as healthy or unhealthy.
Sourcepub fn acquire_conn(&self, idx: usize) -> ConnGuard<'_>
pub fn acquire_conn(&self, idx: usize) -> ConnGuard<'_>
Increment the active connection count for a backend. Returns a guard that decrements on drop.
Sourcepub fn conn_count(&self, idx: usize) -> usize
pub fn conn_count(&self, idx: usize) -> usize
Get the current active connection count for a backend.
Sourcepub fn total_active_conns(&self) -> usize
pub fn total_active_conns(&self) -> usize
Total active connections across all backends.
Auto Trait Implementations§
impl Freeze for UpstreamPool
impl !RefUnwindSafe for UpstreamPool
impl Send for UpstreamPool
impl Sync for UpstreamPool
impl Unpin for UpstreamPool
impl UnsafeUnpin for UpstreamPool
impl !UnwindSafe for UpstreamPool
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