fn send_single_append_rpc(
        &self,
        peer_index: usize,
    ) -> impl Future<Output = std::result::Result<(usize, usize, AppendEntriesReply), std::io::Error>>
    {
        assert!(
            self.state.is_leader(),
            "Non-leader Server {} send append request to S{} at term = {}",
            self.me,
            peer_index,
            self.state.term,
        );
        assert_ne!(
            peer_index, self.me,
            "Leader Server {} send append request to it self",
            self.me
        );
        // info!(
        //     "S{} send append request to S{}: next_index = {}, next_idx = {}",
        //     self.me, peer_index, next_index, next_idx
        // );
        let args = self.gen_append_args_for(peer_index);
        let log_num = args.entries.len();
        let net = net::NetLocalHandle::current();
        let peer = self.peers[peer_index];
        async move {
            net.call_timeout::<AppendEntriesArgs, AppendEntriesReply>(peer, args, RPC_TIMEOUT)
                .await
                .map(|res| (peer_index, log_num, res))
        }
    }
/// Check role as leader before call this method
Check role as leader before call this method
Check role as leader before call this method
fn send_single_append_rpc(
        &self,
        peer_index: usize,
    ) -> impl Future<Output = std::result::Result<(usize, usize, AppendEntriesReply), std::io::Error>>
    {
        assert!(
            self.state.is_leader(),
            "Non-leader Server {} send append request to S{} at term = {}",
            self.me,
            peer_index,
            self.state.term,
        );
        assert_ne!(
            peer_index, self.me,
            "Leader Server {} send append request to it self",
            self.me
        );
        // info!(
        //     "S{} send append request to S{}: next_index = {}, next_idx = {}",
        //     self.me, peer_index, next_index, next_idx
        // );
        let args = self.gen_append_args_for(peer_index);
        let log_num = args.entries.len();
        let net = net::NetLocalHandle::current();
        let peer = self.peers[peer_index];
        async move {
            net.call_timeout::<AppendEntriesArgs, AppendEntriesReply>(peer, args, RPC_TIMEOUT)
                .await
                .map(|res| (peer_index, log_num, res))
        }
    }
fn send_single_append_rpc ( & self , peer_index : usize , ) -> impl Future < Output = std :: result :: Result < ( usize , usize , AppendEntriesReply ) , std :: io :: Error > > { assert ! ( self state is_leader ( ) " " self me peer_index self state term ) ; assert_ne ! ( peer_index self me " " self me ) ; // info!( //     "S{} send append request to S{}: next_index = {}, next_idx = {}", //     self.me, peer_index, next_index, next_idx // ); let args = self . gen_append_args_for ( peer_index ) ; let log_num = args . entries . len ( ) ; let net = net :: NetLocalHandle :: current ( ) ; let peer = self . peers [ peer_index ] ; async move { net . call_timeout :: < AppendEntriesArgs , AppendEntriesReply > ( peer , args , RPC_TIMEOUT ) . await . map ( | res | ( peer_index , log_num , res ) ) } }
Check role as leader before call this method
Check role as leader before call this method
&self
peer_index
usize
&self
peer_index
usize