fn fetch_real_size(&self) -> Result<(), CacheError> {
        let mut sz = 0u64;

        let iter = self
            .db
            .iterator_cf(&self.cf_by_name(Self::META_CF), IteratorMode::Start);
        for (key, val) in iter {
            // attempt to deserialize the data and add the size to the `sz` iterator
            if let Ok(entry) = bincode::deserialize::<ImageEntry>(&val).map_err(CacheError::Bincode)
            {
                sz += entry.get_bytes_len();
                continue;
            }
            // drop all entries that could not be successfully deserialized
            self.drop_entry(&key)?;
        }

        // store the new size and the last fetch
        self.db_size.store(sz, Ordering::SeqCst);
        self.last_fetch.store(now_as_millis(), Ordering::SeqCst);
        Ok(())
    }
/// Fetches the actual size of the database content by iterating through metadata.
Fetches the actual size of the database content by iterating through metadata.
Fetches the actual size of the database content by iterating through metadata .
fn fetch_real_size(&self) -> Result<(), CacheError> {
        let mut sz = 0u64;
        let iter = self
            .db
            .iterator_cf(&self.cf_by_name(Self::META_CF), IteratorMode::Start);
        for (key, val) in iter {
            // attempt to deserialize the data and add the size to the `sz` iterator
            if let Ok(entry) = bincode::deserialize::<ImageEntry>(&val).map_err(CacheError::Bincode)
            {
                sz += entry.get_bytes_len();
                continue;
            }
            // drop all entries that could not be successfully deserialized
            self.drop_entry(&key)?;
        }
        // store the new size and the last fetch
        self.db_size.store(sz, Ordering::SeqCst);
        self.last_fetch.store(now_as_millis(), Ordering::SeqCst);
        Ok(())
    }
fn fetch_real_size ( & self ) -> Result < ( ) , CacheError > { let mut sz = 0u64 ; let iter = self . db . iterator_cf ( & self . cf_by_name ( Self :: META_CF ) , IteratorMode :: Start ) ; for ( key , val ) in iter { // attempt to deserialize the data and add the size to the `sz` iterator if let Ok ( entry ) = bincode :: deserialize :: < ImageEntry > ( & val ) . map_err ( CacheError :: Bincode ) { sz += entry . get_bytes_len ( ) ; continue ; } // drop all entries that could not be successfully deserialized self . drop_entry ( & key ) ? ; } // store the new size and the last fetch self . db_size . store ( sz , Ordering :: SeqCst ) ; self . last_fetch . store ( now_as_millis ( ) , Ordering :: SeqCst ) ; Ok ( ( ) ) }
Fetches the actual size of the database content by iterating through metadata.
Fetches the actual size of the database content by iterating through metadata .
&self