espoal / uring_examples

Rust io_uring examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

Rust io_uring examples, based on @tokio/io-uring

Networking examples

  • tcp_simple: A simple echo server in TCP, using only basic functionality
  • uds_simple: As above, but using Unix Domain Sockets
  • tcp_multishot: As in tcp_simple, but with multishot support for accept and receive.
  • uds_multishot: As in tcp_multishot, but with Unix Domain Sockets. (pending)

Storage examples

  • xfs_simple: Using io_uring to read a file from XFS
  • nvme: Using io_uring to read a NVMe device

TODOs:

Questions

  • Should I use fixed buffers with NVMe commands?
  • How do I create a QUIC example?
  • How do I render the commands async?
  • How many worker threads?

Quiche

I'm creating a few examples using io_uring here, and I would like to add a simple quic example, starting from a client.

As you can see from the tcp example I have a simple network loop which waits for events from io_uring and keep track of them via a very simple state machine.

From what I understand quiche makes no assumption about which event loop it's going to be used with, so it would be perfect for my use case. On the client side what I would do would be:

  • Create a new connection with quiche::connect
  • Fire a IORING_OP_CONNECT submission directed toward the server
  • Fire a IORING_RECV_MULTISHOT submission to listen for packets incoming from the server
  • Call the send method to fetch data generated by quiche, and then send it using IORING_OP_SENDMSG
  • Once data arrives, I should feed it to quiche via the recv method

I should then repeat the last two steps until the connection is established, and I've received what I want.

About

Rust io_uring examples

License:MIT License