vortex_layout/segments/
source.rs

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