pub fn track_access_for(&self, key: &[u8]) -> Result<Metadata> {
        let mut meta = match self.db.get(key) {
            Ok(Some(entry)) => Metadata::deserialize(&entry[..])?,
            Err(e) => return Err(ForcepError::MetaDb(e)),
            Ok(None) => return Err(ForcepError::MetaNotFound),
        };
        meta.last_accessed = now_since_epoch();
        meta.hits += 1;
        self.db
            .insert(key, Metadata::serialize(&meta)?)
            .map_err(ForcepError::MetaDb)?;
        Ok(meta)
    }
/// Will increment the `hits` counter and set the `last_accessed` value to now for the found
/// metadata key.
Will increment the `hits` counter and set the `last_accessed` value to now for the found
metadata key.
Will increment the ` hits ` counter and set the ` last_accessed ` value to now for the found metadata key .
pub fn track_access_for(&self, key: &[u8]) -> Result<Metadata> {
        let mut meta = match self.db.get(key) {
            Ok(Some(entry)) => Metadata::deserialize(&entry[..])?,
            Err(e) => return Err(ForcepError::MetaDb(e)),
            Ok(None) => return Err(ForcepError::MetaNotFound),
        };
        meta.last_accessed = now_since_epoch();
        meta.hits += 1;
        self.db
            .insert(key, Metadata::serialize(&meta)?)
            .map_err(ForcepError::MetaDb)?;
        Ok(meta)
    }
pub fn track_access_for ( & self , key : & [ u8 ] ) -> Result < Metadata > { let mut meta = match self . db . get ( key ) { Ok ( Some ( entry ) ) => Metadata :: deserialize ( & entry [ .. ] ) ? , Err ( e ) => return Err ( ForcepError :: MetaDb ( e ) ) , Ok ( None ) => return Err ( ForcepError :: MetaNotFound ) , } ; meta . last_accessed = now_since_epoch ( ) ; meta . hits += 1 ; self . db . insert ( key , Metadata :: serialize ( & meta ) ? ) . map_err ( ForcepError :: MetaDb ) ? ; Ok ( meta ) }
Will increment the `hits` counter and set the `last_accessed` value to now for the found
metadata key.
Will increment the ` hits ` counter and set the ` last_accessed ` value to now for the found metadata key .
&self
key
&[u8]
&self
key
&[u8]