Skip to content

Commit

Permalink
add internal-tokio-rt
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Jan 24, 2024
1 parent 9e91d97 commit a078ee2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -177,21 +177,21 @@ 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",
"reqsign?/reqwest_request",
]
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"]
Expand All @@ -206,6 +206,8 @@ services-webhdfs = []
services-yandex-disk = []
services-hdfs-native = ["hdfs-native"]

internal-tokio-rt = ["tokio/rt-multi-thread"]

[lib]
bench = false

Expand Down
2 changes: 2 additions & 0 deletions core/src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions core/src/raw/tokio_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<anyhow::Error>) -> Error {
pub fn new_task_join_error(e: tokio::task::JoinError) -> Error {
Error::new(ErrorKind::Unexpected, "tokio task join failed").set_source(e)
}

0 comments on commit a078ee2

Please sign in to comment.