vortex_layout/segments/
source.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use futures::future::BoxFuture;
5use vortex_buffer::ByteBuffer;
6use vortex_error::VortexResult;
7
8use crate::segments::SegmentId;
9/// Static future resolving to a segment byte buffer.
10pub type SegmentFuture = BoxFuture<'static, VortexResult<ByteBuffer>>;
11
12/// A trait for providing segment data to a [`crate::LayoutReader`].
13pub trait SegmentSource: 'static + Send + Sync {
14    /// Request a segment, returning a future that will eventually resolve to the segment data.
15    fn request(&self, id: SegmentId) -> SegmentFuture;
16}