feat(compat): runtime compatibility layers#920
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new optional “compat” layer so compio’s runtime can be driven from external event loops (e.g., Tokio or futures/async-io), including a new flush API to support integration patterns like “wait on driver fd/handle externally”.
Changes:
- Introduces new
compio-compatcrate withRuntimeCompat+ platform adapters (Tokio / futures / Windows). - Adds
Runtime::flush/Proactor::flushand driver-specificflushimplementations to support external event-loop integration. - Extends benches and CI matrix to exercise the new compatibility features.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| compio/src/lib.rs | Re-exports compio_compat as compio::compat behind the compat feature. |
| compio/Cargo.toml | Adds optional compio-compat dep + compat-* feature flags; adds dev-dep used by benches. |
| compio/benches/net.rs | Refactors compio echo benchmarks and adds compat-driven benchmark variants. |
| compio/benches/fs.rs | Refactors FS benchmarks and adds compat-driven benchmark variants. |
| compio/benches/compat/mod.rs | New bench-only module to select compat executors by feature. |
| compio/benches/compat/in_tokio.rs | Criterion AsyncExecutor implementation to run compio inside Tokio. |
| compio/benches/compat/in_futures.rs | Criterion AsyncExecutor implementation to run compio inside futures_executor. |
| compio-runtime/src/lib.rs | Adds Runtime::flush() delegating to the underlying driver/proactor. |
| compio-driver/src/sys/driver/stub/mod.rs | Adds stub flush() implementation. |
| compio-driver/src/sys/driver/poll/mod.rs | Adds polling-driver flush() and adjusts awake-flag handling in poll path. |
| compio-driver/src/sys/driver/mod.rs | Adjusts AwakeFlag behavior (atomic op change). |
| compio-driver/src/sys/driver/iour/mod.rs | Adds io-uring flush() and adjusts awake-flag handling in poll path. |
| compio-driver/src/sys/driver/iocp/mod.rs | Adds IOCP flush() implementation. |
| compio-driver/src/sys/driver/fusion/mod.rs | Delegates flush() to the active fused driver. |
| compio-driver/src/lib.rs | Adds public Proactor::flush() API with docs for external-loop usage. |
| compio-driver/Cargo.toml | Switches mod_use dependency to workspace-managed. |
| compio-compat/src/lib.rs | New crate: core RuntimeCompat execution loop integrating adapter wait/clear + runtime flush. |
| compio-compat/src/sys/mod.rs | New crate: defines Adapter trait and OS dispatch. |
| compio-compat/src/sys/unix/mod.rs | New crate: Unix adapter that optionally registers an eventfd for io-uring. |
| compio-compat/src/sys/unix/tokio.rs | New crate: Tokio adapter using tokio::io::unix::AsyncFd. |
| compio-compat/src/sys/unix/futures.rs | New crate: futures adapter using async-io. |
| compio-compat/src/sys/windows.rs | New crate: Windows adapter waiting via WaitForMultipleObjects. |
| compio-compat/tests/net.rs | New crate tests covering TCP client/server interop under Tokio. |
| compio-compat/tests/fs.rs | New crate tests covering filesystem reads under adapters. |
| compio-compat/README.md | New crate README with basic usage example. |
| compio-compat/Cargo.toml | New crate manifest with features for tokio/futures adapters and platform deps. |
| Cargo.toml | Adds compio-compat to workspace members + workspace deps. |
| .github/workflows/ci_test.yml | Expands CI test matrix to include compat-all feature combos. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fantix
previously approved these changes
May 14, 2026
fantix
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needs #919
This feature is not enabled by "default" or "all".