Skip to content

Commit

Permalink
enable depending on tokio-epoll-uring crate from macOS builds (#32)
Browse files Browse the repository at this point in the history
Used by neondatabase/neon#6355

The alternative would have been to require `tokio-epoll-uring` users to use `uring-common` in their `Cargo.toml`.

Instead, we keep the re-exports of `uring-common` from `tokio-epoll-uring`, so that users can think of it as one crate.
As a bonus, the examples look nice.
  • Loading branch information
problame authored Jan 15, 2024
1 parent 9c5ea71 commit 0dd3a2f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
16 changes: 10 additions & 6 deletions tokio-epoll-uring/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,26 @@ pub(crate) mod sealed {

pub mod doc;

#[cfg(target_os = "linux")]
pub mod ops;

#[cfg(target_os = "linux")]
mod system;

pub use system::lifecycle::handle::SystemHandle;
pub use system::lifecycle::thread_local::{thread_local_system, Handle};
pub use system::lifecycle::System;
pub use system::submission::op_fut::Error as SystemError;
#[cfg(target_os = "linux")]
pub use {
crate::system::submission::op_fut::Error,
system::lifecycle::handle::SystemHandle,
system::lifecycle::thread_local::{thread_local_system, Handle},
system::lifecycle::System,
system::submission::op_fut::Error as SystemError,
};

pub use uring_common::buf::{BoundedBuf, BoundedBufMut, IoBuf, IoBufMut, Slice};
pub use uring_common::io_fd::IoFd;

pub(crate) mod util;

pub use crate::system::submission::op_fut::Error;

#[doc(hidden)]
pub mod env_tunables {
pub(crate) static YIELD_TO_EXECUTOR_IF_READY_ON_FIRST_POLL: once_cell::sync::Lazy<bool> =
Expand Down
2 changes: 2 additions & 0 deletions uring-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ license = "MIT" # the same as tokio-uring at the time we forked it

[dependencies]
libc = "0.2.80"

[target.'cfg(target_os = "linux")'.dependencies]
io-uring = "0.6.0"
2 changes: 2 additions & 0 deletions uring-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
pub mod buf;
pub mod open_options;
#[cfg(target_os = "linux")]
pub mod open_options_io_uring_ext;

pub mod io_fd;

#[cfg(target_os = "linux")]
pub use io_uring;
2 changes: 1 addition & 1 deletion uring-common/src/open_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct OpenOptions {
truncate: bool,
create: bool,
create_new: bool,
pub(crate) mode: libc::mode_t,
pub(crate) mode: u32,
pub(crate) custom_flags: libc::c_int,
}

Expand Down

0 comments on commit 0dd3a2f

Please sign in to comment.