Trait bogrep::Caching

source ·
pub trait Caching: Clone {
    // Required methods
    fn mode(&self) -> &CacheMode;
    fn modes() -> [CacheMode; 2];
    fn is_empty(&self) -> bool;
    fn exists(&self, bookmark: &TargetBookmark) -> bool;
    fn open(
        &self,
        bookmark: &TargetBookmark
    ) -> Result<Option<impl Read>, BogrepError>;
    fn get(
        &self,
        bookmark: &TargetBookmark
    ) -> Result<Option<String>, BogrepError>;
    fn add<'life0, 'life1, 'async_trait>(
        &'life0 self,
        html: String,
        bookmark: &'life1 mut TargetBookmark
    ) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn replace<'life0, 'life1, 'async_trait>(
        &'life0 self,
        html: String,
        bookmark: &'life1 mut TargetBookmark
    ) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bookmark: &'life1 mut TargetBookmark
    ) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        bookmarks: &'life1 mut TargetBookmarks
    ) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn clear(&self, bookmarks: &mut TargetBookmarks) -> Result<(), BogrepError>;
}
Expand description

A trait to manage the cache in a file system or a mock cache used in testing.

Required Methods§

source

fn mode(&self) -> &CacheMode

source

fn modes() -> [CacheMode; 2]

source

fn is_empty(&self) -> bool

source

fn exists(&self, bookmark: &TargetBookmark) -> bool

Check if content of bookmark exists in cache.

source

fn open( &self, bookmark: &TargetBookmark ) -> Result<Option<impl Read>, BogrepError>

Open the cached file for a bookmark.

source

fn get(&self, bookmark: &TargetBookmark) -> Result<Option<String>, BogrepError>

Get the content of a bookmark from cache.

source

fn add<'life0, 'life1, 'async_trait>( &'life0 self, html: String, bookmark: &'life1 mut TargetBookmark ) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add the content of a bookmark to cache.

source

fn replace<'life0, 'life1, 'async_trait>( &'life0 self, html: String, bookmark: &'life1 mut TargetBookmark ) -> Pin<Box<dyn Future<Output = Result<String, BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Replace the content of a bookmark in cache.

source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, bookmark: &'life1 mut TargetBookmark ) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove the content of a bookmark from cache.

source

fn remove_all<'life0, 'life1, 'async_trait>( &'life0 self, bookmarks: &'life1 mut TargetBookmarks ) -> Pin<Box<dyn Future<Output = Result<(), BogrepError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove the content of multiple bookmarks from cache.

source

fn clear(&self, bookmarks: &mut TargetBookmarks) -> Result<(), BogrepError>

Clear the cache, i.e. remove all files in the cache directory.

Object Safety§

This trait is not object safe.

Implementors§