Skip to content

Commit

Permalink
Add tests and Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn committed Jan 13, 2025
1 parent 0bf4240 commit f7cd1d1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions vortex-file/src/v2/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ use vortex_array::ArrayData;
use vortex_error::VortexResult;

/// An execution driver is used to drive the execution of the scan operation.
///
/// It is passed a stream of futures that (typically) process a single split of the file.
/// Drivers are able to control the concurrency of the execution with [`futures::stream::buffered`],
/// as well as _where_ the futures are executed by spawning them onto a specific runtime or thread
/// pool.
///
/// Note that the futures encapsulate heavy CPU code such as filtering and decompression. To
/// offload keep I/O work separate, please see the [`crate::v2::io::IoDriver`] trait.
pub trait ExecDriver {
fn drive(
&self,
Expand Down
4 changes: 4 additions & 0 deletions vortex-file/src/v2/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ use crate::v2::segments::SegmentRequest;
///
/// Each request contains a [`vortex_layout::segments::SegmentId`] as well as a one-shot callback
/// channel to post back the result.
///
/// I/O drivers are able to coalesce, debounce, or otherwise group the requests, as well as control the concurrency
/// of the I/O operations with [`futures::stream::buffered`].
pub trait IoDriver: 'static {
// NOTE(ngates): this isn't an async_trait since it doesn't need to be object-safe or boxed.
fn drive(
&self,
stream: impl Stream<Item = SegmentRequest> + 'static,
Expand Down
2 changes: 1 addition & 1 deletion vortex-file/src/v2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod exec;
mod file;
mod footer;
pub mod io;
mod io;
mod open;
pub mod segments;
mod strategy;
Expand Down
1 change: 1 addition & 0 deletions vortex-file/src/v2/open/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct VortexOpenOptions {
split_by: SplitBy,
segment_cache: Option<Arc<dyn SegmentCache>>,
execution_mode: Option<ExecutionMode>,
// TODO(ngates): allow fully configurable I/O driver.
io_concurrency: usize,
}

Expand Down

0 comments on commit f7cd1d1

Please sign in to comment.