fn lc_instantiate_ctree_from_store_configs_and_replica<
    E: Element,
    A: Algorithm<E>,
    BaseTreeArity: Unsigned,
    SubTreeArity: Unsigned,
>(
    base_tree_leaves: usize,
    temp_dir_path: &PathBuf,
    rows_to_discard: Option<usize>,
) -> MerkleTree<E, A, LevelCacheStore<E, std::fs::File>, BaseTreeArity, SubTreeArity> {
    let replica_path = StoreConfig::data_path(temp_dir_path, "replica_path");
    let mut replica_file = std::fs::File::create(&replica_path).expect(
        "failed to create replica file [lc_instantiate_ctree_from_store_configs_and_replica]",
    );

    let sub_tree_arity = SubTreeArity::to_usize();

    let offsets = (0..sub_tree_arity)
        .map(|index| index * E::byte_len() * base_tree_leaves)
        .collect();

    let configs = (0..sub_tree_arity)
        .map(|index| {
            // prepare replica file content
            let config = StoreConfig::new(
                temp_dir_path,
                format!("{}{}", String::from("config_id"), index.to_string()),
                rows_to_discard
                    .expect("can't get rows_to_discard [lc_instantiate_ctree_from_store_configs_and_replica]"),
            );
            // instantiation of this temp tree is required for binding config to actual file on disk for subsequent dumping the data to replica
            let tree = instantiate_new_with_config::<E, A, DiskStore<E>, BaseTreeArity>(
                base_tree_leaves,
                Some(config.clone()),
            );
            dump_tree_data_to_replica::<E, BaseTreeArity>(
                tree.leafs(),
                tree.len(),
                &config,
                &mut replica_file,
            );

            // generate valid configs and bind them each to actual data of the tree
            let lc_config = StoreConfig::from_config(
                &config,
                format!("{}{}", String::from("lc_config_id"), index.to_string()),
                Some(tree.len()),
            );
            let mut tree = instantiate_new_with_config::<
                E,
                A,
                LevelCacheStore<E, std::fs::File>,
                BaseTreeArity,
            >(base_tree_leaves, Some(lc_config.clone()));
            tree.set_external_reader_path(&replica_path)
                .expect("can't set external reader path [lc_instantiate_ctree_from_store_configs_and_replica]");
            lc_config
        })
        .collect::<Vec<StoreConfig>>();

    MerkleTree::from_store_configs_and_replica(
        base_tree_leaves,
        &configs,
        &ReplicaConfig::new(&replica_path, offsets),
    )
    .expect(
        "failed to instantiate compound tree [lc_instantiate_ctree_from_store_configs_and_replica]",
    )
}
/// Compound LevelCacheStore trees can be instantiated via specific 'from_store_configs_and_replica' constructor
Compound LevelCacheStore trees can be instantiated via specific 'from_store_configs_and_replica' constructor
Compound LevelCacheStore trees can be instantiated via specific ' from_store_configs_and_replica ' constructor
fn lc_instantiate_ctree_from_store_configs_and_replica<
    E: Element,
    A: Algorithm<E>,
    BaseTreeArity: Unsigned,
    SubTreeArity: Unsigned,
