pub fn compact(t_aux: TemporaryAux<H, G>) -> Result<()> {
        let cached = |config: &StoreConfig| {
            Path::new(&StoreConfig::data_path(&config.path, &config.id)).exists()
        };

        if cached(&t_aux.tree_d_config) {
            let tree_d_size = t_aux
                .tree_d_config
                .size
                .context("tree_d config has no size")?;
            let tree_d_store: DiskStore<G::Domain> =
                DiskStore::new_from_disk(tree_d_size, &t_aux.tree_d_config).context("tree_d")?;
            let tree_d: Tree<G> =
                MerkleTree::from_data_store(tree_d_store, get_merkle_tree_leafs(tree_d_size))
                    .context("tree_d")?;
            tree_d.delete(t_aux.tree_d_config).context("tree_d")?;

            // If tree_d still existed and we just deleted it, compact tree_r_last here.
            assert!(cached(&t_aux.tree_r_last_config));
            let tree_r_last_size = t_aux
                .tree_r_last_config
                .size
                .context("tree_r_last config has no size")?;
            let mut tree_r_last_store: DiskStore<G::Domain> =
                DiskStore::new_from_disk(tree_r_last_size, &t_aux.tree_r_last_config)
                    .context("tree_r_last")?;
            tree_r_last_store.compact(
                t_aux.tree_r_last_config.clone(),
                StoreConfigDataVersion::One as u32,
            )?;
        }

        if cached(&t_aux.tree_c_config) {
            let tree_c_size = t_aux
                .tree_c_config
                .size
                .context("tree_c config has no size")?;
            let tree_c_store: DiskStore<H::Domain> =
                DiskStore::new_from_disk(tree_c_size, &t_aux.tree_c_config).context("tree_c")?;
            let tree_c: Tree<H> =
                MerkleTree::from_data_store(tree_c_store, get_merkle_tree_leafs(tree_c_size))
                    .context("tree_c")?;
            tree_c.delete(t_aux.tree_c_config).context("tree_c")?;
        }

        for i in 0..t_aux.labels.labels.len() {
            let cur_config = t_aux.labels.labels[i].clone();
            if cached(&cur_config) {
                DiskStore::<H::Domain>::delete(cur_config)
                    .with_context(|| format!("labels {}", i))?;
            }
        }

        Ok(())
    }
// "Compact" will discard all persisted data that is no longer
// required and compact the remaining "tree_r_last" merkle tree.
"Compact" will discard all persisted data that is no longer
required and compact the remaining "tree_r_last" merkle tree.
" Compact " will discard all persisted data that is no longer required and compact the remaining " tree_r_last " merkle tree .
pub fn compact(t_aux: TemporaryAux<H, G>) -> Result<()> {
        let cached = |config: &StoreConfig| {
            Path::new(&StoreConfig::data_path(&config.path, &config.id)).exists()
        };
        if cached(&t_aux.tree_d_config) {
            let tree_d_size = t_aux
                .tree_d_config
                .size
                .context("tree_d config has no size")?;
            let tree_d_store: DiskStore<G::Domain> =
                DiskStore::new_from_disk(tree_d_size, &t_aux.tree_d_config).context("tree_d")?;
            let tree_d: Tree<G> =
                MerkleTree::from_data_store(tree_d_store, get_merkle_tree_leafs(tree_d_size))
                    .context("tree_d")?;
            tree_d.delete(t_aux.tree_d_config).context("tree_d")?;
            // If tree_d still existed and we just deleted it, compact tree_r_last here.
            assert!(cached(&t_aux.tree_r_last_config));
            let tree_r_last_size = t_aux
                .tree_r_last_config
                .size
                .context("tree_r_last config has no size")?;
            let mut tree_r_last_store: DiskStore<G::Domain> =
                DiskStore::new_from_disk(tree_r_last_size, &t_aux.tree_r_last_config)
                    .context("tree_r_last")?;
            tree_r_last_store.compact(
                t_aux.tree_r_last_config.clone(),
                StoreConfigDataVersion::One as u32,
            )?;
        }
        if cached(&t_aux.tree_c_config) {
            let tree_c_size = t_aux
                .tree_c_config
                .size
                .context("tree_c config has no size")?;
            let tree_c_store: DiskStore<H::Domain> =
                DiskStore::new_from_disk(tree_c_size, &t_aux.tree_c_config).context("tree_c")?;
            let tree_c: Tree<H> =
                MerkleTree::from_data_store(tree_c_store, get_merkle_tree_leafs(tree_c_size))
                    .context("tree_c")?;
            tree_c.delete(t_aux.tree_c_config).context("tree_c")?;
        }
        for i in 0..t_aux.labels.labels.len() {
            let cur_config = t_aux.labels.labels[i].clone();
            if cached(&cur_config) {
                DiskStore::<H::Domain>::delete(cur_config)
                    .with_context(|| format!("labels {}", i))?;
            }
        }
        Ok(())
    }
pub fn compact ( t_aux : TemporaryAux < H , G > ) -> Result < ( ) > { let cached = | config : & StoreConfig | { Path :: new ( & StoreConfig :: data_path ( & config . path , & config . id ) ) . exists ( ) } ; if cached ( & t_aux . tree_d_config ) { let tree_d_size = t_aux . tree_d_config . size . context ( " " ) ? ; let tree_d_store : DiskStore < G :: Domain > = DiskStore :: new_from_disk ( tree_d_size , & t_aux . tree_d_config ) . context ( " " ) ? ; let tree_d : Tree < G > = MerkleTree :: from_data_store ( tree_d_store , get_merkle_tree_leafs ( tree_d_size ) ) . context ( " " ) ? ; tree_d . delete ( t_aux . tree_d_config ) . context ( " " ) ? ; // If tree_d still existed and we just deleted it, compact tree_r_last here. assert ! ( cached ( t_aux tree_r_last_config ) ) ; let tree_r_last_size = t_aux . tree_r_last_config . size . context ( " " ) ? ; let mut tree_r_last_store : DiskStore < G :: Domain > = DiskStore :: new_from_disk ( tree_r_last_size , & t_aux . tree_r_last_config ) . context ( " " ) ? ; tree_r_last_store . compact ( t_aux . tree_r_last_config . clone ( ) , StoreConfigDataVersion :: One as u32 , ) ? ; } if cached ( & t_aux . tree_c_config ) { let tree_c_size = t_aux . tree_c_config . size . context ( " " ) ? ; let tree_c_store : DiskStore < H :: Domain > = DiskStore :: new_from_disk ( tree_c_size , & t_aux . tree_c_config ) . context ( " " ) ? ; let tree_c : Tree < H > = MerkleTree :: from_data_store ( tree_c_store , get_merkle_tree_leafs ( tree_c_size ) ) . context ( " " ) ? ; tree_c . delete ( t_aux . tree_c_config ) . context ( " " ) ? ; } for i in 0 .. t_aux . labels . labels . len ( ) { let cur_config = t_aux . labels . labels [ i ] . clone ( ) ; if cached ( & cur_config ) { DiskStore :: < H :: Domain > :: delete ( cur_config ) . with_context ( | | format ! ( " " i ) ) ? ; } } Ok ( ( ) ) }
"Compact" will discard all persisted data that is no longer
required and compact the remaining "tree_r_last" merkle tree.
" Compact " will discard all persisted data that is no longer required and compact the remaining " tree_r_last " merkle tree .
t_aux
TemporaryAux<H, G>
t_aux
TemporaryAux<H, G>