From d6a24756ef47efd0947a1f89bac245ee4db67743 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Wed, 18 Dec 2024 19:05:13 +0000 Subject: [PATCH] chore: move IoBuf to vortex-io (#1714) --- bench-vortex/src/taxi_data.rs | 3 +-- vortex-buffer/src/lib.rs | 1 - {vortex-buffer => vortex-io}/src/io_buf.rs | 3 +-- vortex-io/src/lib.rs | 2 ++ vortex-io/src/object_store.rs | 3 +-- vortex-io/src/tokio.rs | 3 +-- vortex-io/src/write.rs | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) rename {vortex-buffer => vortex-io}/src/io_buf.rs (99%) diff --git a/bench-vortex/src/taxi_data.rs b/bench-vortex/src/taxi_data.rs index c612d5ae69..4dad5929b8 100644 --- a/bench-vortex/src/taxi_data.rs +++ b/bench-vortex/src/taxi_data.rs @@ -3,9 +3,8 @@ use std::io::Write; use std::path::PathBuf; use futures::executor::block_on; -use vortex::buffer::io_buf::IoBuf; use vortex::error::VortexError; -use vortex::io::VortexWrite; +use vortex::io::{IoBuf, VortexWrite}; use crate::data_downloads::{data_vortex_uncompressed, download_data}; use crate::reader::rewrite_parquet_as_vortex; diff --git a/vortex-buffer/src/lib.rs b/vortex-buffer/src/lib.rs index ba42277a24..e22fa7d5b8 100644 --- a/vortex-buffer/src/lib.rs +++ b/vortex-buffer/src/lib.rs @@ -16,7 +16,6 @@ use arrow_buffer::{ArrowNativeType, Buffer as ArrowBuffer, MutableBuffer as Arro pub use string::*; mod flexbuffers; -pub mod io_buf; mod string; /// Buffer is an owned, cheaply cloneable byte array. diff --git a/vortex-buffer/src/io_buf.rs b/vortex-io/src/io_buf.rs similarity index 99% rename from vortex-buffer/src/io_buf.rs rename to vortex-io/src/io_buf.rs index ec55a65f44..71c4334936 100644 --- a/vortex-buffer/src/io_buf.rs +++ b/vortex-io/src/io_buf.rs @@ -3,8 +3,7 @@ use std::ops::Range; use bytes::Bytes; - -use crate::Buffer; +use vortex_buffer::Buffer; /// Trait for types that can provide a readonly byte buffer interface to I/O frameworks. /// diff --git a/vortex-io/src/lib.rs b/vortex-io/src/lib.rs index f7168b4898..4f6d37d90b 100644 --- a/vortex-io/src/lib.rs +++ b/vortex-io/src/lib.rs @@ -9,6 +9,7 @@ pub use buf::*; pub use dispatcher::*; +pub use io_buf::*; pub use limit::*; #[cfg(feature = "object_store")] pub use object_store::*; @@ -23,6 +24,7 @@ mod buf; #[cfg(feature = "compio")] mod compio; mod dispatcher; +mod io_buf; mod limit; #[cfg(feature = "object_store")] mod object_store; diff --git a/vortex-io/src/object_store.rs b/vortex-io/src/object_store.rs index 532cf42fad..dbf5dacc8f 100644 --- a/vortex-io/src/object_store.rs +++ b/vortex-io/src/object_store.rs @@ -8,12 +8,11 @@ use bytes::Bytes; use futures_util::StreamExt; use object_store::path::Path; use object_store::{GetOptions, GetRange, GetResultPayload, ObjectStore, WriteMultipart}; -use vortex_buffer::io_buf::IoBuf; use vortex_buffer::Buffer; use vortex_error::{VortexExpect, VortexResult, VortexUnwrap}; use crate::aligned::AlignedBytesMut; -use crate::{VortexBufReader, VortexReadAt, VortexWrite, ALIGNMENT}; +use crate::{IoBuf, VortexBufReader, VortexReadAt, VortexWrite, ALIGNMENT}; pub trait ObjectStoreExt { fn vortex_read( diff --git a/vortex-io/src/tokio.rs b/vortex-io/src/tokio.rs index 0ed29e0fa2..9fc50a9d46 100644 --- a/vortex-io/src/tokio.rs +++ b/vortex-io/src/tokio.rs @@ -8,11 +8,10 @@ use std::sync::Arc; use bytes::Bytes; use tokio::io::{AsyncWrite, AsyncWriteExt}; -use vortex_buffer::io_buf::IoBuf; use vortex_error::VortexUnwrap; use crate::aligned::AlignedBytesMut; -use crate::{VortexReadAt, VortexWrite, ALIGNMENT}; +use crate::{IoBuf, VortexReadAt, VortexWrite, ALIGNMENT}; pub struct TokioAdapter(pub IO); diff --git a/vortex-io/src/write.rs b/vortex-io/src/write.rs index 12220c9ff1..0e32b0b07c 100644 --- a/vortex-io/src/write.rs +++ b/vortex-io/src/write.rs @@ -1,7 +1,7 @@ use std::future::{ready, Future}; use std::io::{self, Cursor, Write}; -use vortex_buffer::io_buf::IoBuf; +use crate::IoBuf; pub trait VortexWrite { fn write_all(&mut self, buffer: B) -> impl Future>;