fn make_learner(&mut self, cfg: &mut Config, prs: &mut ProgressMap, id: u64) {
        info!("add a learner, id={}", id);
        let pro = prs.get(&id);
        if pro.is_none() {
            self.init_progress(cfg, prs, id, true);
            return;
        }
        let pro = pro.unwrap().clone();
        if pro.is_learner {
            return;
        }

        self.remove(cfg, prs, id);
        // ... but save the progress
        prs.insert(id, pro);

        // NB: Use LeanersNext if we can't add the learner to learners directly, i.e.
        // if the peer is still tracked as a voter in the outgoing config. It will
        // be turned into a learner in leave_joint().
        //
        // Otherwise, add a regular learner right away.
        if cfg.voters.outgoing.contains(&id) {
            cfg.learners_next.insert(id);
        } else {
            prs.get_mut(&id).map(|pro| pro.is_learner = true);
            cfg.learners.insert(id);
        }
    }
// make_learner makes the given ID a learner or stages it to be a leaner once
// an active joint configuration is existed.
//
// The former happens when the peers is not a part of the outgoing config, in
// which case we either add a new learner or demote a voter in the incoming
// config.
// The latter case occurs when the configuration is joint and the peer is a
// voter in the outgoing config. In that case, wo do not want to add the peer
// as a learner because then we'd have to track a peer as a voter and learner
// simultaneously. Insted, we add the learner to LeanersNext. so that it will
// be added to learners the moment the outgoing config is removed by leave_joint().
make_learner makes the given ID a learner or stages it to be a leaner once
an active joint configuration is existed.

The former happens when the peers is not a part of the outgoing config, in
which case we either add a new learner or demote a voter in the incoming
config.
The latter case occurs when the configuration is joint and the peer is a
voter in the outgoing config. In that case, wo do not want to add the peer
as a learner because then we'd have to track a peer as a voter and learner
simultaneously. Insted, we add the learner to LeanersNext. so that it will
be added to learners the moment the outgoing config is removed by leave_joint().
make_learner makes the given ID a learner or stages it to be a leaner once an active joint configuration is existed . The former happens when the peers is not a part of the outgoing config in which case we either add a new learner or demote a voter in the incoming config . The latter case occurs when the configuration is joint and the peer is a voter in the outgoing config . In that case wo do not want to add the peer as a learner because then we ' d have to track a peer as a voter and learner simultaneously . Insted we add the learner to LeanersNext . so that it will be added to learners the moment the outgoing config is removed by leave_joint () .
fn make_learner(&mut self, cfg: &mut Config, prs: &mut ProgressMap, id: u64) {
        info!("add a learner, id={}", id);
        let pro = prs.get(&id);
        if pro.is_none() {
            self.init_progress(cfg, prs, id, true);
            return;
        }
        let pro = pro.unwrap().clone();
        if pro.is_learner {
            return;
        }
        self.remove(cfg, prs, id);
        // ... but save the progress
        prs.insert(id, pro);
        // NB: Use LeanersNext if we can't add the learner to learners directly, i.e.
        // if the peer is still tracked as a voter in the outgoing config. It will
        // be turned into a learner in leave_joint().
        //
        // Otherwise, add a regular learner right away.
        if cfg.voters.outgoing.contains(&id) {
            cfg.learners_next.insert(id);
        } else {
            prs.get_mut(&id).map(|pro| pro.is_learner = true);
            cfg.learners.insert(id);
        }
    }
fn make_learner ( & mut self , cfg : & mut Config , prs : & mut ProgressMap , id : u64 ) { info ! ( " " id ) ; let pro = prs . get ( & id ) ; if pro . is_none ( ) { self . init_progress ( cfg , prs , id , true ) ; return ; } let pro = pro . unwrap ( ) . clone ( ) ; if pro . is_learner { return ; } self . remove ( cfg , prs , id ) ; // ... but save the progress prs . insert ( id , pro ) ; // NB: Use LeanersNext if we can't add the learner to learners directly, i.e. // if the peer is still tracked as a voter in the outgoing config. It will // be turned into a learner in leave_joint(). // // Otherwise, add a regular learner right away. if cfg . voters . outgoing . contains ( & id ) { cfg . learners_next . insert ( id ) ; } else { prs . get_mut ( & id ) . map ( | pro | pro . is_learner = true ) ; cfg . learners . insert ( id ) ; } }
make_learner makes the given ID a learner or stages it to be a leaner once
an active joint configuration is existed.
make_learner makes the given ID a learner or stages it to be a leaner once an active joint configuration is existed .
&mut self
cfg
&mut Config
prs
&mut ProgressMap
id
u64