tokio-rs / io-uring

The `io_uring` library for Rust
Apache License 2.0
1.19k stars 131 forks source link

Async support #280

Closed saltatory closed 6 months ago

saltatory commented 6 months ago

Use Case

I have (want to have) commands coming in from multiple network connections via mpsc channels. I have a single async worker consuming commands off the channel sending them on to the io_uring and then sending replies back on another channel.

Problem

Compiles fine. The test that performs tokio::spawn on the worker task fails to compile/run because a variety of structures in io_uring are not Send including AtomicU32, CompletionQueue.

Questions

  1. Is async support on the way?
  2. Is this a dumb way to do this? It feels like its "native" Tokio.
  3. I briefly looked at tokio_uring. The examples there are async but it appears that library is not active.

Thanks for all your hard, high-quality work!

saltatory commented 6 months ago

UPDATE: I'm leaving the original question up in case others might benefit. I was not aware that the tokio_uring project used io-uring and that it presents an example of how to "wrap" io-uring in such a way that it can be called from async code.

For my purposes, I think I will still want to write my own wrapper, inspired by tokio_uring, because I want the customer of the driver to be able to submit multiple operations over a Rust channel and receive the replies asynchronously.