pub fn restore(chg: &mut Changer, cs: &ConfState) -> Result<(Config, ProgressMap), String> {
    warn!("execute restore ");
    let (outgoing, mut incoming) = to_conf_change_single(cs);
    if outgoing.is_empty() {
        // No outgoing config, so just apply the incoming changes one by one.
        for cc in incoming.iter() {
            let cc = &mut vec![cc.clone()];
            let (cfg, progress) = chg.simple(cc)?;
            chg.tracker.config = cfg;
            chg.tracker.progress = progress;
        }
    } else {
        // The ConfState describes a joint configuration.
        //
        // First, apply all of the changes of the outgoing config one by one, so
        // that it temporarily becomes the incoming active config. For example,
        // if the config is (1 2 3)&(2 3 4), this will establish (2 3 4)&().
        for cc in outgoing.iter() {
            let cc = &mut vec![cc.clone()];
            let (cfg, progress) = chg.simple(cc)?;
            chg.tracker.config = cfg;
            chg.tracker.progress = progress;
        }

        // Now enter the joint state, which rotates the above additions into the
        // outgoing config, and adds the incoming config in. Continuing the
        // example above. we'd get (1 2 3)&(2 3 4), i.e. the incoming operations
        // would be removing 2,3,4 and then adding in 1,2,3 while transitioning
        // into a joint state.
        let (cfg, progress) = chg.enter_joint(cs.get_auto_leave(), &mut *incoming)?;
        chg.tracker.config = cfg;
        chg.tracker.progress = progress;
    }

    Ok((chg.tracker.config.clone(), chg.tracker.progress.clone()))
}
/// takes a Changer (which must represent an empty configuration), and
/// runs a sequence of changes enacting the configuration described in the
/// ConfState
///
/// TODO(tbg) it's silly that this takes a Changer. Unravel this by making sure
/// the Changer only needs a ProgressMap (not a whole Tracker) at which point
/// this can just take last_index and max_inflight directly instead and cook up
/// the results from that alone.
takes a Changer (which must represent an empty configuration), and
runs a sequence of changes enacting the configuration described in the
ConfState


takes a Changer ( which must represent an empty configuration ) and runs a sequence of changes enacting the configuration described in the ConfState
pub fn restore(chg: &mut Changer, cs: &ConfState) -> Result<(Config, ProgressMap), String> {
    warn!("execute restore ");
    let (outgoing, mut incoming) = to_conf_change_single(cs);
    if outgoing.is_empty() {
        // No outgoing config, so just apply the incoming changes one by one.
        for cc in incoming.iter() {
            let cc = &mut vec![cc.clone()];
            let (cfg, progress) = chg.simple(cc)?;
            chg.tracker.config = cfg;
            chg.tracker.progress = progress;
        }
    } else {
        // The ConfState describes a joint configuration.
        //
        // First, apply all of the changes of the outgoing config one by one, so
        // that it temporarily becomes the incoming active config. For example,
        // if the config is (1 2 3)&(2 3 4), this will establish (2 3 4)&().
        for cc in outgoing.iter() {
            let cc = &mut vec![cc.clone()];
            let (cfg, progress) = chg.simple(cc)?;
            chg.tracker.config = cfg;
            chg.tracker.progress = progress;
        }
        // Now enter the joint state, which rotates the above additions into the
        // outgoing config, and adds the incoming config in. Continuing the
        // example above. we'd get (1 2 3)&(2 3 4), i.e. the incoming operations
        // would be removing 2,3,4 and then adding in 1,2,3 while transitioning
        // into a joint state.
        let (cfg, progress) = chg.enter_joint(cs.get_auto_leave(), &mut *incoming)?;
        chg.tracker.config = cfg;
        chg.tracker.progress = progress;
    }
    Ok((chg.tracker.config.clone(), chg.tracker.progress.clone()))
}
pub fn restore ( chg : & mut Changer , cs : & ConfState ) -> Result < ( Config , ProgressMap ) , String > { warn ! ( " " ) ; let ( outgoing , mut incoming ) = to_conf_change_single ( cs ) ; if outgoing . is_empty ( ) { // No outgoing config, so just apply the incoming changes one by one. for cc in incoming . iter ( ) { let cc = & mut vec ! [ cc clone ( ) ] ; let ( cfg , progress ) = chg . simple ( cc ) ? ; chg . tracker . config = cfg ; chg . tracker . progress = progress ; } } else { // The ConfState describes a joint configuration. // // First, apply all of the changes of the outgoing config one by one, so // that it temporarily becomes the incoming active config. For example, // if the config is (1 2 3)&(2 3 4), this will establish (2 3 4)&(). for cc in outgoing . iter ( ) { let cc = & mut vec ! [ cc clone ( ) ] ; let ( cfg , progress ) = chg . simple ( cc ) ? ; chg . tracker . config = cfg ; chg . tracker . progress = progress ; } // Now enter the joint state, which rotates the above additions into the // outgoing config, and adds the incoming config in. Continuing the // example above. we'd get (1 2 3)&(2 3 4), i.e. the incoming operations // would be removing 2,3,4 and then adding in 1,2,3 while transitioning // into a joint state. let ( cfg , progress ) = chg . enter_joint ( cs . get_auto_leave ( ) , & mut * incoming ) ? ; chg . tracker . config = cfg ; chg . tracker . progress = progress ; } Ok ( ( chg . tracker . config . clone ( ) , chg . tracker . progress . clone ( ) ) ) }
takes a Changer (which must represent an empty configuration), and
runs a sequence of changes enacting the configuration described in the
ConfState
takes a Changer ( which must represent an empty configuration ) and runs a sequence of changes enacting the configuration described in the ConfState
chg
&mut Changer
cs
&ConfState