diff --git a/core/Cargo.toml b/core/Cargo.toml index 20535a2d8e3..9b650391097 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -60,7 +60,7 @@ default = [ # And doesn't have any other effects. # # You should never enable this feature unless you are developing opendal. -tests = ["dep:rand", "dep:sha2", "dep:dotenvy", "layers-blocking", "tokio/rt-multi-thread"] +tests = ["dep:rand", "dep:sha2", "dep:dotenvy", "layers-blocking"] # Enable trust-dns for pure rust dns cache. trust-dns = ["reqwest/trust-dns"] @@ -110,7 +110,7 @@ layers-throttle = ["dep:governor"] layers-await-tree = ["dep:await-tree"] # Enable layers async-backtrace support. layers-async-backtrace = ["dep:async-backtrace"] -layers-blocking = ["tokio/rt"] +layers-blocking = ["internal-tokio-rt"] services-alluxio = [] services-atomicserver = ["dep:atomic_lib"] @@ -177,12 +177,12 @@ services-oss = [ "reqsign?/reqwest_request", ] services-pcloud = [] -services-persy = ["dep:persy"] +services-persy = ["dep:persy", "internal-tokio-rt"] services-postgresql = ["dep:tokio-postgres", "dep:bb8", "dep:bb8-postgres"] -services-redb = ["dep:redb"] +services-redb = ["dep:redb", "internal-tokio-rt"] services-redis = ["dep:redis", "redis?/tokio-rustls-comp"] services-redis-native-tls = ["services-redis", "redis?/tokio-native-tls-comp"] -services-rocksdb = ["dep:rocksdb"] +services-rocksdb = ["dep:rocksdb", "internal-tokio-rt"] services-s3 = [ "dep:reqsign", "reqsign?/services-aws", @@ -190,8 +190,8 @@ services-s3 = [ ] services-seafile = [] services-sftp = ["dep:openssh", "dep:openssh-sftp-client"] -services-sled = ["dep:sled"] -services-sqlite = ["dep:rusqlite", "dep:r2d2"] +services-sled = ["dep:sled", "internal-tokio-rt"] +services-sqlite = ["dep:rusqlite", "dep:r2d2", "internal-tokio-rt"] services-supabase = [] services-swift = [] services-tikv = ["tikv-client"] @@ -206,6 +206,8 @@ services-webhdfs = [] services-yandex-disk = [] services-hdfs-native = ["hdfs-native"] +internal-tokio-rt = ["tokio/rt-multi-thread"] + [lib] bench = false diff --git a/core/src/raw/mod.rs b/core/src/raw/mod.rs index 421f56a0daf..2783dddf9ab 100644 --- a/core/src/raw/mod.rs +++ b/core/src/raw/mod.rs @@ -61,7 +61,9 @@ pub use serde_util::*; mod chrono_util; pub use chrono_util::*; +#[cfg(feature = "internal-tokio-rt")] mod tokio_util; +#[cfg(feature = "internal-tokio-rt")] pub use tokio_util::*; mod std_io_util; diff --git a/core/src/raw/tokio_util.rs b/core/src/raw/tokio_util.rs index 2fdb533a239..bceff001475 100644 --- a/core/src/raw/tokio_util.rs +++ b/core/src/raw/tokio_util.rs @@ -18,7 +18,6 @@ use crate::{Error, ErrorKind}; /// Parse tokio error into opendal::Error. -// HACK - tokio::task::JoinError is not always present, use an existential type. -pub fn new_task_join_error(e: impl Into) -> Error { +pub fn new_task_join_error(e: tokio::task::JoinError) -> Error { Error::new(ErrorKind::Unexpected, "tokio task join failed").set_source(e) }