Skip to main content

RangeReader

Trait RangeReader 

Source
pub trait RangeReader<K>: Send + Sync {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn read_range<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 K,
        range: Range<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An immutable source capable of reading byte ranges.

Implementations must return exactly range.len() bytes on success. A CachedReader checks this contract before admitting a response.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Source-specific error.

Required Methods§

Source

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

Reads the requested byte range for key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<K, R> RangeReader<K> for CachedReader<K, R>
where K: Ord + Clone + Send + Sync, R: RangeReader<K> + ?Sized,