soma_mcp_client/upstream/pool/health.rs
1use crate::upstream::{UpstreamError, UpstreamHealth};
2
3impl super::UpstreamPool {
4 pub fn upstream_health(&self, upstream: &str) -> Result<UpstreamHealth, UpstreamError> {
5 self.with_entry(upstream, |entry| Ok(entry.snapshot.health.clone()))
6 }
7
8 pub fn connected_count(&self) -> usize {
9 self.snapshots()
10 .iter()
11 .filter(|snapshot| snapshot.health.is_routable())
12 .count()
13 }
14}
15
16#[cfg(test)]
17#[path = "health_tests.rs"]
18mod tests;