lance_io::traits

Trait Reader

Source
pub trait Reader:
    Debug
    + Send
    + Sync
    + DeepSizeOf {
    // Required methods
    fn path(&self) -> &Path;
    fn block_size(&self) -> usize;
    fn io_parallelism(&self) -> usize;
    fn size<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_range<'life0, 'async_trait>(
        &'life0 self,
        range: Range<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn path(&self) -> &Path

Source

fn block_size(&self) -> usize

Suggest optimal I/O size per storage device.

Source

fn io_parallelism(&self) -> usize

Suggest optimal I/O parallelism per storage device.

Source

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

Object/File Size.

Source

fn get_range<'life0, 'async_trait>( &'life0 self, range: Range<usize>, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read a range of bytes from the object.

TODO: change to read_at()?

Source

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

Read all bytes from the object.

By default this reads the size in a separate IOP but some implementations may not need the size beforehand.

Implementors§