rio
misuse-resistant bindings for io_uring, focusing on users who want to do high-performance storage.
- only relies on libc, no need for c/bindgen to complicate things
- the completions implement Future, but I don't use that myself
This is a very early-stage project, but it will be the core of sled's IO stack over time. It is built with a specific high-level application in mind: a high performance storage engine and replication system.
sled expects to use the following features:
- SQE linking for dependency specification
- SQPOLL mode for 0-syscall operation
- registered files & IO buffers for lower overhead
- write, read, connect, fsync, fdatasync, O_DIRECT
use ;
const CHUNK_SIZE: u64 = 4096 * 256;
// `O_DIRECT` requires all reads and writes
// to be aligned to the block device's block
// size. 4096 might not be the best, or even
// a valid one, for yours!
;
// start the ring
let mut ring = new.expect;
// open output file, with `O_DIRECT` set
let file = new
.read
.write
.create
.truncate
.custom_flags
.open
.expect;
// create output buffer
let out_buf = Aligned;
let out_io_slice = new;
// create input buffer
let mut in_buf = Aligned;
let mut in_io_slice = new;
let mut completions = vec!;
for i in 0..
ring.submit_all?;
let mut canceled = 0;
for completion in completions.into_iter