#async-io #io #completion #async #memflow

no-std mfio

Flexible completion I/O primitives

2 unstable releases

0.1.0 Dec 7, 2023
0.0.0 Jan 30, 2023

#1405 in Asynchronous


Used in 2 crates

MIT license

255KB
5K SLoC

mfio

Build and test Rustc 1.74 codecov

Framework for Async I/O Systems

mfio is a one-stop shop for custom async I/O systems. It allows you to go wild, beyond typical OS APIs. Originally built for memflow, it aims to make the following aspects of an I/O as simple as possible:

  1. Async
  2. Automatic batching (vectoring)
  3. Fragmentation
  4. Partial success
  5. Lack of color (full sync support)
  6. I/O directly to the stack
  7. Using without standard library

mfio achieves all this by building everything around two key, but tiny traits: PacketIo, and IoBackend. Backends implement these traits, which then allow asynchronous futures to be driven to completion. Then, high level abstractions are used to pass data to the I/O system, in the form of packets. These packets can have multiple views to non-overlapping segments of data, and different views may be processed differently. The end result is an incredibly flexible I/O system with unmatched potential for efficient concurrency.

Crates

The project is split into several crates:

Crate Purpose Status
mfio Core building blocks Beta
mfio-rt Runtime building blocks Alpha
mfio-netfs Network filesystem PoC Experimental

What each status means:

  • Beta - API is subject to change, however, has proven to be relatively reliable.
  • Alpha - API is incomplete, however, no serious bugs have been observed.
  • Experimental - Incomplete, and serious bugs have been observed. DO NOT run in production.

no_std

mfio and mfio-rt do not require std, albeit alloc crate is still required. You can disable standard library requirements as follows:

mfio = { version = "0.1", default-features = false }
mfio-rt = { version = "0.1", default-features = false, features = ["virt"] }

This will add both mfio and mfio-rt as dependencies in no_std mode. Many features will be disabled, such as native polling handles, native runtime, and anything else that depends on running operating system.

However, the remaining blocks should be sufficient to build any non-blocking I/O systems. Custom polling handles may be implemented on arbitrary types to enable cooperative operations on any operating system.

Dependencies

~7–18MB
~274K SLoC