fn new_from_disk(store_range: usize, branches: usize, config: &StoreConfig) -> Result<Self> {
        let data_path = StoreConfig::data_path(&config.path, &config.id);

        let file = OpenOptions::new().write(true).read(true).open(data_path)?;
        let metadata = file.metadata()?;
        let store_size = metadata.len() as usize;

        // The LevelCacheStore base data layer must already be a
        // massaged next pow2 (guaranteed if created with
        // DiskStore::compact, which is the only supported method at
        // the moment).
        let size = get_merkle_tree_leafs(store_range, branches)?;
        ensure!(
            size == next_pow2(size),
            "Inconsistent merkle tree row_count detected"
        );

        // Values below in bytes.
        // Convert store_range from an element count to bytes.
        let store_range = store_range * E::byte_len();

        // Calculate cache start and the updated size with repect to
        // the data size.
        let cache_size =
            get_merkle_tree_cache_size(size, branches, config.rows_to_discard)? * E::byte_len();
        let cache_index_start = store_range - cache_size;

        // For a true v1 compatible store, this check should remain,
        // but since the store structure is identical otherwise this
        // method can be re-used to open v2 stores, so long as an
        // external_reader is set afterward.

        // Sanity checks that the StoreConfig rows_to_discard matches this
        // particular on-disk file.
        /*
        ensure!(
            store_size == size * E::byte_len() + cache_size,
            "Inconsistent store size detected"
        );
         */

        Ok(LevelCacheStore {
            len: store_range / E::byte_len(),
            elem_len: E::byte_len(),
            file,
            data_width: size,
            cache_index_start,
            loaded_from_disk: true,
            store_size,
            reader: None,
            _e: Default::default(),
        })
    }
// Used for opening v1 compacted DiskStores.
Used for opening v1 compacted DiskStores.
Used for opening v1 compacted DiskStores .
fn new_from_disk(store_range: usize, branches: usize, config: &StoreConfig) -> Result<Self> {
        let data_path = StoreConfig::data_path(&config.path, &config.id);
        let file = OpenOptions::new().write(true).read(true).open(data_path)?;
        let metadata = file.metadata()?;
        let store_size = metadata.len() as usize;
        // The LevelCacheStore base data layer must already be a
        // massaged next pow2 (guaranteed if created with
        // DiskStore::compact, which is the only supported method at
        // the moment).
        let size = get_merkle_tree_leafs(store_range, branches)?;
        ensure!(
            size == next_pow2(size),
            "Inconsistent merkle tree row_count detected"
        );
        // Values below in bytes.
        // Convert store_range from an element count to bytes.
        let store_range = store_range * E::byte_len();
        // Calculate cache start and the updated size with repect to
        // the data size.
        let cache_size =
            get_merkle_tree_cache_size(size, branches, config.rows_to_discard)? * E::byte_len();
        let cache_index_start = store_range - cache_size;
        // For a true v1 compatible store, this check should remain,
        // but since the store structure is identical otherwise this
        // method can be re-used to open v2 stores, so long as an
        // external_reader is set afterward.
        // Sanity checks that the StoreConfig rows_to_discard matches this
        // particular on-disk file.
        /*
        ensure!(
            store_size == size * E::byte_len() + cache_size,
            "Inconsistent store size detected"
        );
         */
        Ok(LevelCacheStore {
            len: store_range / E::byte_len(),
            elem_len: E::byte_len(),
            file,
            data_width: size,
            cache_index_start,
            loaded_from_disk: true,
            store_size,
            reader: None,
            _e: Default::default(),
        })
    }
fn new_from_disk ( store_range : usize , branches : usize , config : & StoreConfig ) -> Result < Self > { let data_path = StoreConfig :: data_path ( & config . path , & config . id ) ; let file = OpenOptions :: new ( ) . write ( true ) . read ( true ) . open ( data_path ) ? ; let metadata = file . metadata ( ) ? ; let store_size = metadata . len ( ) as usize ; // The LevelCacheStore base data layer must already be a // massaged next pow2 (guaranteed if created with // DiskStore::compact, which is the only supported method at // the moment). let size = get_merkle_tree_leafs ( store_range , branches ) ? ; ensure ! ( size next_pow2 ( size ) " " ) ; // Values below in bytes. // Convert store_range from an element count to bytes. let store_range = store_range * E :: byte_len ( ) ; // Calculate cache start and the updated size with repect to // the data size. let cache_size = get_merkle_tree_cache_size ( size , branches , config . rows_to_discard ) ? * E :: byte_len ( ) ; let cache_index_start = store_range - cache_size ; // For a true v1 compatible store, this check should remain, // but since the store structure is identical otherwise this // method can be re-used to open v2 stores, so long as an // external_reader is set afterward. // Sanity checks that the StoreConfig rows_to_discard matches this // particular on-disk file. /*
        ensure!(
            store_size == size * E::byte_len() + cache_size,
            "Inconsistent store size detected"
        );
         */ Ok ( LevelCacheStore { len : store_range / E :: byte_len ( ) , elem_len : E :: byte_len ( ) , file , data_width : size , cache_index_start , loaded_from_disk : true , store_size , reader : None , _e : Default :: default ( ) , } ) }
Used for opening v1 compacted DiskStores.
Used for opening v1 compacted DiskStores .
store_range
usize
branches
usize
config
&StoreConfig