mirror of https://github.com/fafhrd91/actix-net
revert io-uring feature rename
This commit is contained in:
parent
3f57fc8415
commit
b5cca0aceb
|
@ -21,10 +21,7 @@ path = "src/lib.rs"
|
||||||
[features]
|
[features]
|
||||||
default = ["macros"]
|
default = ["macros"]
|
||||||
macros = ["actix-macros"]
|
macros = ["actix-macros"]
|
||||||
experimental-io-uring = ["tokio-uring"]
|
io-uring = ["tokio-uring"]
|
||||||
|
|
||||||
# deprecated `experimental-io-uring` alias
|
|
||||||
io-uring = ["experimental-io-uring"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-macros = { version = "0.2.3", optional = true }
|
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 }
|
futures-core = { version = "0.3", default-features = false }
|
||||||
tokio = { version = "1.13.1", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }
|
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]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
tokio-uring = { version = "0.3", optional = true }
|
tokio-uring = { version = "0.3", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ impl Arbiter {
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
/// Panics if a [System] is not registered on the current thread.
|
/// 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)]
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Arbiter {
|
pub fn new() -> Arbiter {
|
||||||
Self::with_tokio_rt(|| {
|
Self::with_tokio_rt(|| {
|
||||||
|
@ -107,7 +107,7 @@ impl Arbiter {
|
||||||
/// Spawn a new Arbiter using the [Tokio Runtime](tokio-runtime) returned from a closure.
|
/// Spawn a new Arbiter using the [Tokio Runtime](tokio-runtime) returned from a closure.
|
||||||
///
|
///
|
||||||
/// [tokio-runtime]: tokio::runtime::Runtime
|
/// [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<F>(runtime_factory: F) -> Arbiter
|
pub fn with_tokio_rt<F>(runtime_factory: F) -> Arbiter
|
||||||
where
|
where
|
||||||
F: Fn() -> tokio::runtime::Runtime + Send + 'static,
|
F: Fn() -> tokio::runtime::Runtime + Send + 'static,
|
||||||
|
@ -162,7 +162,7 @@ impl Arbiter {
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
/// Panics if a [System] is not registered on the current thread.
|
/// 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)]
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Arbiter {
|
pub fn new() -> Arbiter {
|
||||||
let sys = System::current();
|
let sys = System::current();
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
//!
|
//!
|
||||||
//! # `io-uring` Support
|
//! # `io-uring` Support
|
||||||
//! There is experimental support for using io-uring with this crate by enabling the
|
//! 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`.
|
//! 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.
|
//! 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_logo_url = "https://actix.rs/img/logo.png")]
|
||||||
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
|
#![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.");
|
compile_error!("io_uring is a linux only feature.");
|
||||||
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|
|
@ -29,7 +29,7 @@ pub struct System {
|
||||||
arbiter_handle: ArbiterHandle,
|
arbiter_handle: ArbiterHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
impl System {
|
impl System {
|
||||||
/// Create a new system.
|
/// Create a new system.
|
||||||
///
|
///
|
||||||
|
@ -70,7 +70,7 @@ impl System {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "experimental-io-uring")]
|
#[cfg(feature = "io-uring")]
|
||||||
impl System {
|
impl System {
|
||||||
/// Create a new 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.
|
/// 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."]
|
#[must_use = "A SystemRunner does nothing unless `run` is called."]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SystemRunner {
|
pub struct SystemRunner {
|
||||||
|
@ -179,7 +179,7 @@ pub struct SystemRunner {
|
||||||
stop_rx: oneshot::Receiver<i32>,
|
stop_rx: oneshot::Receiver<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
impl SystemRunner {
|
impl SystemRunner {
|
||||||
/// Starts event loop and will return once [System] is [stopped](System::stop).
|
/// Starts event loop and will return once [System] is [stopped](System::stop).
|
||||||
pub fn run(self) -> io::Result<()> {
|
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.
|
/// 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."]
|
#[must_use = "A SystemRunner does nothing unless `run` is called."]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SystemRunner;
|
pub struct SystemRunner;
|
||||||
|
|
||||||
#[cfg(feature = "experimental-io-uring")]
|
#[cfg(feature = "io-uring")]
|
||||||
impl SystemRunner {
|
impl SystemRunner {
|
||||||
/// Starts event loop and will return once [System] is [stopped](System::stop).
|
/// Starts event loop and will return once [System] is [stopped](System::stop).
|
||||||
pub fn run(self) -> io::Result<()> {
|
pub fn run(self) -> io::Result<()> {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::{
|
||||||
|
|
||||||
use actix_rt::{task::JoinError, Arbiter, System};
|
use actix_rt::{task::JoinError, Arbiter, System};
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
use {
|
use {
|
||||||
std::{sync::mpsc::channel, thread},
|
std::{sync::mpsc::channel, thread},
|
||||||
tokio::sync::oneshot,
|
tokio::sync::oneshot,
|
||||||
|
@ -24,7 +24,7 @@ fn await_for_timer() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn run_with_code() {
|
fn run_with_code() {
|
||||||
let sys = System::new();
|
let sys = System::new();
|
||||||
|
@ -118,7 +118,7 @@ fn wait_for_spawns() {
|
||||||
// Temporary disabled tests for io-uring feature.
|
// Temporary disabled tests for io-uring feature.
|
||||||
// They should be enabled when possible.
|
// They should be enabled when possible.
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn arbiter_spawn_fn_runs() {
|
fn arbiter_spawn_fn_runs() {
|
||||||
let _ = System::new();
|
let _ = System::new();
|
||||||
|
@ -135,7 +135,7 @@ fn arbiter_spawn_fn_runs() {
|
||||||
arbiter.join().unwrap();
|
arbiter.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn arbiter_handle_spawn_fn_runs() {
|
fn arbiter_handle_spawn_fn_runs() {
|
||||||
let sys = System::new();
|
let sys = System::new();
|
||||||
|
@ -158,7 +158,7 @@ fn arbiter_handle_spawn_fn_runs() {
|
||||||
sys.run().unwrap();
|
sys.run().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn arbiter_drop_no_panic_fn() {
|
fn arbiter_drop_no_panic_fn() {
|
||||||
let _ = System::new();
|
let _ = System::new();
|
||||||
|
@ -170,7 +170,7 @@ fn arbiter_drop_no_panic_fn() {
|
||||||
arbiter.join().unwrap();
|
arbiter.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn arbiter_drop_no_panic_fut() {
|
fn arbiter_drop_no_panic_fut() {
|
||||||
let _ = System::new();
|
let _ = System::new();
|
||||||
|
@ -182,7 +182,7 @@ fn arbiter_drop_no_panic_fut() {
|
||||||
arbiter.join().unwrap();
|
arbiter.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn system_arbiter_spawn() {
|
fn system_arbiter_spawn() {
|
||||||
let runner = System::new();
|
let runner = System::new();
|
||||||
|
@ -213,7 +213,7 @@ fn system_arbiter_spawn() {
|
||||||
thread.join().unwrap();
|
thread.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn system_stop_stops_arbiters() {
|
fn system_stop_stops_arbiters() {
|
||||||
let sys = System::new();
|
let sys = System::new();
|
||||||
|
@ -236,7 +236,7 @@ fn system_stop_stops_arbiters() {
|
||||||
arb.join().unwrap();
|
arb.join().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn new_system_with_tokio() {
|
fn new_system_with_tokio() {
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
|
@ -269,7 +269,7 @@ fn new_system_with_tokio() {
|
||||||
assert_eq!(rx.recv().unwrap(), 42);
|
assert_eq!(rx.recv().unwrap(), 42);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "experimental-io-uring"))]
|
#[cfg(not(feature = "io-uring"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn new_arbiter_with_tokio() {
|
fn new_arbiter_with_tokio() {
|
||||||
use std::sync::{
|
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]
|
#[test]
|
||||||
fn tokio_uring_arbiter() {
|
fn tokio_uring_arbiter() {
|
||||||
System::new().block_on(async {
|
System::new().block_on(async {
|
||||||
|
|
|
@ -21,10 +21,7 @@ path = "src/lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
experimental-io-uring = ["tokio-uring", "actix-rt/io-uring"]
|
io-uring = ["tokio-uring", "actix-rt/io-uring"]
|
||||||
|
|
||||||
# deprecated `experimental-io-uring` alias
|
|
||||||
io-uring = ["experimental-io-uring"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = { version = "2.7", default-features = false }
|
actix-rt = { version = "2.7", default-features = false }
|
||||||
|
@ -39,7 +36,7 @@ socket2 = "0.4.2"
|
||||||
tokio = { version = "1.13.1", features = ["sync"] }
|
tokio = { version = "1.13.1", features = ["sync"] }
|
||||||
tracing = { version = "0.1.30", features = ["log"] }
|
tracing = { version = "0.1.30", features = ["log"] }
|
||||||
|
|
||||||
# runtime for `experimental-io-uring` feature
|
# runtime for `io-uring` feature
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
tokio-uring = { version = "0.3", optional = true }
|
tokio-uring = { version = "0.3", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,7 @@ impl ServerWorker {
|
||||||
worker_stopped_rx.await.unwrap();
|
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
|
// TODO: pass max blocking thread config when tokio-uring enable configuration
|
||||||
// on building runtime.
|
// on building runtime.
|
||||||
|
@ -391,10 +391,7 @@ impl ServerWorker {
|
||||||
tokio_uring::start(worker_fut);
|
tokio_uring::start(worker_fut);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(all(
|
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
|
||||||
target_os = "linux",
|
|
||||||
feature = "experimental-io-uring"
|
|
||||||
)))]
|
|
||||||
{
|
{
|
||||||
let rt = tokio::runtime::Builder::new_current_thread()
|
let rt = tokio::runtime::Builder::new_current_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
|
@ -410,7 +407,7 @@ impl ServerWorker {
|
||||||
|
|
||||||
// with actix system
|
// with actix system
|
||||||
(Some(_sys), _) => {
|
(Some(_sys), _) => {
|
||||||
#[cfg(all(target_os = "linux", feature = "experimental-io-uring"))]
|
#[cfg(all(target_os = "linux", feature = "io-uring"))]
|
||||||
let arbiter = {
|
let arbiter = {
|
||||||
// TODO: pass max blocking thread config when tokio-uring enable configuration
|
// TODO: pass max blocking thread config when tokio-uring enable configuration
|
||||||
// on building runtime.
|
// on building runtime.
|
||||||
|
@ -418,7 +415,7 @@ impl ServerWorker {
|
||||||
Arbiter::new()
|
Arbiter::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(all(target_os = "linux", feature = "experimental-io-uring")))]
|
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
|
||||||
let arbiter = {
|
let arbiter = {
|
||||||
Arbiter::with_tokio_rt(move || {
|
Arbiter::with_tokio_rt(move || {
|
||||||
tokio::runtime::Builder::new_current_thread()
|
tokio::runtime::Builder::new_current_thread()
|
||||||
|
|
Loading…
Reference in New Issue