You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: established_client.rs
    path of file: ./repos/databend/src/meta/client/src
    
    the code of the file until where you have to start completion: // Copyright 2021 Datafuse Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by a
    
    fn update_client(self, client: &mut EstablishedClient) -> Result<Response<T>, Status> {
        // - Set the `current` node in endpoints to the leader if the request is forwarded by a follower to a leader.
        // - Store the error if received an error.

        self.map(|response| {
            let forwarded_leader = GrpcHelper::get_response_meta_leader(&response);

            // `leader` is set iff the request is forwarded by a follower to a leader
            if let Some(leader) = forwarded_leader {
                info!(
                    "to switch to use leader({}) for further RPC, endpoints: {}",
                    leader,
                    &*client.endpoints.lock(),
                );

                let update_leader_res = {
                    let mut endpoints = client.endpoints.lock();
                    let set_res = endpoints.set_current(Some(leader.to_string()));

                    if let Err(ref e) = set_res {
                        error!("fail to update leader: {:?}; endpoints: {}", e, endpoints);
                    }

                    set_res
                };

                info!(
                    "switch to use leader({}) for further RPC, result: {:?}",
                    leader, update_leader_res,
                );
            }

            response
        })
        .map_err(|status| {
            client.set_error(status.clone());
            status
        })
    }