diff --git a/actix-rt/Cargo.toml b/actix-rt/Cargo.toml index 9df178d8..10eac079 100644 --- a/actix-rt/Cargo.toml +++ b/actix-rt/Cargo.toml @@ -21,10 +21,7 @@ path = "src/lib.rs" [features] default = ["macros"] macros = ["actix-macros"] -experimental-io-uring = ["tokio-uring"] - -# deprecated `experimental-io-uring` alias -io-uring = ["experimental-io-uring"] +io-uring = ["tokio-uring"] [dependencies] actix-macros = { version = "0.2.3", optional = true } @@ -32,7 +29,7 @@ actix-macros = { version = "0.2.3", optional = true } futures-core = { version = "0.3", default-features = false } tokio = { version = "1.13.1", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] } -# runtime for `experimental-io-uring` feature +# runtime for `io-uring` feature [target.'cfg(target_os = "linux")'.dependencies] tokio-uring = { version = "0.3", optional = true } diff --git a/actix-rt/src/arbiter.rs b/actix-rt/src/arbiter.rs index 5677e561..95256360 100644 --- a/actix-rt/src/arbiter.rs +++ b/actix-rt/src/arbiter.rs @@ -95,7 +95,7 @@ impl Arbiter { /// /// # Panics /// Panics if a [System] is not registered on the current thread. - #[cfg(not(all(target_os = "linux", feature = "experimental-io-uring")))] + #[cfg(not(all(target_os = "linux", feature = "io-uring")))] #[allow(clippy::new_without_default)] pub fn new() -> Arbiter { Self::with_tokio_rt(|| { @@ -107,7 +107,7 @@ impl Arbiter { /// Spawn a new Arbiter using the [Tokio Runtime](tokio-runtime) returned from a closure. /// /// [tokio-runtime]: tokio::runtime::Runtime - #[cfg(not(all(target_os = "linux", feature = "experimental-io-uring")))] + #[cfg(not(all(target_os = "linux", feature = "io-uring")))] pub fn with_tokio_rt(runtime_factory: F) -> Arbiter where F: Fn() -> tokio::runtime::Runtime + Send + 'static, @@ -162,7 +162,7 @@ impl Arbiter { /// /// # Panics /// Panics if a [System] is not registered on the current thread. - #[cfg(all(target_os = "linux", feature = "experimental-io-uring"))] + #[cfg(all(target_os = "linux", feature = "io-uring"))] #[allow(clippy::new_without_default)] pub fn new() -> Arbiter { let sys = System::current(); diff --git a/actix-rt/src/lib.rs b/actix-rt/src/lib.rs index 40df7213..7fb2b632 100644 --- a/actix-rt/src/lib.rs +++ b/actix-rt/src/lib.rs @@ -35,7 +35,7 @@ //! //! # `io-uring` Support //! There is experimental support for using io-uring with this crate by enabling the -//! `experimental-io-uring` feature. For now, it is semver exempt. +//! `io-uring` feature. For now, it is semver exempt. //! //! Note that there are currently some unimplemented parts of using `actix-rt` with `io-uring`. //! In particular, when running a `System`, only `System::block_on` is supported. @@ -46,7 +46,7 @@ #![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")] -#[cfg(all(not(target_os = "linux"), feature = "experimental-io-uring"))] +#[cfg(all(not(target_os = "linux"), feature = "io-uring"))] compile_error!("io_uring is a linux only feature."); use std::future::Future; diff --git a/actix-rt/src/system.rs b/actix-rt/src/system.rs index eec853be..0ea3547d 100644 --- a/actix-rt/src/system.rs +++ b/actix-rt/src/system.rs @@ -29,7 +29,7 @@ pub struct System { arbiter_handle: ArbiterHandle, } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] impl System { /// Create a new system. /// @@ -70,7 +70,7 @@ impl System { } } -#[cfg(feature = "experimental-io-uring")] +#[cfg(feature = "io-uring")] impl System { /// Create a new system. /// @@ -171,7 +171,7 @@ impl System { } /// Runner that keeps a [System]'s event loop alive until stop message is received. -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[must_use = "A SystemRunner does nothing unless `run` is called."] #[derive(Debug)] pub struct SystemRunner { @@ -179,7 +179,7 @@ pub struct SystemRunner { stop_rx: oneshot::Receiver, } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] impl SystemRunner { /// Starts event loop and will return once [System] is [stopped](System::stop). pub fn run(self) -> io::Result<()> { @@ -211,12 +211,12 @@ impl SystemRunner { } /// Runner that keeps a [System]'s event loop alive until stop message is received. -#[cfg(feature = "experimental-io-uring")] +#[cfg(feature = "io-uring")] #[must_use = "A SystemRunner does nothing unless `run` is called."] #[derive(Debug)] pub struct SystemRunner; -#[cfg(feature = "experimental-io-uring")] +#[cfg(feature = "io-uring")] impl SystemRunner { /// Starts event loop and will return once [System] is [stopped](System::stop). pub fn run(self) -> io::Result<()> { diff --git a/actix-rt/tests/tests.rs b/actix-rt/tests/tests.rs index dd810025..551a395d 100644 --- a/actix-rt/tests/tests.rs +++ b/actix-rt/tests/tests.rs @@ -5,7 +5,7 @@ use std::{ use actix_rt::{task::JoinError, Arbiter, System}; -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] use { std::{sync::mpsc::channel, thread}, tokio::sync::oneshot, @@ -24,7 +24,7 @@ fn await_for_timer() { ); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn run_with_code() { let sys = System::new(); @@ -118,7 +118,7 @@ fn wait_for_spawns() { // Temporary disabled tests for io-uring feature. // They should be enabled when possible. -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn arbiter_spawn_fn_runs() { let _ = System::new(); @@ -135,7 +135,7 @@ fn arbiter_spawn_fn_runs() { arbiter.join().unwrap(); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn arbiter_handle_spawn_fn_runs() { let sys = System::new(); @@ -158,7 +158,7 @@ fn arbiter_handle_spawn_fn_runs() { sys.run().unwrap(); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn arbiter_drop_no_panic_fn() { let _ = System::new(); @@ -170,7 +170,7 @@ fn arbiter_drop_no_panic_fn() { arbiter.join().unwrap(); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn arbiter_drop_no_panic_fut() { let _ = System::new(); @@ -182,7 +182,7 @@ fn arbiter_drop_no_panic_fut() { arbiter.join().unwrap(); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn system_arbiter_spawn() { let runner = System::new(); @@ -213,7 +213,7 @@ fn system_arbiter_spawn() { thread.join().unwrap(); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn system_stop_stops_arbiters() { let sys = System::new(); @@ -236,7 +236,7 @@ fn system_stop_stops_arbiters() { arb.join().unwrap(); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn new_system_with_tokio() { let (tx, rx) = channel(); @@ -269,7 +269,7 @@ fn new_system_with_tokio() { assert_eq!(rx.recv().unwrap(), 42); } -#[cfg(not(feature = "experimental-io-uring"))] +#[cfg(not(feature = "io-uring"))] #[test] fn new_arbiter_with_tokio() { use std::sync::{ @@ -348,7 +348,7 @@ fn spawn_local() { }) } -#[cfg(all(target_os = "linux", feature = "experimental-io-uring"))] +#[cfg(all(target_os = "linux", feature = "io-uring"))] #[test] fn tokio_uring_arbiter() { System::new().block_on(async { diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index 988c3c1f..e2ff5293 100755 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -21,10 +21,7 @@ path = "src/lib.rs" [features] default = [] -experimental-io-uring = ["tokio-uring", "actix-rt/io-uring"] - -# deprecated `experimental-io-uring` alias -io-uring = ["experimental-io-uring"] +io-uring = ["tokio-uring", "actix-rt/io-uring"] [dependencies] actix-rt = { version = "2.7", default-features = false } @@ -39,7 +36,7 @@ socket2 = "0.4.2" tokio = { version = "1.13.1", features = ["sync"] } tracing = { version = "0.1.30", features = ["log"] } -# runtime for `experimental-io-uring` feature +# runtime for `io-uring` feature [target.'cfg(target_os = "linux")'.dependencies] tokio-uring = { version = "0.3", optional = true } diff --git a/actix-server/src/worker.rs b/actix-server/src/worker.rs index 4fbd0aa0..b66ea4b9 100644 --- a/actix-server/src/worker.rs +++ b/actix-server/src/worker.rs @@ -383,7 +383,7 @@ impl ServerWorker { worker_stopped_rx.await.unwrap(); }; - #[cfg(all(target_os = "linux", feature = "experimental-io-uring"))] + #[cfg(all(target_os = "linux", feature = "io-uring"))] { // TODO: pass max blocking thread config when tokio-uring enable configuration // on building runtime. @@ -391,10 +391,7 @@ impl ServerWorker { tokio_uring::start(worker_fut); } - #[cfg(not(all( - target_os = "linux", - feature = "experimental-io-uring" - )))] + #[cfg(not(all(target_os = "linux", feature = "io-uring")))] { let rt = tokio::runtime::Builder::new_current_thread() .enable_all() @@ -410,7 +407,7 @@ impl ServerWorker { // with actix system (Some(_sys), _) => { - #[cfg(all(target_os = "linux", feature = "experimental-io-uring"))] + #[cfg(all(target_os = "linux", feature = "io-uring"))] let arbiter = { // TODO: pass max blocking thread config when tokio-uring enable configuration // on building runtime. @@ -418,7 +415,7 @@ impl ServerWorker { Arbiter::new() }; - #[cfg(not(all(target_os = "linux", feature = "experimental-io-uring")))] + #[cfg(not(all(target_os = "linux", feature = "io-uring")))] let arbiter = { Arbiter::with_tokio_rt(move || { tokio::runtime::Builder::new_current_thread()