Skip to content

Commit

Permalink
deps: switch between tokio impls with cfg(madsim) (#856)
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun authored Feb 7, 2025
1 parent ca3293f commit b8d38f6
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 14 deletions.
9 changes: 0 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ test-log = { version = "0.2", default-features = false, features = [
"color",
] }
thiserror = "2"
tokio = { package = "madsim-tokio", version = "0.2", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }
tracing = "0.1"
prometheus = "0.13"
mixtrics = "0.0.3"
Expand Down
23 changes: 22 additions & 1 deletion foyer-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,34 @@ rand = { workspace = true }
rand_distr = { workspace = true }
serde = { workspace = true }
serde_bytes = "0.11.15"
tokio = { workspace = true, features = ["net"] }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = { version = "0.6", optional = true }

[target.'cfg(madsim)'.dependencies]
tokio = { package = "madsim-tokio", version = "0.2", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[target.'cfg(not(madsim))'.dependencies]
tokio = { package = "tokio", version = "1", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[features]
default = ["jemalloc"]
deadlock = ["parking_lot/deadlock_detection", "foyer/deadlock"]
Expand Down
23 changes: 22 additions & 1 deletion foyer-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,34 @@ mixtrics = { workspace = true }
parking_lot = { workspace = true }
pin-project = "1"
serde = { workspace = true }
tokio = { workspace = true }

[dev-dependencies]
futures-util = { workspace = true }
mixtrics = { workspace = true, features = ["test-utils"] }
rand = { workspace = true }

[target.'cfg(madsim)'.dependencies]
tokio = { package = "madsim-tokio", version = "0.2", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[target.'cfg(not(madsim))'.dependencies]
tokio = { package = "tokio", version = "1", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[features]
strict_assertions = []
tracing = ["fastrace/enable"]
Expand Down
23 changes: 22 additions & 1 deletion foyer-memory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ parking_lot = { workspace = true }
pin-project = "1"
serde = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }

[dev-dependencies]
Expand All @@ -38,6 +37,28 @@ rand = { workspace = true, features = ["small_rng"] }
rand_distr = { workspace = true }
test-log = { workspace = true }

[target.'cfg(madsim)'.dependencies]
tokio = { package = "madsim-tokio", version = "0.2", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[target.'cfg(not(madsim))'.dependencies]
tokio = { package = "tokio", version = "1", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[features]
nightly = ["hashbrown/nightly"]
deadlock = ["parking_lot/deadlock_detection"]
Expand Down
23 changes: 22 additions & 1 deletion foyer-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pin-project = "1"
rand = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
twox-hash = "2"
zstd = "0.13"
Expand All @@ -51,6 +50,28 @@ bytesize = { workspace = true }
tempfile = "3"
test-log = { workspace = true }

[target.'cfg(madsim)'.dependencies]
tokio = { package = "madsim-tokio", version = "0.2", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[target.'cfg(not(madsim))'.dependencies]
tokio = { package = "tokio", version = "1", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[features]
default = []
deadlock = ["parking_lot/deadlock_detection"]
Expand Down
23 changes: 22 additions & 1 deletion foyer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ foyer-common = { workspace = true }
foyer-memory = { workspace = true }
foyer-storage = { workspace = true }
mixtrics = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }

[dev-dependencies]
tempfile = "3"
test-log = { workspace = true }

[target.'cfg(madsim)'.dependencies]
tokio = { package = "madsim-tokio", version = "0.2", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[target.'cfg(not(madsim))'.dependencies]
tokio = { package = "tokio", version = "1", features = [
"rt",
"rt-multi-thread",
"sync",
"macros",
"time",
"signal",
"fs",
] }

[features]
default = []
nightly = ["foyer-storage/nightly", "foyer-memory/nightly"]
Expand Down

0 comments on commit b8d38f6

Please sign in to comment.