pub fn create_flink_topology(file: &Path) -> Topology
{
    let mut topology = Topology::new();
    let file = File::open(&file).expect("Cannot open topology file.");
    let reader = BufReader::new(file);
    for line in reader.lines()
    {
        let line = line.unwrap();
        if line.len() == 0 || line.chars().next() == Some('#') { continue; }
        let fields: Vec<&str> = line.split(',').map(|x| x.trim()).collect();
        let inst1 = u32::from_str(&fields[2]).expect("Cannot parse the number of source operator instances.");
        let n1 = topology.add_unique_node(fields[0],fields[1],inst1);
        let inst2 = u32::from_str(&fields[5]).expect("Cannot parse the number of target operator instances.");
        let n2 = topology.add_unique_node(fields[3],fields[4],inst2);
        topology.add_unique_edge(n1,n2);
    }
    topology
}
/// Parses a Flink dataflow from a CSV file and creates a topology
///
/// # Arguments
///
/// `file`: The path to the CSV file
///
/// # Comments
///
/// * Each dataflow operator is represented as a triple of the form:
///
///   `id,name,number_of_instances`
///
/// * Each line in `file` represents a directed edge from an upstream to a downstream operator and has the form:
///
///   `id1,name1,number_of_instances1,id2,name2,number_of_instances2`
Parses a Flink dataflow from a CSV file and creates a topology
Parses a Flink dataflow from a CSV file and creates a topology
pub fn create_flink_topology(file: &Path) -> Topology
{
    let mut topology = Topology::new();
    let file = File::open(&file).expect("Cannot open topology file.");
    let reader = BufReader::new(file);
    for line in reader.lines()
    {
        let line = line.unwrap();
        if line.len() == 0 || line.chars().next() == Some('#') { continue; }
        let fields: Vec<&str> = line.split(',').map(|x| x.trim()).collect();
        let inst1 = u32::from_str(&fields[2]).expect("Cannot parse the number of source operator instances.");
        let n1 = topology.add_unique_node(fields[0],fields[1],inst1);
        let inst2 = u32::from_str(&fields[5]).expect("Cannot parse the number of target operator instances.");
        let n2 = topology.add_unique_node(fields[3],fields[4],inst2);
        topology.add_unique_edge(n1,n2);
    }
    topology
}
pub fn create_flink_topology ( file : & Path ) -> Topology { let mut topology = Topology :: new ( ) ; let file = File :: open ( & file ) . expect ( " " ) ; let reader = BufReader :: new ( file ) ; for line in reader . lines ( ) { let line = line . unwrap ( ) ; if line . len ( ) == 0 || line . chars ( ) . next ( ) == Some ( '#' ) { continue ; } let fields : Vec < & str > = line . split ( ',' ) . map ( | x | x . trim ( ) ) . collect ( ) ; let inst1 = u32 :: from_str ( & fields [ 2 ] ) . expect ( " " ) ; let n1 = topology . add_unique_node ( fields [ 0 ] , fields [ 1 ] , inst1 ) ; let inst2 = u32 :: from_str ( & fields [ 5 ] ) . expect ( " " ) ; let n2 = topology . add_unique_node ( fields [ 3 ] , fields [ 4 ] , inst2 ) ; topology . add_unique_edge ( n1 , n2 ) ; } topology }
Parses a Flink dataflow from a CSV file and creates a topology
Parses a Flink dataflow from a CSV file and creates a topology
file
&Path
file
&Path
comments
Each dataflow operator is represented as a triple of the form.

`id,name,number_of_instances`

Each line in `file` represents a directed edge from an upstream to a downstream operator and has the form.

`id1,name1,number_of_instances1,id2,name2,number_of_instances2`
Each dataflow operator is represented as a triple of the form . ` id name number_of_instances ` Each line in ` file ` represents a directed edge from an upstream to a downstream operator and has the form . ` id1 name1 number_of_instances1 id2 name2 number_of_instances2 `