Trait ObjectReader

Source
pub trait ObjectReader: Send + Sync {
    // Required methods
    fn chunk_reader<'life0, 'async_trait>(
        &'life0 self,
        start: u64,
        length: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn AsyncRead>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sync_chunk_reader(
        &self,
        start: u64,
        length: usize,
    ) -> Result<Box<dyn Read + Send + Sync>>;
    fn length(&self) -> u64;

    // Provided method
    fn sync_reader(&self) -> Result<Box<dyn Read + Send + Sync>> { ... }
}
Expand description

Object Reader for one file in an object store.

Note that the dynamic dispatch on the reader might have some performance impacts.

Required Methods§

Source

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

Get reader for a part [start, start + length] in the file asynchronously

Source

fn sync_chunk_reader( &self, start: u64, length: usize, ) -> Result<Box<dyn Read + Send + Sync>>

Get reader for a part [start, start + length] in the file

Source

fn length(&self) -> u64

Get the size of the file

Provided Methods§

Source

fn sync_reader(&self) -> Result<Box<dyn Read + Send + Sync>>

Get reader for the entire file

Implementors§