Pipe

Trait Pipe 

Source
pub trait Pipe:
    Send
    + Sync
    + 'static
    + Debug {
    type Key;
    type Value;
    type Properties;

    // Required methods
    fn is_enabled(&self) -> bool;
    fn send(&self, piece: Piece<Self::Key, Self::Value, Self::Properties>);
    fn flush(
        &self,
        pieces: Vec<Piece<Self::Key, Self::Value, Self::Properties>>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send>>;
}
Expand description

Pipe is used to notify disk cache to cache entries from the in-memory cache.

Required Associated Types§

Source

type Key

Type of the key of the record.

Source

type Value

Type of the value of the record.

Source

type Properties

Type of the properties of the record.

Required Methods§

Source

fn is_enabled(&self) -> bool

Decide whether to send evicted entry to pipe.

Source

fn send(&self, piece: Piece<Self::Key, Self::Value, Self::Properties>)

Send the piece to the disk cache.

Source

fn flush( &self, pieces: Vec<Piece<Self::Key, Self::Value, Self::Properties>>, ) -> Pin<Box<dyn Future<Output = ()> + Send>>

Flush all the pieces to the disk cache in a asynchronous manner.

This function is called when the in-memory cache is flushed. It is expected to obey the io throttle of the disk cache.

Implementors§