pub fn l2_table(&mut self, l1_index: usize) -> Result<Option<&[u64]>> {
        let l2_addr_disk = *self.l1_table.get(l1_index).ok_or(Error::InvalidIndex)?;

        if l2_addr_disk == 0 {
            // Reading from an unallocated cluster will return zeros.
            return Ok(None);
        }

        if !self.l2_cache.contains_key(l1_index) {
            // Not in the cache.
            let table = VecCache::from_vec(
                Self::read_l2_cluster(&mut self.raw_file, l2_addr_disk)
                    .map_err(Error::ReadingPointers)?,
            );
            let l1_table = &self.l1_table;
            let raw_file = &mut self.raw_file;
            self.l2_cache
                .insert(l1_index, table, |index, evicted| {
                    raw_file.write_pointer_table(
                        l1_table[index],
                        evicted.get_values(),
                        CLUSTER_USED_FLAG,
                    )
                })
                .map_err(Error::EvictingCache)?;
        }

        // The index must exist as it was just inserted if it didn't already.
        Ok(Some(self.l2_cache.get(l1_index).unwrap().get_values()))
    }
/// Returns an L2_table of cluster addresses, only used for debugging.
Returns an L2_table of cluster addresses, only used for debugging.
Returns an L2_table of cluster addresses only used for debugging .
pub fn l2_table(&mut self, l1_index: usize) -> Result<Option<&[u64]>> {
        let l2_addr_disk = *self.l1_table.get(l1_index).ok_or(Error::InvalidIndex)?;
        if l2_addr_disk == 0 {
            // Reading from an unallocated cluster will return zeros.
            return Ok(None);
        }
        if !self.l2_cache.contains_key(l1_index) {
            // Not in the cache.
            let table = VecCache::from_vec(
                Self::read_l2_cluster(&mut self.raw_file, l2_addr_disk)
                    .map_err(Error::ReadingPointers)?,
            );
            let l1_table = &self.l1_table;
            let raw_file = &mut self.raw_file;
            self.l2_cache
                .insert(l1_index, table, |index, evicted| {
                    raw_file.write_pointer_table(
                        l1_table[index],
                        evicted.get_values(),
                        CLUSTER_USED_FLAG,
                    )
                })
                .map_err(Error::EvictingCache)?;
        }
        // The index must exist as it was just inserted if it didn't already.
        Ok(Some(self.l2_cache.get(l1_index).unwrap().get_values()))
    }
pub fn l2_table ( & mut self , l1_index : usize ) -> Result < Option < & [ u64 ] > > { let l2_addr_disk = * self . l1_table . get ( l1_index ) . ok_or ( Error :: InvalidIndex ) ? ; if l2_addr_disk == 0 { // Reading from an unallocated cluster will return zeros. return Ok ( None ) ; } if ! self . l2_cache . contains_key ( l1_index ) { // Not in the cache. let table = VecCache :: from_vec ( Self :: read_l2_cluster ( & mut self . raw_file , l2_addr_disk ) . map_err ( Error :: ReadingPointers ) ? , ) ; let l1_table = & self . l1_table ; let raw_file = & mut self . raw_file ; self . l2_cache . insert ( l1_index , table , | index , evicted | { raw_file . write_pointer_table ( l1_table [ index ] , evicted . get_values ( ) , CLUSTER_USED_FLAG , ) } ) . map_err ( Error :: EvictingCache ) ? ; } // The index must exist as it was just inserted if it didn't already. Ok ( Some ( self . l2_cache . get ( l1_index ) . unwrap ( ) . get_values ( ) ) ) }
Returns an L2_table of cluster addresses, only used for debugging.
Returns an L2_table of cluster addresses only used for debugging .
&mut self
l1_index
usize
&mut self
l1_index
usize