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§
Sourcetype Properties
type Properties
Type of the properties of the record.
Required Methods§
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Decide whether to send evicted entry to pipe.
Sourcefn send(&self, piece: Piece<Self::Key, Self::Value, Self::Properties>)
fn send(&self, piece: Piece<Self::Key, Self::Value, Self::Properties>)
Send the piece to the disk cache.
Sourcefn flush(
&self,
pieces: Vec<Piece<Self::Key, Self::Value, Self::Properties>>,
) -> Pin<Box<dyn Future<Output = ()> + Send>>
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.