pub async fn all_scenarios_for_one_chunk(
    // These delete predicates are applied at all stages of the chunk lifecycle
    chunk_stage_preds: Vec<&DeletePredicate>,
    // These delete predicates are applied to all chunks at their final stages
    at_end_preds: Vec<&DeletePredicate>,
    // Input data, formatted as line protocol. One chunk will be created for each measurement
    // (table) that appears in the input
    lp_lines: Vec<&str>,
    // Table to which the delete predicates will be applied
    delete_table_name: &str,
    // Partition of the chunk
    partition_key: &str,
) -> Vec<DbScenario> {
    let mut scenarios = vec![];
    // Go over chunk stages
    for chunk_stage in ChunkStage::all() {
        // Apply delete chunk_stage_preds to this chunk stage at all stages at and before that in
        // the lifecycle of the chunk. But we only need to get all delete times if
        // chunk_stage_preds is not empty, otherwise, produce only one scenario of each chunk stage
        let mut delete_times = vec![DeleteTime::begin_for(chunk_stage)];
        if !chunk_stage_preds.is_empty() {
            delete_times = DeleteTime::all_from_and_before(chunk_stage)
        };

        // Make delete predicates that happen when all chunks in their final stages
        let end_preds: Vec<Pred> = at_end_preds
            .iter()
            .map(|p| Pred::new(*p, DeleteTime::end_for(chunk_stage)))
            .collect();

        for delete_time in delete_times {
            // make delete predicate with time it happens
            let mut preds: Vec<Pred> = chunk_stage_preds
                .iter()
                .map(|p| Pred::new(*p, delete_time))
                .collect();
            // extend at-end predicates
            preds.extend(end_preds.clone());

            // make this specific chunk stage & delete predicates scenario
            scenarios.push(
                make_chunk_with_deletes_at_different_stages(
                    lp_lines.clone(),
                    chunk_stage,
                    preds,
                    Some(delete_table_name),
                    partition_key,
                )
                .await,
            );
        }
    }

    scenarios
}
/// All scenarios of chunk stages and their lifecycle moves for a given set of delete predicates.
/// If the delete predicates are empty, all scenarios of different chunk stages will be returned.
All scenarios of chunk stages and their lifecycle moves for a given set of delete predicates.
If the delete predicates are empty, all scenarios of different chunk stages will be returned.
All scenarios of chunk stages and their lifecycle moves for a given set of delete predicates . If the delete predicates are empty all scenarios of different chunk stages will be returned .
pub async fn all_scenarios_for_one_chunk(
    // These delete predicates are applied at all stages of the chunk lifecycle
    chunk_stage_preds: Vec<&DeletePredicate>,
    // These delete predicates are applied to all chunks at their final stages
    at_end_preds: Vec<&DeletePredicate>,
    // Input data, formatted as line protocol. One chunk will be created for each measurement
    // (table) that appears in the input
    lp_lines: Vec<&str>,
    // Table to which the delete predicates will be applied
    delete_table_name: &str,
    // Partition of the chunk
    partition_key: &str,
) -> Vec<DbScenario> {
    let mut scenarios = vec![];
    // Go over chunk stages
    for chunk_stage in ChunkStage::all() {
        // Apply delete chunk_stage_preds to this chunk stage at all stages at and before that in
        // the lifecycle of the chunk. But we only need to get all delete times if
        // chunk_stage_preds is not empty, otherwise, produce only one scenario of each chunk stage
        let mut delete_times = vec![DeleteTime::begin_for(chunk_stage)];
        if !chunk_stage_preds.is_empty() {
            delete_times = DeleteTime::all_from_and_before(chunk_stage)
        };
        // Make delete predicates that happen when all chunks in their final stages
        let end_preds: Vec<Pred> = at_end_preds
            .iter()
            .map(|p| Pred::new(*p, DeleteTime::end_for(chunk_stage)))
            .collect();
        for delete_time in delete_times {
            // make delete predicate with time it happens
            let mut preds: Vec<Pred> = chunk_stage_preds
                .iter()
                .map(|p| Pred::new(*p, delete_time))
                .collect();
            // extend at-end predicates
            preds.extend(end_preds.clone());
            // make this specific chunk stage & delete predicates scenario
            scenarios.push(
                make_chunk_with_deletes_at_different_stages(
                    lp_lines.clone(),
                    chunk_stage,
                    preds,
                    Some(delete_table_name),
                    partition_key,
                )
                .await,
            );
        }
    }
    scenarios
}
pub async fn all_scenarios_for_one_chunk ( // These delete predicates are applied at all stages of the chunk lifecycle chunk_stage_preds : Vec < & DeletePredicate > , // These delete predicates are applied to all chunks at their final stages at_end_preds : Vec < & DeletePredicate > , // Input data, formatted as line protocol. One chunk will be created for each measurement // (table) that appears in the input lp_lines : Vec < & str > , // Table to which the delete predicates will be applied delete_table_name : & str , // Partition of the chunk partition_key : & str , ) -> Vec < DbScenario > { let mut scenarios = vec ! [ ] ; // Go over chunk stages for chunk_stage in ChunkStage :: all ( ) { // Apply delete chunk_stage_preds to this chunk stage at all stages at and before that in // the lifecycle of the chunk. But we only need to get all delete times if // chunk_stage_preds is not empty, otherwise, produce only one scenario of each chunk stage let mut delete_times = vec ! [ DeleteTime begin_for ( chunk_stage ) ] ; if ! chunk_stage_preds . is_empty ( ) { delete_times = DeleteTime :: all_from_and_before ( chunk_stage ) } ; // Make delete predicates that happen when all chunks in their final stages let end_preds : Vec < Pred > = at_end_preds . iter ( ) . map ( | p | Pred :: new ( * p , DeleteTime :: end_for ( chunk_stage ) ) ) . collect ( ) ; for delete_time in delete_times { // make delete predicate with time it happens let mut preds : Vec < Pred > = chunk_stage_preds . iter ( ) . map ( | p | Pred :: new ( * p , delete_time ) ) . collect ( ) ; // extend at-end predicates preds . extend ( end_preds . clone ( ) ) ; // make this specific chunk stage & delete predicates scenario scenarios . push ( make_chunk_with_deletes_at_different_stages ( lp_lines . clone ( ) , chunk_stage , preds , Some ( delete_table_name ) , partition_key , ) . await , ) ; } } scenarios }
All scenarios of chunk stages and their lifecycle moves for a given set of delete predicates.
All scenarios of chunk stages and their lifecycle moves for a given set of delete predicates .
chunk_stage_preds
Vec<&DeletePredicate>
at_end_preds
Vec<&DeletePredicate>
lp_lines
Vec<&str>
delete_table_name
&str
partition_key
&str
chunk_stage_preds
Vec<&DeletePredicate>
at_end_preds
Vec<&DeletePredicate>
lp_lines
Vec<&str>
delete_table_name
&str
partition_key
&str