// This is required during the transition for checking healthiness of the
// replica.
This is required during the transition for checking healthiness of the
replica.
This is required during the transition for checking healthiness of the replica .
async fn is_node_down(node: &str, client: &HttpsClient) -> bool {
    let req = Request::builder()
        .method(Method::GET)
        .uri(format!("https://{}/api/v2/status", node))
        .header(hyper::header::CONTENT_TYPE, "application/cbor")
        .body(Body::from(""))
        .unwrap();
    // Any failures w.r.t. to getting a status response from replica implies the
    // replica is down.
    match timeout(PROBE_TIMEOUT, client.request(req)).await {
        Err(_) => true,
        Ok(Err(_)) => true,
        Ok(Ok(response)) => {
            // This should always succeed. Check the serialization tests below.
            let cbor_response =
                serde_cbor::from_slice(&hyper::body::to_bytes(response).await.unwrap().to_vec())
                    .unwrap();
            // This should always succeed. Check the serialization tests below.
            if let Ok(status) = serde_cbor::value::from_value::<HttpStatusResponse>(cbor_response) {
                return Some(ReplicaHealthStatus::Healthy) != status.replica_health_status;
            } else {
                eprintln!("unable to get deserialize status");
            }
            true
        }
    }
}
async fn is_node_down ( node : & str , client : & HttpsClient ) -> bool { let req = Request :: builder ( ) . method ( Method :: GET ) . uri ( format ! ( " " node ) ) . header ( hyper :: header :: CONTENT_TYPE , " " ) . body ( Body :: from ( " " ) ) . unwrap ( ) ; // Any failures w.r.t. to getting a status response from replica implies the // replica is down. match timeout ( PROBE_TIMEOUT , client . request ( req ) ) . await { Err ( _ ) => true , Ok ( Err ( _ ) ) => true , Ok ( Ok ( response ) ) => { // This should always succeed. Check the serialization tests below. let cbor_response = serde_cbor :: from_slice ( & hyper :: body :: to_bytes ( response ) . await . unwrap ( ) . to_vec ( ) ) . unwrap ( ) ; // This should always succeed. Check the serialization tests below. if let Ok ( status ) = serde_cbor :: value :: from_value :: < HttpStatusResponse > ( cbor_response ) { return Some ( ReplicaHealthStatus :: Healthy ) != status . replica_health_status ; } else { eprintln ! ( " " ) ; } true } } }
This is required during the transition for checking healthiness of the
replica.
This is required during the transition for checking healthiness of the replica .
node
&str
client
&HttpsClient