fn update_rates(topology: &mut Topology, mut logs: HashMap<OperatorId,HashMap<OperatorInstanceId,Vec<Log>>>, epoch: Epoch)
{
    for (op_id,instance_logs) in logs.iter_mut()
    { // Aggregate rates per logical operator
        let &(idx,_) = topology.dictionary.get(op_id).expect("Operator not found in dictionary.");
        match topology.logical_graph.node_weight_mut(idx)
        {
            Some(ref mut op_info) =>
            {
                let op_logs = &mut op_info.rates;
                for (_,mut logs) in instance_logs.iter_mut()
                { // Make sure the given logs correspond to a single epoch, i.e. the given one
                    assert_eq!(logs.len(),1);
                    let mut ep = epoch;
                    for &(_,true_proc_rate,true_out_rate,obs_proc_rate,obs_out_rate) in logs.iter()
                    {// Add given rates to the existing ones (if any)
                        let op_log = op_logs.entry(ep).or_insert_with(|| Rates::default());
                        op_log.0 += true_proc_rate;
                        op_log.1 += true_out_rate;
                        op_log.2 += obs_proc_rate;
                        op_log.3 += obs_out_rate;
                        ep += 1;
                    }
                }
            }
            None => panic!("Operator not found in topology.")
        };
    }
}
/// Updates operator rates for a given epoch
///
/// # Arguments
///
/// `topology`: The topology struct to update
///
/// `logs`: A mapping from operators to rate logs per instance
///
/// `epoch`: The epoch number the `logs` correspond to
///
/// # Comments
///
/// * No previously recorded rates are cleared; rates in `logs` are simply added to the existing ones (if any)
Updates operator rates for a given epoch
Updates operator rates for a given epoch
fn update_rates(topology: &mut Topology, mut logs: HashMap<OperatorId,HashMap<OperatorInstanceId,Vec<Log>>>, epoch: Epoch)
{
    for (op_id,instance_logs) in logs.iter_mut()
    { // Aggregate rates per logical operator
        let &(idx,_) = topology.dictionary.get(op_id).expect("Operator not found in dictionary.");
        match topology.logical_graph.node_weight_mut(idx)
        {
            Some(ref mut op_info) =>
            {
                let op_logs = &mut op_info.rates;
                for (_,mut logs) in instance_logs.iter_mut()
                { // Make sure the given logs correspond to a single epoch, i.e. the given one
                    assert_eq!(logs.len(),1);
                    let mut ep = epoch;
                    for &(_,true_proc_rate,true_out_rate,obs_proc_rate,obs_out_rate) in logs.iter()
                    {// Add given rates to the existing ones (if any)
                        let op_log = op_logs.entry(ep).or_insert_with(|| Rates::default());
                        op_log.0 += true_proc_rate;
                        op_log.1 += true_out_rate;
                        op_log.2 += obs_proc_rate;
                        op_log.3 += obs_out_rate;
                        ep += 1;
                    }
                }
            }
            None => panic!("Operator not found in topology.")
        };
    }
}
fn update_rates ( topology : & mut Topology , mut logs : HashMap < OperatorId , HashMap < OperatorInstanceId , Vec < Log > > > , epoch : Epoch ) { for ( op_id , instance_logs ) in logs . iter_mut ( ) { // Aggregate rates per logical operator let & ( idx , _ ) = topology . dictionary . get ( op_id ) . expect ( " " ) ; match topology . logical_graph . node_weight_mut ( idx ) { Some ( ref mut op_info ) => { let op_logs = & mut op_info . rates ; for ( _ , mut logs ) in instance_logs . iter_mut ( ) { // Make sure the given logs correspond to a single epoch, i.e. the given one assert_eq ! ( logs len ( ) 1 ) ; let mut ep = epoch ; for & ( _ , true_proc_rate , true_out_rate , obs_proc_rate , obs_out_rate ) in logs . iter ( ) { // Add given rates to the existing ones (if any) let op_log = op_logs . entry ( ep ) . or_insert_with ( | | Rates :: default ( ) ) ; op_log . 0 += true_proc_rate ; op_log . 1 += true_out_rate ; op_log . 2 += obs_proc_rate ; op_log . 3 += obs_out_rate ; ep += 1 ; } } } None => panic ! ( " " ) } ; } }
Updates operator rates for a given epoch
Updates operator rates for a given epoch
topology
&mut Topology
logs
HashMap<OperatorId,HashMap<OperatorInstanceId,Vec<Log>>>
epoch
Epoch
topology
&mut Topology
logs
HashMap<OperatorId,HashMap<OperatorInstanceId,Vec<Log>>>
epoch
Epoch
comments
No previously recorded rates are cleared; rates in `logs` are simply added to the existing ones (if any)
No previously recorded rates are cleared ; rates in ` logs ` are simply added to the existing ones ( if any )