NodeCache

Trait NodeCache 

Source
pub trait NodeCache:
    Send
    + Sync
    + Debug
    + DynClone {
    type Input: Chunk;

    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        node: &'life1 Node<Self::Input>,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set<'life0, 'life1, 'async_trait>(
        &'life0 self,
        node: &'life1 Node<Self::Input>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn clear<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn name(&self) -> &'static str { ... }
}
Expand description

Caches nodes, typically by their path and hash Recommended to namespace on the storage

For now just bool return value for easy filter

Required Associated Types§

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<Self::Input>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn set<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<Self::Input>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optionally provide a method to clear the cache

Source

fn name(&self) -> &'static str

Trait Implementations§

Source§

impl<T: Chunk> NodeCache for &dyn NodeCache<Input = T>

Source§

type Input = T

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<T>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn set<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<T>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optionally provide a method to clear the cache
Source§

fn name(&self) -> &'static str

Source§

impl<T: Chunk> NodeCache for Box<dyn NodeCache<Input = T>>

Source§

type Input = T

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<T>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn set<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<T>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optionally provide a method to clear the cache
Source§

fn name(&self) -> &'static str

Implementations on Foreign Types§

Source§

impl<T: Chunk> NodeCache for Box<dyn NodeCache<Input = T>>

Source§

type Input = T

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<T>, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn set<'life0, 'life1, 'async_trait>( &'life0 self, node: &'life1 Node<T>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn name(&self) -> &'static str

Implementors§

Source§

impl NodeCache for MockNodeCache

Source§

impl<T: Chunk> NodeCache for &dyn NodeCache<Input = T>

Source§

type Input = T

Source§

impl<T: Chunk> NodeCache for Arc<dyn NodeCache<Input = T>>

Source§

type Input = T