This is an automated email from the ASF dual-hosted git repository.
mneumann pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git
The following commit(s) were added to refs/heads/main by this push:
new 8140480 Introduce a "tokio" to allow pulling a trait-only build (#644)
8140480 is described below
commit 8140480ba3f23a114b3da389566e5a4a3a47c179
Author: Adam Gutglick <[email protected]>
AuthorDate: Wed Feb 18 10:32:55 2026 +0000
Introduce a "tokio" to allow pulling a trait-only build (#644)
Signed-off-by: Adam Gutglick <[email protected]>
---
Cargo.toml | 13 ++++++++-----
src/lib.rs | 4 ++++
src/upload.rs | 14 +++++++++-----
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 061bf5a..5e9f046 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,7 +41,6 @@ itertools = "0.14.0"
parking_lot = { version = "0.12" }
percent-encoding = "2.1"
thiserror = "2.0.2"
-tracing = { version = "0.1" }
url = "2.2"
walkdir = { version = "2", optional = true }
@@ -60,7 +59,10 @@ rustls-pki-types = { version = "1.9", default-features =
false, features = ["std
serde = { version = "1.0", default-features = false, features = ["derive"],
optional = true }
serde_json = { version = "1.0", default-features = false, features = ["std"],
optional = true }
serde_urlencoded = { version = "0.7", optional = true }
-tokio = { version = "1.29.0", features = ["sync", "macros", "rt", "time",
"io-util"] }
+
+# Optional tokio feature
+tokio = { version = "1.29.0", features = ["sync", "macros", "rt", "time",
"io-util"], optional = true }
+tracing = { version = "0.1", optional = true }
[target.'cfg(target_family="unix")'.dev-dependencies]
nix = { version = "0.31.1", features = ["fs"] }
@@ -71,14 +73,15 @@ wasm-bindgen-futures = "0.4.18"
[features]
default = ["fs"]
-cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest",
"reqwest/stream", "chrono/serde", "base64", "rand", "ring", "http-body-util",
"form_urlencoded", "serde_urlencoded"]
+cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest",
"reqwest/stream", "chrono/serde", "base64", "rand", "ring", "http-body-util",
"form_urlencoded", "serde_urlencoded", "tokio"]
azure = ["cloud", "httparse"]
-fs = ["walkdir"]
+fs = ["walkdir", "tokio"]
gcp = ["cloud", "rustls-pki-types"]
aws = ["cloud", "md-5"]
http = ["cloud"]
tls-webpki-roots = ["reqwest?/rustls-tls-webpki-roots"]
-integration = ["rand"]
+integration = ["rand", "tokio"]
+tokio = ["dep:tokio", "dep:tracing"]
[dev-dependencies] # In alphabetical order
hyper = { version = "1.2", features = ["server"] }
diff --git a/src/lib.rs b/src/lib.rs
index 3903a62..288d169 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -541,6 +541,7 @@
pub mod aws;
#[cfg(feature = "azure")]
pub mod azure;
+#[cfg(feature = "tokio")]
pub mod buffered;
#[cfg(not(target_arch = "wasm32"))]
pub mod chunked;
@@ -549,6 +550,7 @@ pub mod delimited;
pub mod gcp;
#[cfg(feature = "http")]
pub mod http;
+#[cfg(feature = "tokio")]
pub mod limit;
#[cfg(all(feature = "fs", not(target_arch = "wasm32")))]
pub mod local;
@@ -558,6 +560,7 @@ pub mod prefix;
pub mod registry;
#[cfg(feature = "cloud")]
pub mod signer;
+#[cfg(feature = "tokio")]
pub mod throttle;
#[cfg(feature = "cloud")]
@@ -2039,6 +2042,7 @@ pub enum Error {
},
/// Error when `tokio::spawn` failed
+ #[cfg(feature = "tokio")]
#[error("Error joining spawned task: {}", source)]
JoinError {
/// The wrapped error
diff --git a/src/upload.rs b/src/upload.rs
index 9f6b9ee..d7b760d 100644
--- a/src/upload.rs
+++ b/src/upload.rs
@@ -15,13 +15,15 @@
// specific language governing permissions and limitations
// under the License.
+#[cfg(feature = "tokio")]
use std::task::{Context, Poll};
-use crate::{PutPayload, PutPayloadMut, PutResult, Result};
+#[cfg(feature = "tokio")]
+use crate::PutPayloadMut;
+use crate::{PutPayload, PutResult, Result};
use async_trait::async_trait;
-use bytes::Bytes;
use futures::future::BoxFuture;
-use futures::ready;
+#[cfg(feature = "tokio")]
use tokio::task::JoinSet;
/// An upload part request
@@ -116,6 +118,7 @@ impl<W: MultipartUpload + ?Sized> MultipartUpload for
Box<W> {
/// [`Sink`] this back pressure is optional, allowing integration with
synchronous producers
///
/// [`Sink`]: futures::sink::Sink
+#[cfg(feature = "tokio")]
#[derive(Debug)]
pub struct WriteMultipart {
upload: Box<dyn MultipartUpload>,
@@ -127,6 +130,7 @@ pub struct WriteMultipart {
tasks: JoinSet<Result<()>>,
}
+#[cfg(feature = "tokio")]
impl WriteMultipart {
/// Create a new [`WriteMultipart`] that will upload using 5MB chunks
pub fn new(upload: Box<dyn MultipartUpload>) -> Self {
@@ -152,7 +156,7 @@ impl WriteMultipart {
max_concurrency: usize,
) -> Poll<Result<()>> {
while !self.tasks.is_empty() && self.tasks.len() >= max_concurrency {
- ready!(self.tasks.poll_join_next(cx)).unwrap()??
+ futures::ready!(self.tasks.poll_join_next(cx)).unwrap()??
}
Poll::Ready(Ok(()))
}
@@ -195,7 +199,7 @@ impl WriteMultipart {
/// will allow multiple calls to share the same underlying allocation.
///
/// See [`Self::write`] for information on backpressure
- pub fn put(&mut self, mut bytes: Bytes) {
+ pub fn put(&mut self, mut bytes: bytes::Bytes) {
while !bytes.is_empty() {
let remaining = self.chunk_size - self.buffer.content_length();
if bytes.len() < remaining {