fn send_heartbeat<T: Into<Option<Vec<u8>>>>(&mut self, to: u64, ctx: T) {
        // Attach the commit as min(to.matched, self.committed).
        // When the leader sends out heartbeat message,
        // the receiver(follower) might not be matched with the leader.
        // or it might not have all the committed entries.
        // The leader MUST NOT forward the follower's commit to
        // an unmatched index.
        let commit = self
            .prs
            .progress
            .get(&to)
            .unwrap()
            ._match
            .min(self.raft_log.committed);
        let mut m = Message {
            to,
            field_type: MsgHeartbeat,
            commit,
            ..Default::default()
        };
        if let Some(ctx) = ctx.into() {
            m.context = Bytes::from(ctx);
        }
        self.send(m);
    }
// send_heartbeat sends a heartbeat RPC to the given peer.
send_heartbeat sends a heartbeat RPC to the given peer.
send_heartbeat sends a heartbeat RPC to the given peer .
fn send_heartbeat<T: Into<Option<Vec<u8>>>>(&mut self, to: u64, ctx: T) {
        // Attach the commit as min(to.matched, self.committed).
        // When the leader sends out heartbeat message,
        // the receiver(follower) might not be matched with the leader.
        // or it might not have all the committed entries.
        // The leader MUST NOT forward the follower's commit to
        // an unmatched index.
        let commit = self
            .prs
            .progress
            .get(&to)
            .unwrap()
            ._match
            .min(self.raft_log.committed);
        let mut m = Message {
            to,
            field_type: MsgHeartbeat,
            commit,
            ..Default::default()
        };
        if let Some(ctx) = ctx.into() {
            m.context = Bytes::from(ctx);
        }
        self.send(m);
    }
fn send_heartbeat < T : Into < Option < Vec < u8 > > > > ( & mut self , to : u64 , ctx : T ) { // Attach the commit as min(to.matched, self.committed). // When the leader sends out heartbeat message, // the receiver(follower) might not be matched with the leader. // or it might not have all the committed entries. // The leader MUST NOT forward the follower's commit to // an unmatched index. let commit = self . prs . progress . get ( & to ) . unwrap ( ) . _match . min ( self . raft_log . committed ) ; let mut m = Message { to , field_type : MsgHeartbeat , commit , .. Default :: default ( ) } ; if let Some ( ctx ) = ctx . into ( ) { m . context = Bytes :: from ( ctx ) ; } self . send ( m ) ; }
send_heartbeat sends a heartbeat RPC to the given peer.
send_heartbeat sends a heartbeat RPC to the given peer .
&mut self
to
u64
ctx
T