All Projects → hmwill → tokio-linux-aio

hmwill / tokio-linux-aio

Licence: MIT License
Support for Linux kernel aio within Tokio.

Programming Languages

rust
11053 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to tokio-linux-aio

rodbus
Rust implementation of Modbus with idiomatic bindings for C, C++, .NET, and Java
Stars: ✭ 34 (-30.61%)
Mutual labels:  tokio, tokio-rs
Rust S3
Rust library for interfacing with AWS S3 and other API compatible services
Stars: ✭ 177 (+261.22%)
Mutual labels:  tokio, rust-library
hyper-reverse-proxy
A simple reverse proxy for use with Hyper and Tokio
Stars: ✭ 94 (+91.84%)
Mutual labels:  tokio
maildir
A simple library to deal with maildir folders
Stars: ✭ 19 (-61.22%)
Mutual labels:  rust-library
bmemcached-rs
Rust binary memcached implementation
Stars: ✭ 24 (-51.02%)
Mutual labels:  rust-library
lonlat bng
A multithreaded Rust library with FFI for converting WGS84 longitude and latitude coordinates into BNG (OSGB36) Eastings and Northings and vice versa (using OSTN15)
Stars: ✭ 20 (-59.18%)
Mutual labels:  rust-library
tiny-tokio-actor
A simple tiny actor library on top of Tokio
Stars: ✭ 28 (-42.86%)
Mutual labels:  tokio
rust-lp-modeler
Lp modeler written in Rust
Stars: ✭ 75 (+53.06%)
Mutual labels:  rust-library
rs-process-memory
A rust library that allows you to read/write into the memory of other processes
Stars: ✭ 63 (+28.57%)
Mutual labels:  rust-library
memsocket
An asynchronous in-memory socket-like interface for Rust
Stars: ✭ 34 (-30.61%)
Mutual labels:  tokio
warc
⚙️ A Rust library for reading and writing WARC files
Stars: ✭ 26 (-46.94%)
Mutual labels:  rust-library
tokio-tun
Asynchronous allocation of TUN/TAP devices in Rust using tokio
Stars: ✭ 17 (-65.31%)
Mutual labels:  tokio
fixie-trie
Compact tries for fixed-width keys
Stars: ✭ 23 (-53.06%)
Mutual labels:  rust-library
rust-cardano-ouroboros-network
Rust implementation of networking layer for the Ouroboros blockchain protocol using Tokio framework.
Stars: ✭ 31 (-36.73%)
Mutual labels:  tokio
aktors
Rust actor library with a bit of inspiration from Akka/Pykka
Stars: ✭ 44 (-10.2%)
Mutual labels:  rust-library
vpsearch
C library for finding nearest (most similar) element in a set
Stars: ✭ 27 (-44.9%)
Mutual labels:  rust-library
trickster
user-friendly linux memory hacking library
Stars: ✭ 50 (+2.04%)
Mutual labels:  rust-library
murmur3
A rust implementation of murmur3
Stars: ✭ 48 (-2.04%)
Mutual labels:  rust-library
meyda-rs
This may become an audio feature extraction library for Rust.
Stars: ✭ 15 (-69.39%)
Mutual labels:  rust-library
mux-stream
(De)multiplex asynchronous streams
Stars: ✭ 34 (-30.61%)
Mutual labels:  tokio-rs

tokio-linux-aio

Version License Docs Build Status Join the chat at https://gitter.im/tokio-linux-aio/Lobby

This package provides an integration of Linux kernel-level asynchronous I/O to the Tokio platform.

Linux kernel-level asynchronous I/O is different from the Posix AIO library. Posix AIO is implemented using a pool of userland threads, which invoke regular, blocking system calls to perform file I/O. Linux kernel-level AIO, on the other hand, provides kernel-level asynchronous scheduling of I/O operations to the underlying block device.

Note: Implementation and test development is still in progress. I'm waiting for tokio 0.2 to stabilize before doing a next revision of this crate. In the interim, I'm working on vervolg, an implementation of a front-end for a subset of the SQL language. Overall, my goal is to put together a test bed and experimentation platform for database kernels.

Usage

Add this to your Cargo.toml:

[dependencies]
tokio-linux-aio = "0.1"

Next, add this to the root module of your crate:

extern crate tokio_linux_aio;

Examples

Once you have added the crate to your project you should be able to write something like this:

// Let's use a standard thread pool
let pool = futures_cpupool::CpuPool::new(5);

// These are handle objects for memory regions
let buffer = MemoryHandle::new();

{
    // Here we go: create an execution context, which uses the pool for background work
    let context = AioContext::new(&pool, 10).unwrap();

    // Create a future to read from a given file (fd) at the given offset into our buffer
    let read_future = context
        .read(fd, 0, buffer)
        .map(move |result_buffer| {
            // do something upon successfully reading the data
            assert!(validate_block(result_buffer.as_ref()));
        })
        .map_err(|err| {
            // do something else when things go wrong
            panic!("{:?}", err);
        });

    // Execute the future and wait for its completion
    let cpu_future = pool.spawn(read_future);
    let result = cpu_future.wait();

    // Should be OK
    assert!(result.is_ok());
}

License

This code is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].