Skip to main content

CacheOps

Trait CacheOps 

Source
pub trait CacheOps: Send + Sync {
    // Required methods
    fn read_at<'life0, 'life1, 'async_trait>(
        &'life0 self,
        offset: u64,
        out: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = GibbloxResult<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write_at<'life0, 'life1, 'async_trait>(
        &'life0 self,
        offset: u64,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_len<'life0, 'async_trait>(
        &'life0 self,
        len: u64,
    ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Backend I/O abstraction for a single cache file.

Implementations are expected to be internally synchronized; the cache wrapper may call these methods concurrently from multiple tasks.

Required Methods§

Source

fn read_at<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, out: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = GibbloxResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read bytes at a fixed offset. Returns the number of bytes read.

Source

fn write_at<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write all bytes at a fixed offset.

Source

fn set_len<'life0, 'async_trait>( &'life0 self, len: u64, ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resize the underlying cache file.

Source

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

Persist pending data and metadata changes.

Implementations on Foreign Types§

Source§

impl<T> CacheOps for Arc<T>
where T: CacheOps + ?Sized,

Source§

fn read_at<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, out: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = GibbloxResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn write_at<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn set_len<'life0, 'async_trait>( &'life0 self, len: u64, ) -> Pin<Box<dyn Future<Output = GibbloxResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

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

Implementors§