>(
    base_tree_leaves: usize,
    temp_dir_path: &PathBuf,
    rows_to_discard: Option<usize>,
) -> MerkleTree<E, A, LevelCacheStore<E, std::fs::File>, BaseTreeArity, SubTreeArity> {
    let replica_path = StoreConfig::data_path(temp_dir_path, "replica_path");
    let mut replica_file = std::fs::File::create(&replica_path).expect(
        "failed to create replica file [lc_instantiate_ctree_from_store_configs_and_replica]",
    );
    let sub_tree_arity = SubTreeArity::to_usize();
    let offsets = (0..sub_tree_arity)
        .map(|index| index * E::byte_len() * base_tree_leaves)
        .collect();
    let configs = (0..sub_tree_arity)
        .map(|index| {
            // prepare replica file content
            let config = StoreConfig::new(
                temp_dir_path,
                format!("{}{}", String::from("config_id"), index.to_string()),
                rows_to_discard
                    .expect("can't get rows_to_discard [lc_instantiate_ctree_from_store_configs_and_replica]"),
            );
            // instantiation of this temp tree is required for binding config to actual file on disk for subsequent dumping the data to replica
            let tree = instantiate_new_with_config::<E, A, DiskStore<E>, BaseTreeArity>(
                base_tree_leaves,
                Some(config.clone()),
            );
            dump_tree_data_to_replica::<E, BaseTreeArity>(
                tree.leafs(),
                tree.len(),
                &config,
                &mut replica_file,
            );
            // generate valid configs and bind them each to actual data of the tree
            let lc_config = StoreConfig::from_config(
                &config,
                format!("{}{}", String::from("lc_config_id"), index.to_string()),
                Some(tree.len()),
            );
            let mut tree = instantiate_new_with_config::<
                E,
                A,
                LevelCacheStore<E, std::fs::File>,
                BaseTreeArity,
            >(base_tree_leaves, Some(lc_config.clone()));
            tree.set_external_reader_path(&replica_path)
                .expect("can't set external reader path [lc_instantiate_ctree_from_store_configs_and_replica]");
            lc_config
        })
        .collect::<Vec<StoreConfig>>();
    MerkleTree::from_store_configs_and_replica(
        base_tree_leaves,
        &configs,
        &ReplicaConfig::new(&replica_path, offsets),
    )
    .expect(
        "failed to instantiate compound tree [lc_instantiate_ctree_from_store_configs_and_replica]",
    )
}
fn lc_instantiate_ctree_from_store_configs_and_replica < E : Element , A : Algorithm < E > , BaseTreeArity : Unsigned , SubTreeArity : Unsigned , > ( base_tree_leaves : usize , temp_dir_path : & PathBuf , rows_to_discard : Option < usize > , ) -> MerkleTree < E , A , LevelCacheStore < E , std :: fs :: File > , BaseTreeArity , SubTreeArity > { let replica_path = StoreConfig :: data_path ( temp_dir_path , " " ) ; let mut replica_file = std :: fs :: File :: create ( & replica_path ) . expect ( " " , ) ; let sub_tree_arity = SubTreeArity :: to_usize ( ) ; let offsets = ( 0 .. sub_tree_arity ) . map ( | index | index * E :: byte_len ( ) * base_tree_leaves ) . collect ( ) ; let configs = ( 0 .. sub_tree_arity ) . map ( | index | { // prepare replica file content let config = StoreConfig :: new ( temp_dir_path , format ! ( " " String from ( " " ) index to_string ( ) ) , rows_to_discard . expect ( " " ) , ) ; // instantiation of this temp tree is required for binding config to actual file on disk for subsequent dumping the data to replica let tree = instantiate_new_with_config :: < E , A , DiskStore < E > , BaseTreeArity > ( base_tree_leaves , Some ( config . clone ( ) ) , ) ; dump_tree_data_to_replica :: < E , BaseTreeArity > ( tree . leafs ( ) , tree . len ( ) , & config , & mut replica_file , ) ; // generate valid configs and bind them each to actual data of the tree let lc_config = StoreConfig :: from_config ( & config , format ! ( " " String from ( " " ) index to_string ( ) ) , Some ( tree . len ( ) ) , ) ; let mut tree = instantiate_new_with_config :: < E , A , LevelCacheStore < E , std :: fs :: File > , BaseTreeArity , > ( base_tree_leaves , Some ( lc_config . clone ( ) ) ) ; tree . set_external_reader_path ( & replica_path ) . expect ( " " ) ; lc_config } ) . collect :: < Vec < StoreConfig > > ( ) ; MerkleTree :: from_store_configs_and_replica ( base_tree_leaves , & configs , & ReplicaConfig :: new ( & replica_path , offsets ) , ) . expect ( " " , ) }
Compound LevelCacheStore trees can be instantiated via specific 'from_store_configs_and_replica' constructor
Compound LevelCacheStore trees can be instantiated via specific ' from_store_configs_and_replica ' constructor
base_tree_leaves
usize
temp_dir_path
&PathBuf
rows_to_discard
Option<usize>