pub struct BackendMap {
pub backends: HashMap<ClusterId, BackendList>,
pub max_failures: usize,
pub health_check_configs: HashMap<ClusterId, HealthCheckConfig>,
pub cluster_http2: HashMap<ClusterId, bool>,
}Fields§
§backends: HashMap<ClusterId, BackendList>§max_failures: usize§health_check_configs: HashMap<ClusterId, HealthCheckConfig>§cluster_http2: HashMap<ClusterId, bool>Whether the cluster’s backends speak HTTP/2 (cluster.http2 = true).
Mirrors the same backend-capability hint the mux router reads at
protocol/mux/router.rs::Router::connect. The health checker uses
it to switch the probe wire format from HTTP/1.1 to h2c so an
h2c-only backend is not probed with an HTTP/1.1 preface that
would always fail.
Implementations§
Source§impl BackendMap
impl BackendMap
pub fn new() -> BackendMap
Sourcepub fn set_cluster_http2(&mut self, cluster_id: &str, http2: bool)
pub fn set_cluster_http2(&mut self, cluster_id: &str, http2: bool)
Record (or clear) the cluster.http2 backend-capability hint for
cluster_id. The health checker reads the resulting map at probe
time so the wire format follows what the mux router will use to
connect to the same backends.
pub fn set_health_check_config( &mut self, cluster_id: &str, config: Option<HealthCheckConfig>, )
pub fn import_configuration_state( &mut self, backends: &HashMap<ClusterId, Vec<Backend>>, )
pub fn add_backend(&mut self, cluster_id: &str, backend: Backend)
Sourcepub fn remove_backend(
&mut self,
cluster_id: &str,
backend_address: &SocketAddr,
) -> Vec<String>
pub fn remove_backend( &mut self, cluster_id: &str, backend_address: &SocketAddr, ) -> Vec<String>
Remove every backend at backend_address from cluster_id and
return the list of backend_ids that were dropped. Callers (e.g.
Server::remove_backend) iterate over the returned ids to tear
down per-backend metrics so the identity used by the runtime
(address-keyed) matches the identity used by the metrics layer
(id-keyed) — see PR #1252 follow-up review MEDIUM-3.