vortex_io

Trait VortexReadAt

Source
pub trait VortexReadAt:
    Send
    + Sync
    + Clone
    + 'static {
    // Required methods
    fn read_byte_range(
        &self,
        pos: u64,
        len: u64,
    ) -> impl Future<Output = Result<Bytes>> + 'static;
    fn size(&self) -> impl Future<Output = u64> + 'static;

    // Provided method
    fn performance_hint(&self) -> usize { ... }
}
Expand description

A trait for types that support asynchronous reads.

References to the type must be safe to share across threads, but spawned futures may be !Send to support thread-per-core implementations.

Readers must be cheaply cloneable to allow for easy sharing across tasks or threads.

Required Methods§

Source

fn read_byte_range( &self, pos: u64, len: u64, ) -> impl Future<Output = Result<Bytes>> + 'static

Request an asynchronous positional read. Results will be returned as an owned Bytes.

If the reader does not have the requested number of bytes, the returned Future will complete with an io::Error.

§Thread Safety

The resultant Future need not be Send, allowing implementations that use thread-per-core executors.

Source

fn size(&self) -> impl Future<Output = u64> + 'static

Asynchronously get the number of bytes of data readable.

For a file it will be the size in bytes, for an object in an ObjectStore it will be the ObjectMeta::size.

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl VortexReadAt for Bytes

Source§

fn read_byte_range( &self, pos: u64, len: u64, ) -> impl Future<Output = Result<Bytes>> + 'static

Source§

fn size(&self) -> impl Future<Output = u64> + 'static

Source§

impl VortexReadAt for Buffer

Source§

fn read_byte_range( &self, pos: u64, len: u64, ) -> impl Future<Output = Result<Bytes>> + 'static

Source§

fn size(&self) -> impl Future<Output = u64> + 'static

Source§

impl<T: VortexReadAt> VortexReadAt for Arc<T>

Source§

fn read_byte_range( &self, pos: u64, len: u64, ) -> impl Future<Output = Result<Bytes>> + 'static

Source§

fn performance_hint(&self) -> usize

Source§

fn size(&self) -> impl Future<Output = u64> + 'static

Implementors§