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 = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_byte_ranges<'life0, 'async_trait>(
&'life0 self,
ranges: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn file_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Async interface for reading byte ranges from an HDF5 file.
Modeled after async-tiff’s AsyncFileReader trait. Implementations exist
for object_store::ObjectStore, reqwest, and tokio::fs::File.
Required Methods§
Provided Methods§
Sourcefn get_byte_ranges<'life0, 'async_trait>(
&'life0 self,
ranges: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_byte_ranges<'life0, 'async_trait>(
&'life0 self,
ranges: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch multiple byte ranges. The default implementation calls get_bytes
sequentially; ObjectReader overrides this with get_ranges().
Sourcefn file_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn file_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the total file size, if known. Used by BlockCache::pre_warm
to fetch all blocks in parallel. The default returns None.
Trait Implementations§
Source§impl AsyncFileReader for Box<dyn AsyncFileReader + '_>
impl AsyncFileReader for Box<dyn AsyncFileReader + '_>
Source§fn get_bytes<'life0, 'async_trait>(
&'life0 self,
range: Range<u64>,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_bytes<'life0, 'async_trait>(
&'life0 self,
range: Range<u64>,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch the bytes in the given range.
Source§fn get_byte_ranges<'life0, 'async_trait>(
&'life0 self,
ranges: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_byte_ranges<'life0, 'async_trait>(
&'life0 self,
ranges: Vec<Range<u64>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch multiple byte ranges. The default implementation calls
get_bytes
sequentially; ObjectReader overrides this with get_ranges().Source§fn file_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn file_size<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the total file size, if known. Used by
BlockCache::pre_warm
to fetch all blocks in parallel. The default returns None.