Skip to main content

VortexReadAt

Trait VortexReadAt 

Source
pub trait VortexReadAt:
    Send
    + Sync
    + 'static {
    // Required methods
    fn concurrency(&self) -> usize;
    fn size(&self) -> BoxFuture<'static, VortexResult<u64>>;
    fn read_at(
        &self,
        offset: u64,
        length: usize,
        alignment: Alignment,
    ) -> BoxFuture<'static, VortexResult<BufferHandle>>;

    // Provided methods
    fn uri(&self) -> Option<&Arc<str>> { ... }
    fn coalesce_config(&self) -> Option<CoalesceConfig> { ... }
}
Expand description

The unified read trait for Vortex I/O sources.

This trait provides async positional reads to underlying storage and is used by the vortex-file crate to read data from files or object stores.

Required Methods§

Source

fn concurrency(&self) -> usize

Maximum number of concurrent I/O requests for that should be pulled from this source.

This value is used to control how many VortexReadAt::read_at calls can be in-flight simultaneously. Higher values allow more parallelism but consume more resources (memory, file descriptors, network connections).

Implementations should choose a value appropriate for their underlying storage characteristics. Low-latency sources benefit less from high concurrency, while high-latency sources (like remote storage) benefit significantly from issuing many requests in parallel.

Source

fn size(&self) -> BoxFuture<'static, VortexResult<u64>>

Asynchronously get the number of bytes of the underlying source.

Source

fn read_at( &self, offset: u64, length: usize, alignment: Alignment, ) -> BoxFuture<'static, VortexResult<BufferHandle>>

Request an asynchronous positional read. Results will be returned as a BufferHandle.

If the reader does not have the requested number of bytes, the returned Future will complete with an UnexpectedEof error.

Provided Methods§

Source

fn uri(&self) -> Option<&Arc<str>>

URI for debugging/logging. Returns None for anonymous sources.

Source

fn coalesce_config(&self) -> Option<CoalesceConfig>

Configuration for merging nearby I/O requests into fewer, larger reads.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl VortexReadAt for Arc<dyn VortexReadAt>

Source§

fn uri(&self) -> Option<&Arc<str>>

Source§

fn coalesce_config(&self) -> Option<CoalesceConfig>

Source§

fn concurrency(&self) -> usize

Source§

fn size(&self) -> BoxFuture<'static, VortexResult<u64>>

Source§

fn read_at( &self, offset: u64, length: usize, alignment: Alignment, ) -> BoxFuture<'static, VortexResult<BufferHandle>>

Source§

impl VortexReadAt for ByteBuffer

Source§

fn size(&self) -> BoxFuture<'static, VortexResult<u64>>

Source§

fn concurrency(&self) -> usize

Source§

fn read_at( &self, offset: u64, length: usize, alignment: Alignment, ) -> BoxFuture<'static, VortexResult<BufferHandle>>

Source§

impl<R: VortexReadAt> VortexReadAt for Arc<R>

Source§

fn uri(&self) -> Option<&Arc<str>>

Source§

fn coalesce_config(&self) -> Option<CoalesceConfig>

Source§

fn concurrency(&self) -> usize

Source§

fn size(&self) -> BoxFuture<'static, VortexResult<u64>>

Source§

fn read_at( &self, offset: u64, length: usize, alignment: Alignment, ) -> BoxFuture<'static, VortexResult<BufferHandle>>

Implementors§

Source§

impl VortexReadAt for ObjectStoreReadAt

Source§

impl VortexReadAt for FileReadAt

Source§

impl<R: VortexReadAt> VortexReadAt for Compat<R>

Compatibility adapter for VortexReadAt implementations that are based on Tokio.

Source§

impl<T: VortexReadAt + Clone> VortexReadAt for InstrumentedReadAt<T>