From 6b0b7f223c9f896a0b9113d03c9f571c88f1bbb7 Mon Sep 17 00:00:00 2001 From: Nicholas Gates Date: Wed, 18 Dec 2024 16:19:11 +0000 Subject: [PATCH] Move IoBuf --- 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 +- vortex-ipc/src/messages/writer.rs | 3 +-- 8 files changed, 8 insertions(+), 12 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 a73a1ee21a..0d6a3cd4f2 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 5500d53870..552e030ea0 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>; diff --git a/vortex-ipc/src/messages/writer.rs b/vortex-ipc/src/messages/writer.rs index c7941fe68f..8e3b916a79 100644 --- a/vortex-ipc/src/messages/writer.rs +++ b/vortex-ipc/src/messages/writer.rs @@ -4,12 +4,11 @@ use std::io; use bytes::Bytes; use flatbuffers::FlatBufferBuilder; use vortex_array::ArrayData; -use vortex_buffer::io_buf::IoBuf; use vortex_buffer::Buffer; use vortex_dtype::DType; use vortex_error::VortexUnwrap; use vortex_flatbuffers::{WriteFlatBuffer, WriteFlatBufferExt}; -use vortex_io::VortexWrite; +use vortex_io::{IoBuf, VortexWrite}; use crate::messages::IPCMessage; use crate::ALIGNMENT;