Skip to content

Conversation

@MrCroxx
Copy link
Member

@MrCroxx MrCroxx commented Dec 18, 2025

.. to switch between tokio and madsim.

What's changed and what's your intention?

Please explain IN DETAIL what the changes are in this PR and why they are needed. :D

Part of #990 . Yet another attempt after #1211 and #1212

This PR aims to remove the madsim dependency under the default feature.

In order to seamlessly replace all uses of tokio components and tokio macros (such as tokio::select! and tokio::test, etc.), the foyer-tokio crate is introduced as the default tokio dependency, and the implementation is switched via runtime-tokio and runtime-madsim-tokio.

In addition, this PR restores the CI for madsim nextest. On CI, only the compilation and tests of the foyer crate and its dependent crates are checked.

Checklist

  • I have written the necessary rustdoc comments
  • I have added the necessary unit tests and integration tests
  • I have passed cargo x (or cargo x --fast instead if the old tests are not modified) in my local environment.

Related issues or PRs (optional)

#990 #1211 #1212

Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
@MrCroxx MrCroxx added this to the v0.22 milestone Dec 18, 2025
@MrCroxx MrCroxx requested a review from tisonkun December 18, 2025 08:17
@MrCroxx MrCroxx self-assigned this Dec 18, 2025
@MrCroxx MrCroxx added dependencies Pull requests that update a dependency file refactor labels Dec 18, 2025
MrCroxx and others added 4 commits December 18, 2025 08:20
Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 81.59509% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
foyer-common/src/spawn.rs 74.00% 13 Missing ⚠️
foyer-bench/src/main.rs 42.85% 8 Missing ⚠️
foyer-memory/src/cache.rs 33.33% 4 Missing ⚠️
foyer-storage/src/store.rs 88.46% 3 Missing ⚠️
foyer-storage/src/io/engine/psync.rs 77.77% 2 Missing ⚠️
Files with missing lines Coverage Δ
foyer-common/src/error.rs 74.47% <ø> (+1.14%) ⬆️
foyer-memory/src/raw.rs 87.50% <100.00%> (ø)
foyer-storage/src/engine/block/engine.rs 89.65% <100.00%> (+0.03%) ⬆️
foyer-storage/src/engine/block/eviction.rs 95.79% <ø> (ø)
foyer-storage/src/engine/block/flusher.rs 86.46% <100.00%> (-0.04%) ⬇️
foyer-storage/src/engine/block/manager.rs 97.83% <100.00%> (+2.88%) ⬆️
foyer-storage/src/engine/block/reclaimer.rs 84.09% <100.00%> (ø)
foyer-storage/src/engine/block/recover.rs 88.57% <100.00%> (-0.22%) ⬇️
foyer-storage/src/engine/block/scanner.rs 95.83% <100.00%> (+0.27%) ⬆️
foyer-storage/src/engine/block/tombstone.rs 95.80% <ø> (ø)
... and 11 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Comment on lines 39 to 56
fs = ["runtime-tokio?/fs", "runtime-madsim-tokio?/fs"]
io-util = ["runtime-tokio?/io-util", "runtime-madsim-tokio?/io-util"]
io-std = ["runtime-tokio?/io-std", "runtime-madsim-tokio?/io-std"]
macros = ["runtime-tokio?/macros", "runtime-madsim-tokio?/macros"]
net = ["runtime-tokio?/net", "runtime-madsim-tokio?/net"]
parking_lot = [
"runtime-tokio?/parking_lot",
"runtime-madsim-tokio?/parking_lot",
]
process = ["runtime-tokio?/process", "runtime-madsim-tokio?/process"]
rt = ["runtime-tokio?/rt", "runtime-madsim-tokio?/rt"]
rt-multi-thread = [
"runtime-tokio?/rt-multi-thread",
"runtime-madsim-tokio?/rt-multi-thread",
]
signal = ["runtime-tokio?/signal", "runtime-madsim-tokio?/signal"]
sync = ["runtime-tokio?/sync", "runtime-madsim-tokio?/sync"]
time = ["runtime-tokio?/time", "runtime-madsim-tokio?/time"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would still lock all the deps due to the limitation of rust-lang/cargo#10801

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or enable full features for madsim by default?

MrCroxx and others added 3 commits December 18, 2025 09:31
FYI: rust-lang/cargo#10801

Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Signed-off-by: MrCroxx <mrcroxx.cs@gmail.com>
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
@MrCroxx
Copy link
Member Author

MrCroxx commented Dec 19, 2025

Let's do it!

@MrCroxx MrCroxx merged commit 82f51a3 into main Dec 19, 2025
45 checks passed
@MrCroxx MrCroxx deleted the xx/spawnv2 branch December 19, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file refactor

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants