Skip to main content

Reader

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(&self) -> BoxFuture<'_, Result<usize>>;
    fn get_range(
        &self,
        range: Range<usize>,
    ) -> BoxFuture<'static, Result<Bytes>>;
    fn get_all(&self) -> BoxFuture<'_, Result<Bytes>>;
}

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(&self) -> BoxFuture<'_, Result<usize>>

Object/File Size.

Source

fn get_range(&self, range: Range<usize>) -> BoxFuture<'static, Result<Bytes>>

Read a range of bytes from the object.

TODO: change to read_at()?

Source

fn get_all(&self) -> BoxFuture<'_, Result<Bytes>>

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§