Skip to main content

IoContext

Trait IoContext 

Source
pub trait IoContext:
    Debug
    + Send
    + Sync {
    // Required methods
    fn get_compressor(&self, entry_id: &EntryID) -> Arc<LiquidCompressorStates>;
    fn disk_path(&self, entry_id: &EntryID) -> PathBuf;
    fn read<'life0, 'async_trait>(
        &'life0 self,
        path: PathBuf,
        range: Option<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;

    // Provided methods
    fn add_squeeze_hint(
        &self,
        _entry_id: &EntryID,
        _expression: Arc<CacheExpression>,
    ) { ... }
    fn squeeze_hint(&self, _entry_id: &EntryID) -> Option<Arc<CacheExpression>> { ... }
}
Expand description

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

Required Methods§

Source

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

Get the compressor for an entry.

Source

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

Get the disk path for a cache entry.

Source

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

Read bytes from the file at the given path, optionally restricted to the provided range.

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.

Provided Methods§

Source

fn add_squeeze_hint( &self, _entry_id: &EntryID, _expression: Arc<CacheExpression>, )

Add a squeeze hint for an entry.

Source

fn squeeze_hint(&self, _entry_id: &EntryID) -> Option<Arc<CacheExpression>>

Get the squeeze hint for an entry. If None, the entry will be evicted to disk entirely. If Some, the entry will be squeezed according to the cache expressions previously recorded for this column. For example, if expression is ExtractDate32 { field: Date32Field::Year }, the entry will be squeezed to a crate::liquid_array::SqueezedDate32Array with the year component (Date32 or Timestamp input).

Implementors§