Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to a tokio-rs style API while keeping performance the same or better #6

Open
davidtos opened this issue Feb 18, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@davidtos
Copy link
Owner

https://github.com/tokio-rs/tokio-uring This project provides uring support for RUST projects. Their API looks very clean and I think it's good to move to something similar. Depending on the performance impact that it has.

use tokio_uring::fs::File;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    tokio_uring::start(async {
        // Open a file
        let file = File::open("hello.txt").await?;

        let buf = vec![0; 4096];
        // Read some data, the buffer is passed by ownership and
        // submitted to the kernel. When the operation completes,
        // we get the buffer back.
        let (res, buf) = file.read_at(buf, 0).await;
        let n = res?;

        // Display the contents
        println!("{:?}", &buf[..n]);

        Ok(())
    })
}
@davidtos davidtos self-assigned this Feb 18, 2025
@davidtos davidtos converted this from a draft issue Feb 18, 2025
@davidtos davidtos moved this from Ready to In progress in JUring project Feb 18, 2025
@davidtos davidtos added the enhancement New feature or request label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In progress
Development

No branches or pull requests

1 participant