Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Minimize futures dependencies #2248

Merged
merged 7 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/oay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ axum = "0.6"
chrono = "0.4.24"
clap = { version = "4", features = ["cargo", "string"] }
dirs = "5.0.0"
futures = "0.3"
futures-util = "0.3"
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved
opendal.workspace = true
quick-xml = { version = "0.27", features = ["serialize", "overlapped-lists"] }
serde = { version = "1", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion bin/oli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ anyhow = "1"
clap = { version = "4", features = ["cargo", "string"] }
dirs = "5.0.0"
env_logger = "0.10"
futures = "0.3"
futures-util = "0.3"
log = "0.4"
opendal.workspace = true
serde = { version = "1", features = ["derive"] }
Expand Down
10 changes: 5 additions & 5 deletions bin/oli/src/commands/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use clap::Arg;
use clap::ArgAction;
use clap::ArgMatches;
use clap::Command;
use futures::TryStreamExt;
use futures_util::TryStreamExt;
use opendal::Metakey;

use crate::config::Config;
Expand All @@ -49,8 +49,8 @@ pub async fn main(args: &ArgMatches) -> Result<()> {
if !recursive {
let mut dst_w = dst_op.writer(&dst_path).await?;
let reader = src_op.reader(&src_path).await?;
let buf_reader = futures::io::BufReader::with_capacity(8 * 1024 * 1024, reader);
futures::io::copy_buf(buf_reader, &mut dst_w).await?;
let buf_reader = futures_util::io::BufReader::with_capacity(8 * 1024 * 1024, reader);
futures_util::io::copy_buf(buf_reader, &mut dst_w).await?;
// flush data
dst_w.close().await?;
return Ok(());
Expand All @@ -66,12 +66,12 @@ pub async fn main(args: &ArgMatches) -> Result<()> {

let fp = de.path().strip_prefix(&src_path).expect("invalid path");
let reader = src_op.reader(de.path()).await?;
let buf_reader = futures::io::BufReader::with_capacity(8 * 1024 * 1024, reader);
let buf_reader = futures_util::io::BufReader::with_capacity(8 * 1024 * 1024, reader);

let mut writer = dst_op.writer(&dst_root.join(fp).to_string_lossy()).await?;

println!("Copying {}", de.path());
futures::io::copy_buf(buf_reader, &mut writer).await?;
futures_util::io::copy_buf(buf_reader, &mut writer).await?;
writer.close().await?;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion bin/oli/src/commands/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use clap::Arg;
use clap::ArgAction;
use clap::ArgMatches;
use clap::Command;
use futures::TryStreamExt;
use futures_util::TryStreamExt;

use crate::config::Config;

Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ crate-type = ["cdylib"]
doc = false

[dependencies]
futures = "0.3.28"
futures-util = "0.3.28"
napi = { version = "2.11.3", default-features = false, features = [
"napi6",
"async",
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::collections::HashMap;
use std::str::FromStr;
use std::time::Duration;

use futures::TryStreamExt;
use futures_util::TryStreamExt;
use napi::bindgen_prelude::*;

fn build_operator(
Expand Down
2 changes: 1 addition & 1 deletion bindings/object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ version.workspace = true
[dependencies]
async-trait = "0.1"
bytes = "1"
futures = "0.3"
futures-util = "0.3"
object_store = "0.5"
opendal.workspace = true
tokio = "1"
Expand Down
6 changes: 3 additions & 3 deletions bindings/object_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use std::task::Poll;

use async_trait::async_trait;
use bytes::Bytes;
use futures::stream::BoxStream;
use futures::Stream;
use futures::StreamExt;
use futures_util::stream::BoxStream;
use futures_util::Stream;
use futures_util::StreamExt;
use object_store::path::Path;
use object_store::GetResult;
use object_store::ListResult;
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ doc = false

[dependencies]
chrono = { version = "0.4.24", default-features = false, features = ["std"] }
futures = "0.3.28"
futures-util = "0.3.28"
opendal.workspace = true
pyo3 = { version = "0.18", features = ["chrono"] }
pyo3-asyncio = { version = "0.18", features = ["tokio-runtime"] }
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/asyncio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::str::FromStr;
use std::sync::Arc;

use ::opendal as od;
use futures::TryStreamExt;
use futures_util::TryStreamExt;
use pyo3::exceptions::PyIOError;
use pyo3::exceptions::PyNotImplementedError;
use pyo3::exceptions::PyStopAsyncIteration;
Expand Down
3 changes: 2 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ services-sftp = [
"dep:openssh-sftp-client",
"dep:bb8",
"dep:owning_ref",
"futures/executor",
]
services-sled = ["dep:sled"]
services-supabase = []
Expand Down Expand Up @@ -171,7 +172,7 @@ bytes = "1.2"
chrono = "0.4.24"
dashmap = { version = "5.4", optional = true }
flagset = "0.4"
futures = { version = "0.3", features = ["alloc"] }
futures = { version = "0.3", default-features = false, features = ["alloc"] }
hdrs = { version = "0.2", optional = true, features = ["async_file"] }
http = "0.2.5"
hyper = "0.14"
Expand Down