IoContext

Trait IoContext 

Source
pub trait IoContext:
    Debug
    + Send
    + Sync {
    // Required methods
    fn base_dir(&self) -> &Path;
    fn get_compressor(&self, entry_id: &EntryID) -> Arc<LiquidCompressorStates>;
    fn arrow_path(&self, entry_id: &EntryID) -> PathBuf;
    fn liquid_path(&self, entry_id: &EntryID) -> PathBuf;
    fn read_file<'life0, 'async_trait>(
        &'life0 self,
        path: PathBuf,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_range<'life0, 'async_trait>(
        &'life0 self,
        path: PathBuf,
        range: Range<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn write_file<'life0, 'async_trait>(
        &'life0 self,
        path: PathBuf,
        data: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait for objects that can handle IO operations for the cache.

Required Methods§

Source

fn base_dir(&self) -> &Path

Get the base directory for the cache eviction, i.e., evicted data will be written to this directory.

Source

fn get_compressor(&self, entry_id: &EntryID) -> Arc<LiquidCompressorStates>

Get the compressor for an entry.

Source

fn arrow_path(&self, entry_id: &EntryID) -> PathBuf

Get the path to the arrow file for an entry.

Source

fn liquid_path(&self, entry_id: &EntryID) -> PathBuf

Get the path to the liquid file for an entry.

Source

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

Read the entire file at the given path.

Source

fn read_range<'life0, 'async_trait>( &'life0 self, path: PathBuf, range: Range<u64>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read a range of bytes from a file at the given path.

Source

fn write_file<'life0, 'async_trait>( &'life0 self, path: PathBuf, data: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write the entire buffer to a file at the given path.

Implementors§