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

vendor IoBuf/IoBufMut from tokio-uring #24

Merged
merged 1 commit into from
Nov 22, 2023
Merged

Conversation

problame
Copy link
Collaborator

@problame problame commented Nov 20, 2023

In the draft PR for open_at support we need an OpenOptions struct. Sadly we can't re-use the one from tokio-uring because it doesn't have a public API for the conversion of OpenOptions into the relevant libc flags.

We created a PR asking for such an API, but, in the meantime, let's unblock ourselves by vendoring the pieces of tokio-uring that we need, and cusotmize them as needed.

This PR starts that effort by vendoring the IoBuf/IoBufMut traits as well as tokio-uring's approach to support slice-like operations.
Support for OpenOptions will follow as part of the PR that adds open_at support on top of this PR.

The files that reproduce the tokio-uring LICENSE text at the top are copied from tokio-uring.git:d5e90539bd6d1c518e848298564a098c300866bc.
Files without it were written by myself.

To make cargo test pass, I had to remove the examples in the doc comments.

@problame problame requested review from koivunej and arpad-m November 20, 2023 11:21
@problame problame mentioned this pull request Nov 20, 2023
@problame problame force-pushed the problame/uring-common branch from 16d09a9 to 04cb1bd Compare November 20, 2023 11:44
For [`open_at`
support](#21) we
need an `OpenOptions` struct. Sadly we can't re-use the one from
`tokio-uring` because it doesn't have a public API for the conversion of
OpenOptions into the relevant libc flags.

We created [a PR asking for such an
API](neondatabase/tokio-uring#1), but, in the
meantime, let's unblock ourselves by vendoring the pieces of
`tokio-uring` that we need, and cusotmize them as needed.

This PR starts that effort by vendoring the `IoBuf`/`IoBufMut` traits.
`OpenOptions` will follow in a later PR.

The files that reproduce the `tokio-uring` LICENSE text at the top
are copied from `tokio-uring.git:d5e90539bd6d1c518e848298564a098c300866bc`.

Files without it were written by myself.
@problame problame force-pushed the problame/uring-common branch from 04cb1bd to 716ef11 Compare November 20, 2023 14:29
@problame problame changed the title vendor (and add ext trait for) IoBuf/IoBufMut and OpenOptions from tokio-uring vendor IoBuf/IoBufMut from tokio-uring Nov 20, 2023
@problame problame assigned problame and koivunej and unassigned problame Nov 21, 2023
@problame problame merged commit 91d67e2 into main Nov 22, 2023
2 checks passed
@problame problame deleted the problame/uring-common branch November 22, 2023 07:24
problame added a commit that referenced this pull request Nov 22, 2023
(Stacked atop #24)

* Vendor in `OpenOptions` from
`tokio-uring.git:d5e90539bd6d1c518e848298564a098c300866bc`
* Remove the `OpenOptions::open()` function which is
  `tokio-uring`-specific
* Remove examples because they mention `tokio_uring` and hence fail
`cargo test`
* Add the extension trait that allows for conversion of OpenOptions into
  an `io_uring::squeue::Entry`
* Use it throughout the code base.

This PR obsoletes
#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants