pub fn generate_ledger_model<'a, I, IntoIt, S>(
        specs: I,
    ) -> impl Iterator<Item = SlotModel> + Clone + 'a
    where
        I: IntoIterator<Item = S, IntoIter = IntoIt>,
        IntoIt: Iterator<Item = S> + Clone + 'a,
        S: Borrow<SlotSpec>,
    {
        let mut coding_generator = CodingGenerator::default();

        specs.into_iter().map(move |spec| {
            let spec = spec.borrow();
            let slot = spec.slot;

            let chunks = spec
                .set_specs
                .iter()
                .map(|erasure_spec| {
                    let set_index = erasure_spec.set_index as usize;
                    let start_index = set_index * NUM_DATA;

                    let mut blobs = generate_test_blobs(0, NUM_DATA);
                    index_blobs(
                        &blobs,
                        &Keypair::new().pubkey(),
                        start_index as u64,
                        slot,
                        0,
                    );

                    let mut coding_blobs = coding_generator.next(&blobs);

                    blobs.drain(erasure_spec.num_data..);
                    coding_blobs.drain(erasure_spec.num_coding..);

                    ErasureSetModel {
                        start_index: start_index as u64,
                        set_index: set_index as u64,
                        data: blobs,
                        coding: coding_blobs,
                    }
                })
                .collect();

            SlotModel { slot, chunks }
        })
    }
/// Generates a model of a ledger containing certain data and coding blobs according to a spec
Generates a model of a ledger containing certain data and coding blobs according to a spec
Generates a model of a ledger containing certain data and coding blobs according to a spec
pub fn generate_ledger_model<'a, I, IntoIt, S>(
        specs: I,
    ) -> impl Iterator<Item = SlotModel> + Clone + 'a
    where
        I: IntoIterator<Item = S, IntoIter = IntoIt>,
        IntoIt: Iterator<Item = S> + Clone + 'a,
        S: Borrow<SlotSpec>,
    {
        let mut coding_generator = CodingGenerator::default();
        specs.into_iter().map(move |spec| {
            let spec = spec.borrow();
            let slot = spec.slot;
            let chunks = spec
                .set_specs
                .iter()
                .map(|erasure_spec| {
                    let set_index = erasure_spec.set_index as usize;
                    let start_index = set_index * NUM_DATA;
                    let mut blobs = generate_test_blobs(0, NUM_DATA);
                    index_blobs(
                        &blobs,
                        &Keypair::new().pubkey(),
                        start_index as u64,
                        slot,
                        0,
                    );
                    let mut coding_blobs = coding_generator.next(&blobs);
                    blobs.drain(erasure_spec.num_data..);
                    coding_blobs.drain(erasure_spec.num_coding..);
                    ErasureSetModel {
                        start_index: start_index as u64,
                        set_index: set_index as u64,
                        data: blobs,
                        coding: coding_blobs,
                    }
                })
                .collect();
            SlotModel { slot, chunks }
        })
    }
pub fn generate_ledger_model < ' a , I , IntoIt , S > ( specs : I , ) -> impl Iterator < Item = SlotModel > + Clone + ' a where I : IntoIterator < Item = S , IntoIter = IntoIt > , IntoIt : Iterator < Item = S > + Clone + ' a , S : Borrow < SlotSpec > , { let mut coding_generator = CodingGenerator :: default ( ) ; specs . into_iter ( ) . map ( move | spec | { let spec = spec . borrow ( ) ; let slot = spec . slot ; let chunks = spec . set_specs . iter ( ) . map ( | erasure_spec | { let set_index = erasure_spec . set_index as usize ; let start_index = set_index * NUM_DATA ; let mut blobs = generate_test_blobs ( 0 , NUM_DATA ) ; index_blobs ( & blobs , & Keypair :: new ( ) . pubkey ( ) , start_index as u64 , slot , 0 , ) ; let mut coding_blobs = coding_generator . next ( & blobs ) ; blobs . drain ( erasure_spec . num_data .. ) ; coding_blobs . drain ( erasure_spec . num_coding .. ) ; ErasureSetModel { start_index : start_index as u64 , set_index : set_index as u64 , data : blobs , coding : coding_blobs , } } ) . collect ( ) ; SlotModel { slot , chunks } } ) }
Generates a model of a ledger containing certain data and coding blobs according to a spec
Generates a model of a ledger containing certain data and coding blobs according to a spec
specs
I
specs
I