fn init_progress(
        &mut self,
        cfg: &mut Config,
        prs: &mut ProgressMap,
        id: u64,
        is_learner: bool,
    ) {
        if !is_learner {
            cfg.voters.incoming.insert(id);
        } else {
            cfg.learners.insert(id);
        }
        // TODO: why?
        // initializing the Progress with the last index means that the follower
        // can be probed (with the last index).
        //
        // TODO(tbg): seems awfully optimistic. Using the first index would be
        // better. The general expectation here is that the follower has no log
        // at all (and will thus likely need a snapshot), through the app may
        // have applied a snapshot out of band before adding the replica (thus
        // making the first index the better choice).
        let mut progress = Progress::new(0, self.last_index);
        progress.is_learner = is_learner;
        progress.inflights = Inflights::new(self.tracker.max_inflight);
        // When a node is first added, we should mark it as recently active.
        // Otherwise, check_quorum may cause use to step down if it is invoked
        // before the added node has had a chance to communicate with us.
        progress.recent_active = true;
        prs.insert(id, progress);
    }
// initializes a new progress for the given node or learner
initializes a new progress for the given node or learner
initializes a new progress for the given node or learner
fn init_progress(
        &mut self,
        cfg: &mut Config,
        prs: &mut ProgressMap,
        id: u64,
        is_learner: bool,
    ) {
        if !is_learner {
            cfg.voters.incoming.insert(id);
        } else {
            cfg.learners.insert(id);
        }
        // TODO: why?
        // initializing the Progress with the last index means that the follower
        // can be probed (with the last index).
        //
        // TODO(tbg): seems awfully optimistic. Using the first index would be
        // better. The general expectation here is that the follower has no log
        // at all (and will thus likely need a snapshot), through the app may
        // have applied a snapshot out of band before adding the replica (thus
        // making the first index the better choice).
        let mut progress = Progress::new(0, self.last_index);
        progress.is_learner = is_learner;
        progress.inflights = Inflights::new(self.tracker.max_inflight);
        // When a node is first added, we should mark it as recently active.
        // Otherwise, check_quorum may cause use to step down if it is invoked
        // before the added node has had a chance to communicate with us.
        progress.recent_active = true;
        prs.insert(id, progress);
    }
fn init_progress ( & mut self , cfg : & mut Config , prs : & mut ProgressMap , id : u64 , is_learner : bool , ) { if ! is_learner { cfg . voters . incoming . insert ( id ) ; } else { cfg . learners . insert ( id ) ; } // TODO: why? // initializing the Progress with the last index means that the follower // can be probed (with the last index). // // TODO(tbg): seems awfully optimistic. Using the first index would be // better. The general expectation here is that the follower has no log // at all (and will thus likely need a snapshot), through the app may // have applied a snapshot out of band before adding the replica (thus // making the first index the better choice). let mut progress = Progress :: new ( 0 , self . last_index ) ; progress . is_learner = is_learner ; progress . inflights = Inflights :: new ( self . tracker . max_inflight ) ; // When a node is first added, we should mark it as recently active. // Otherwise, check_quorum may cause use to step down if it is invoked // before the added node has had a chance to communicate with us. progress . recent_active = true ; prs . insert ( id , progress ) ; }
initializes a new progress for the given node or learner
initializes a new progress for the given node or learner
&mut self
cfg
&mut Config
prs
&mut ProgressMap
id
u64
is_learner
bool