Skip to main content

AsyncFileReader

Trait AsyncFileReader 

Source
pub trait AsyncFileReader:
    Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn get_bytes<'life0, 'async_trait>(
        &'life0 self,
        range: Range<u64>,
    ) -> Pin<Box<dyn Future<Output = AsyncTiffResult<Bytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn get_byte_ranges<'life0, 'async_trait>(
        &'life0 self,
        ranges: Vec<Range<u64>>,
    ) -> Pin<Box<dyn Future<Output = AsyncTiffResult<Vec<Bytes>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

The asynchronous interface used to read COG files

This was derived from the Parquet AsyncFileReader

Notes:

  1. ObjectReader, available when the object_store crate feature is enabled, implements this interface for ObjectStore.

  2. You can use [TokioReader] to implement AsyncFileReader for types that implement tokio::io::AsyncRead and tokio::io::AsyncSeek, for example tokio::fs::File.

Required Methods§

Source

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

Retrieve the bytes in range as part of a request for image data, not header metadata.

This is also used as the default implementation of MetadataFetch if not overridden.

Provided Methods§

Source

fn get_byte_ranges<'life0, 'async_trait>( &'life0 self, ranges: Vec<Range<u64>>, ) -> Pin<Box<dyn Future<Output = AsyncTiffResult<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve multiple byte ranges as part of a request for image data, not header metadata. The default implementation will call get_bytes sequentially

Trait Implementations§

Source§

impl AsyncFileReader for Box<dyn AsyncFileReader + '_>

This allows Box<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,

Source§

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

Retrieve the bytes in range as part of a request for image data, not header metadata. Read more
Source§

fn get_byte_ranges<'life0, 'async_trait>( &'life0 self, ranges: Vec<Range<u64>>, ) -> Pin<Box<dyn Future<Output = AsyncTiffResult<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve multiple byte ranges as part of a request for image data, not header metadata. The default implementation will call get_bytes sequentially

Implementations on Foreign Types§

Source§

impl AsyncFileReader for Box<dyn AsyncFileReader + '_>

This allows Box<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,

Source§

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

Source§

fn get_byte_ranges<'life0, 'async_trait>( &'life0 self, ranges: Vec<Range<u64>>, ) -> Pin<Box<dyn Future<Output = AsyncTiffResult<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl AsyncFileReader for Arc<dyn AsyncFileReader + '_>

This allows Arc<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,

Source§

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

Source§

fn get_byte_ranges<'life0, 'async_trait>( &'life0 self, ranges: Vec<Range<u64>>, ) -> Pin<Box<dyn Future<Output = AsyncTiffResult<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§