Another Async IO Framework based on io_uring

Overview

kbio, the Async IO Framework based on io_uring, is used in KuiBaDB to implement async io.

Features

  • Support multi-threading concurrent task submission.
  • Very Fast.
  • Implement AsyncRead/AsyncWrite trait introduced in tokio.

Examples

async fn read_body(stream: &mut Sock, content: &mut Vec<u8>) -> io::Result<()> {
    let len = stream.read_u32().await?;
    let msglen = len as usize - size_of::<u32>();
    content.reserve(msglen);
    unsafe {
        content.set_len(msglen);
    }
    stream.read_exact(content.as_mut_slice()).await?;
    return Ok(());
}

See examples in examples/ and the source code of KuiBaDB for more details.

You might also like...
Simple async codec for rkyv. Reuses streaming buffer for maximum speed

rkyv_codec Simple async codec for rkyv. Reuses streaming buffer for maximum speed! This crate provides a makeshift adaptor for streaming &ArchivedObj

You can name anonymous Future from async fn without dyn or Box!

rename-future You can name anonymous Future from async fn without dyn or Box! PLEASE READ THIS THIS PROJECT NOT YET WELL TESTED! DON'T USE THIS IN PRO

The most fundamental type for async synchronization: an intrusive linked list of futures

wait-list This crate provides WaitList, the most fundamental type for async synchronization. WaitList is implemented as an intrusive linked list of fu

Async variant of Tonic's `interceptor` function

Tonic Async Interceptor This crate contains AsyncInterceptor, an async variant of Tonic's Interceptor. Other than accepting an async interceptor funct

Use winit like the async runtime you've always wanted

async-winit Use winit like the async runtime you've always wanted. winit is actually asynchronous, contrary to popular belief; it's just not async. It

Rust library for one-time async initialization

async-lazy An async version of once_cell::sync::Lazy, std::sync::OnceLock or lazy_static. Uses tokio's sychronization primitives. This crate offers an

An efficient async condition variable for lock-free algorithms

async-event An efficient async condition variable for lock-free algorithms, a.k.a. "eventcount". Overview Eventcount-like primitives are useful to mak

🗑Async-dropper is probably the least-worst ad-hoc AysncDrop implementation you've seen so far.

🗑 async-dropper async-dropper is probably the least-worst ad-hoc AsyncDrop implementation you've seen, and it works in two ways: async_dropper::simpl

A safe sync/async multi-producer, multi-consumer channel
A safe sync/async multi-producer, multi-consumer channel

Loole A safe async/sync multi-producer multi-consumer channel. Producers can send and consumers can receive messages asynchronously or synchronously:

Comments
  • Integration with Tokio

    Integration with Tokio

    After thinking about it, it's not a good practice to use kbio alone. In this case, Walker.Wake() occurs in kbio's own thread, and it needs a cross thread communication to submit task to Tokio runtime.

    It is better to directly replace Tokio IO::driver from Mio to io-uring, in this way, IO tasks are directly submitted to the current thread. Iouring and wake() will also occur on the same thread. At this time, cross thread thread communication will generally only occur in the case of work steal.

    opened by hidva 1
  • Remove the polling when there is no free slot

    Remove the polling when there is no free slot

    Curently we will keep polling when there is no free slot.

    if let Some(slot) = future.uring.submit(sqe) {
        // ...
    } else {
        // There is no free slot.
        // We expect that wake_by_ref() will put the task at tail of task queue.
        // But Tokio will put the task at "next task" slot, so it will run again immediately.
        cx.waker().wake_by_ref();
        return Poll::Pending;
    }
    

    I am working to remove the polling. I will save the waker in the free list when there is no slot, and invoke waker.wake() when others release the slot.

    opened by hidva 0
Another attempt at creating a wrapper for fastcdc in node.js

Another attempt at creating a wrapper for fastcdc in node.js. This time using wasmbindgen instead of neon.

Mikola Lysenko 5 Jul 28, 2022
Yet another geter/setter derive macro.

Gusket Gusket is a getter/setter derive macro. Comparison with getset: gusket only exposes one derive macro. No need to derive(Getters, MutGetters, Se

Jonathan Chan Kwan Yin 2 Apr 12, 2022
Async executor for WebAssembly

There are a number of async task executors available in Rust's ecosystem. However, most (if not all?) of them rely on primitives that might not be available or optimal for WebAssembly deployment at the time.

wasm.rs 65 Dec 31, 2022
The feature-rich, portable async channel library

The feature-rich, portable async channel library > crates.io > docs.rs Why use Postage? Includes a rich set of channels. | barrier | broadcast | dispa

Austin Jones 221 Dec 26, 2022
Mix async code with CPU-heavy thread pools using Tokio + Rayon

tokio-rayon Mix async code with CPU-heavy thread pools using Tokio + Rayon Resources Documentation crates.io TL;DR Sometimes, you're doing async stuff

Andy Barron 74 Jan 2, 2023
async-alloc-counter measures max allocations in a future invocation

async-alloc-counter measures max allocations in a future invocation see examples/ for usage This allocator can be used as follows: use async_alloc_cou

Geoffroy Couprie 2 Dec 3, 2021
Golang like WaitGroup implementation for sync/async Rust.

wg Golang like WaitGroup implementation for sync/async Rust.

Al Liu 8 Dec 6, 2022
single file, std only, async Rust executor

whorl - A single file, std only, async Rust executor whorl was created to teach you how async executors work in Rust. It is not the fastest executor n

Michael Gattozzi 459 Dec 29, 2022
BPF library for Async Rust, complementary for libbpf-rs.

libbpf-async A library for writing BPF programs in Async Rust, complementary for libbpf-rs, Rust wrapper for libbpf. Currently, this provides Async-fr

FUJITA Tomonori 13 Nov 9, 2022
Async `TryFrom/TryInto` traits

async-convert Async TryFrom/TryInto traits API Docs | Releases | Contributing Installation $ cargo add async-convert Safety This crate uses #![deny(un

Yosh 4 Mar 4, 2022