Skip to content

RFC: hide compio-driver from the monocrate #945

Open

Description

@Berrysoft

The crates compio-runtime, compio-fs, compio-net, and compio-process depends on the driver directly, while users usually don't. The low-level code breaks faster than the high-level one. I propose hiding the driver from the public interface of the monocrate.

A new trait will be introduced in compio-driver:

pub trait RuntimeExt {
    fn with_driver<R>(&self, f: impl FnOnce(&Proactor) -> R) -> R;
    fn with_driver_mut<R>(&self, f: impl FnOnce(&mut Proactor) -> R) -> R;

    fn driver_type(&self) -> DriverType {
        self.with_driver(|p| p.driver_type())
    }
}

The types Submit* could even be decoupled from the runtime as they only depends on the proactor. If we want a complete decoupling, we could add a trait for Proactor.

compio_runtime::Runtime will implement RuntimeExt, but users will not be able to use it until they pull compio-driver in explicitly. Then it will be safe to introduce breaking changes to compio-driver, because the high-level APIs will depend on a different driver. submit methods will break, but it's because the user is trying to use a low-level OpCode, whose stability is not guarenteed by the high-level APIs.

Activity

  1. added
    RFCRequest for Comment, proposals for features or changes
    on Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRequest for Comment, proposals for features or changes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions