fn new(
        metrics_registry: &MetricsRegistry,
        runtime_handle: runtime::Handle,
        tls: Arc<dyn TlsHandshake + Send + Sync>,
        proximity_map: Arc<ProximityMap>,
    ) -> XNetClientImpl {
        // TODO(MR-28) Make timeout configurable.
        let http_client: Client<TlsConnector, _> = Client::builder()
            .pool_idle_timeout(Some(Duration::from_secs(600)))
            .pool_max_idle_per_host(1)
            .executor(ExecuteOnRuntime(runtime_handle))
            .build(TlsConnector::new(tls));

        let response_body_size = metrics_registry.histogram_vec(
            METRIC_RESPONSE_BODY_SIZE,
            "Response body (encoded slice) size in bytes, by decode status.",
            // 10 B - 5 MB
            decimal_buckets(1, 6),
            &[LABEL_STATUS],
        );
        response_body_size.with_label_values(&[STATUS_SUCCESS]);
        response_body_size.with_label_values(&[STATUS_DECODE_ERROR]);

        XNetClientImpl {
            http_client,
            response_body_size,
            proximity_map,
        }
    }
/// Creates a new `XNetClientImpl` with a request timeout of 1 second and at
/// most 1 idle connection per host.
Creates a new `XNetClientImpl` with a request timeout of 1 second and at
most 1 idle connection per host.
Creates a new ` XNetClientImpl ` with a request timeout of 1 second and at most 1 idle connection per host .
fn new(
        metrics_registry: &MetricsRegistry,
        runtime_handle: runtime::Handle,
        tls: Arc<dyn TlsHandshake + Send + Sync>,
        proximity_map: Arc<ProximityMap>,
    ) -> XNetClientImpl {
        // TODO(MR-28) Make timeout configurable.
        let http_client: Client<TlsConnector, _> = Client::builder()
            .pool_idle_timeout(Some(Duration::from_secs(600)))
            .pool_max_idle_per_host(1)
            .executor(ExecuteOnRuntime(runtime_handle))
            .build(TlsConnector::new(tls));
        let response_body_size = metrics_registry.histogram_vec(
            METRIC_RESPONSE_BODY_SIZE,
            "Response body (encoded slice) size in bytes, by decode status.",
            // 10 B - 5 MB
            decimal_buckets(1, 6),
            &[LABEL_STATUS],
        );
        response_body_size.with_label_values(&[STATUS_SUCCESS]);
        response_body_size.with_label_values(&[STATUS_DECODE_ERROR]);
        XNetClientImpl {
            http_client,
            response_body_size,
            proximity_map,
        }
    }
fn new ( metrics_registry : & MetricsRegistry , runtime_handle : runtime :: Handle , tls : Arc < dyn TlsHandshake + Send + Sync > , proximity_map : Arc < ProximityMap > , ) -> XNetClientImpl { // TODO(MR-28) Make timeout configurable. let http_client : Client < TlsConnector , _ > = Client :: builder ( ) . pool_idle_timeout ( Some ( Duration :: from_secs ( 600 ) ) ) . pool_max_idle_per_host ( 1 ) . executor ( ExecuteOnRuntime ( runtime_handle ) ) . build ( TlsConnector :: new ( tls ) ) ; let response_body_size = metrics_registry . histogram_vec ( METRIC_RESPONSE_BODY_SIZE , " " , // 10 B - 5 MB decimal_buckets ( 1 , 6 ) , & [ LABEL_STATUS ] , ) ; response_body_size . with_label_values ( & [ STATUS_SUCCESS ] ) ; response_body_size . with_label_values ( & [ STATUS_DECODE_ERROR ] ) ; XNetClientImpl { http_client , response_body_size , proximity_map , } }
Creates a new `XNetClientImpl` with a request timeout of 1 second and at
most 1 idle connection per host.
Creates a new ` XNetClientImpl ` with a request timeout of 1 second and at most 1 idle connection per host .
metrics_registry
&MetricsRegistry
runtime_handle
runtime::Handle
tls
Arc<dyn TlsHandshake + Send + Sync>
proximity_map
Arc<ProximityMap>
metrics_registry
&MetricsRegistry
runtime_handle
runtime::Handle
tls
Arc<dyn TlsHandshake + Send + Sync>
proximity_map
Arc<ProximityMap>