async fn connect(&self, ingester_address: Arc<str>) -> Result<Connection, Error> {
        let cached_connection = {
            let mut connections = self.connections.lock();
            if let Some(cached_connection) = connections.get(ingester_address.as_ref()) {
                cached_connection.clone()
            } else {
                // need to make a new one;
                let cached_connection = CachedConnection::new(&ingester_address);
                connections.insert(ingester_address.to_string(), cached_connection.clone());
                cached_connection
            }
        };
        cached_connection.connect().await
    }
/// Establish connection to given addr and perform handshake.
Establish connection to given addr and perform handshake.
Establish connection to given addr and perform handshake .
async fn connect(&self, ingester_address: Arc<str>) -> Result<Connection, Error> {
        let cached_connection = {
            let mut connections = self.connections.lock();
            if let Some(cached_connection) = connections.get(ingester_address.as_ref()) {
                cached_connection.clone()
            } else {
                // need to make a new one;
                let cached_connection = CachedConnection::new(&ingester_address);
                connections.insert(ingester_address.to_string(), cached_connection.clone());
                cached_connection
            }
        };
        cached_connection.connect().await
    }
async fn connect ( & self , ingester_address : Arc < str > ) -> Result < Connection , Error > { let cached_connection = { let mut connections = self . connections . lock ( ) ; if let Some ( cached_connection ) = connections . get ( ingester_address . as_ref ( ) ) { cached_connection . clone ( ) } else { // need to make a new one; let cached_connection = CachedConnection :: new ( & ingester_address ) ; connections . insert ( ingester_address . to_string ( ) , cached_connection . clone ( ) ) ; cached_connection } } ; cached_connection . connect ( ) . await }
Establish connection to given addr and perform handshake.
Establish connection to given addr and perform handshake .
&self
ingester_address
Arc<str>
&self
ingester_address
Arc<str>