Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ readme.workspace = true
exclude.workspace = true
publish = false

# `tonic` is not used directly in example code, but it must be listed as a dep so the `ot` feature
# can opt into the tonic-backed gRPC transport for `opentelemetry-otlp` (`grpc-tonic`).
# Tell cargo-machete to ignore it so CI doesn't flag it as unused.
[package.metadata.cargo-machete]
ignored = ["tonic"]

[features]
serde = ["foyer/serde"]
jaeger = ["fastrace-jaeger"]
Expand Down Expand Up @@ -56,12 +62,6 @@ tokio = { workspace = true, features = ["full"] }
tonic = { workspace = true, optional = true }
tracing = { workspace = true }

# `tonic` is not used directly in example code, but it must be listed as a dep so the `ot` feature
# can opt into the tonic-backed gRPC transport for `opentelemetry-otlp` (`grpc-tonic`).
# Tell cargo-machete to ignore it so CI doesn't flag it as unused.
[package.metadata.cargo-machete]
ignored = ["tonic"]

[[example]]
name = "memory"
path = "memory.rs"
Expand Down
3 changes: 2 additions & 1 deletion foyer-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ readme.workspace = true
exclude.workspace = true

[features]
default = ["jemalloc"]
default = ["jemalloc", "io_uring"]
deadlock = ["parking_lot/deadlock_detection", "foyer/deadlock"]
tokio-console = ["dep:console-subscriber"]
strict_assertions = ["foyer/strict_assertions"]
jemalloc = ["dep:tikv-jemallocator"]
jeprof = ["jemalloc", "tikv-jemallocator?/profiling"]
tracing = ["fastrace/enable", "foyer/tracing", "dep:fastrace-jaeger"]
io_uring = ["foyer/io_uring"]

[dependencies]
anyhow = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions foyer-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use analyze::{Metrics, analyze, monitor};
use bytesize::ByteSize;
use clap::{ArgGroup, Parser, builder::PossibleValuesParser};
use exporter::PrometheusExporter;
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
use foyer::UringIoEngineConfig;
use foyer::{
BlockEngineConfig, Code, Compression, Device, DeviceBuilder, EngineConfig, FifoConfig, FifoPicker,
Expand Down Expand Up @@ -592,7 +592,7 @@ async fn benchmark(args: Args) {
}
builder.boxed()
}
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
"io_uring" => UringIoEngineConfig::new()
.with_threads(args.io_uring_threads)
.with_cpus(args.io_uring_cpus.clone())
Expand Down
9 changes: 7 additions & 2 deletions foyer-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ strict_assertions = [
"foyer-common/strict_assertions",
"foyer-memory/strict_assertions",
]
# Enable the io_uring based I/O engine. Linux only.
# This feature pulls in the `io-uring` crate, which ships prebuilt syscall
# bindings only for a limited set of architectures. Disable this feature to
# build foyer on architectures unsupported by `io-uring` (e.g. armv7).
io_uring = ["dep:io-uring", "dep:core_affinity"]

[dependencies]
allocator-api2 = { workspace = true }
Expand Down Expand Up @@ -53,8 +58,8 @@ twox-hash = { workspace = true, features = ["xxhash32", "xxhash64"] }
zstd = { workspace = true }

[target.'cfg(target_os = "linux")'.dependencies]
core_affinity = { workspace = true }
io-uring = { workspace = true }
core_affinity = { workspace = true, optional = true }
io-uring = { workspace = true, optional = true }

[dev-dependencies]
bytesize = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions foyer-storage/src/io/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod monitor;
pub mod noop;
pub mod psync;

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
pub mod uring;

use std::{
Expand Down Expand Up @@ -132,7 +132,7 @@ mod tests {

use super::*;
#[cfg(not(madsim))]
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
use crate::io::engine::uring::UringIoEngineConfig;
use crate::io::{
bytes::IoSliceMut,
Expand Down Expand Up @@ -171,7 +171,7 @@ mod tests {
let dir = tempdir().unwrap();

#[cfg(not(madsim))]
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
{
let path = dir.path().join("test_file_1");
let device = build_test_file_device(&path).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion foyer-storage/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
pub use crate::io::engine::uring::{UringIoEngine, UringIoEngineConfig};
pub use crate::{
compress::Compression,
Expand Down
15 changes: 13 additions & 2 deletions foyer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@ readme.workspace = true
exclude.workspace = true

[package.metadata.docs.rs]
features = ["serde", "tracing", "nightly", "deadlock", "strict_assertions"]
features = [
"serde",
"tracing",
"nightly",
"deadlock",
"strict_assertions",
"io_uring",
]
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.cargo-udeps.ignore]
# Only used in doc test.
development = ["jiff"]

[features]
default = ["runtime-tokio"]
default = ["runtime-tokio", "io_uring"]
clap = ["foyer-storage/clap"]
serde = ["foyer-common/serde", "foyer-storage/serde"]
nightly = ["foyer-storage/nightly", "foyer-memory/nightly"]
Expand All @@ -40,6 +47,10 @@ strict_assertions = [
]
runtime-tokio = ["tokio/runtime-tokio"]
runtime-madsim-tokio = ["tokio/runtime-madsim-tokio"]
# Enable the io_uring based I/O engine. Linux only. Disable to build on
# architectures where the `io-uring` crate has no prebuilt syscall bindings
# (e.g. armv7).
io_uring = ["foyer-storage/io_uring"]

[dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion foyer/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#[cfg(feature = "tracing")]
pub use crate::common::tracing::TracingOptions;
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", feature = "io_uring"))]
pub use crate::storage::{UringIoEngine, UringIoEngineConfig};
pub use crate::{
common::{
Expand Down
Loading