Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
cat << EOF > "run-gha-workflow.sh"
PATH=$PATH:/usr/share/rust/.cargo/bin
echo "`nproc` CPU(s) available"
rustup install 1.70
rustup install 1.92
rustup show
rustup default stable
cargo install cargo-sort
Expand Down
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[workspace]
members = [
"examples",
"glommio",
]
members = ["examples", "glommio"]
resolver = "2"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ an [introductory article.](https://www.datadoghq.com/blog/engineering/introducin

## Supported Rust Versions

Glommio is built against the latest stable release. The minimum supported version is 1.70. The current Glommio version
Glommio is built against the latest stable release. The minimum supported version is 1.92. The current Glommio version
is not guaranteed to build on Rust versions earlier than the minimum supported version.

## Supported Linux kernels
Expand Down
8 changes: 4 additions & 4 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ name = "examples"
version = "0.0.0"
license = "Apache-2.0 OR MIT"
publish = false
edition = "2021"
edition = "2024"

[dev-dependencies]
byte-unit = "5.1.4"
yansi = "~0.5.1"
clap = "4.5.3"
fastrand = "2"
futures = "~0.3.5"
futures-lite = "2.6.0"
glommio = { path = "../glommio" }
http-body-util = "0.1.0"

# hyper and tokio for the hyper example. We just need the traits from Tokio
hyper = { version = "1.2.0", features = ["full"] }
num_cpus = "1.13.0"
sys-info = "~0.8.0"
http-body-util = "0.1.0"
serde_json = "1.0.114"
sys-info = "~0.9.1"
yansi = "~1.0.1"

[[example]]
name = "echo"
Expand Down
39 changes: 15 additions & 24 deletions examples/deadline_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ impl IntWriter {

println!(
"{}: Wrote {} ({}%), {:.0} int/s, scheduler shares: {} , {:.2} % CPU",
Paint::blue(format!("{}s", elapsed.as_secs())),
format!("{}s", elapsed.as_secs()).blue(),
self.count.get(),
Paint::new(format!("{:.0}", ratio)).bold(),
format!("{:.0}", ratio).bold(),
intratio,
Paint::new(tq_stats.current_shares().to_string()).bold(),
tq_stats.current_shares().to_string().bold(),
cpuratio
);
self.next_print
Expand Down Expand Up @@ -168,10 +168,7 @@ fn main() {
"cpuhog",
);

println!(
"{}",
Paint::new("Welcome to the Deadline Writer example").bold()
);
println!("{}", "Welcome to the Deadline Writer example".bold());
println!(
"In this example we will write a sequence of integers to a variable, busy looping \
for 500us after each write"
Expand All @@ -183,36 +180,33 @@ fn main() {
println!(
"For {} results, this test is pinned to your CPU0. Make sure nothing else of \
significance is running there. You should be able to see it at 100% at all times!",
Paint::new("best").bold()
"best".bold()
);

println!("\n\nPlease tell me how many integers you would like to write");
let to_write = read_int().await.unwrap();
println!(
"Ok, now let's write {} integers with both the writer and the CPU hog having the \
same priority",
Paint::blue(to_write.to_string())
to_write.to_string().blue()
);
let dur = static_writer(to_write, 1000, cpuhog_tq).await;
println!(
"Finished writing in {}",
Paint::green(format!("{dur:#.0?}"))
);
println!("Finished writing in {}", format!("{dur:#.0?}").green());
println!(
"This was using {} shares, and short of reducing the priority of the CPU hog. {}",
Paint::green("1000"),
Paint::new("This is as fast as we can do!").bold()
"1000".green(),
"This is as fast as we can do!".bold()
);
println!(
"With {} shares, this would have taken approximately {}",
Paint::green("100"),
Paint::green(format!("{:#.1?}", dur * 10))
"100".green(),
format!("{:#.1?}", dur * 10).green()
);
println!(
"With {} shares, this would have taken approximately {}. {}.",
Paint::green("1"),
Paint::green(format!("{:#.1?}", dur * 1000)),
Paint::new("Can't go any slower than that!").bold()
"1".green(),
format!("{:#.1?}", dur * 1000).green(),
"Can't go any slower than that!".bold()
);

println!(
Expand All @@ -233,10 +227,7 @@ fn main() {
let deadline = DeadlineQueue::new("example", Duration::from_millis(250));
let test = IntWriter::new(to_write, Duration::from_secs(duration as u64));
let dur = deadline.push_work(test).await.unwrap();
println!(
"Finished writing in {}",
Paint::green(format!("{dur:#.2?}"))
);
println!("Finished writing in {}", format!("{dur:#.2?}").green());
stop.set(true);
hog.await.unwrap();
println!(
Expand Down
2 changes: 1 addition & 1 deletion examples/defer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
use glommio::{defer, timer::TimerActionOnce, LocalExecutorBuilder};
use glommio::{LocalExecutorBuilder, defer, timer::TimerActionOnce};
use std::time::Duration;

fn main() {
Expand Down
34 changes: 1 addition & 33 deletions examples/hyper_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ mod hyper_compat {
use glommio::net::TcpStream;

use http_body_util::BodyExt;
use hyper::body::{Body as HttpBody, Bytes, Frame};
use hyper::Error;
use hyper::Request;
use hyper::body::{Body as HttpBody, Bytes, Frame};
use std::io;
use std::marker::PhantomData;

Expand Down Expand Up @@ -74,38 +74,6 @@ mod hyper_compat {
}
}

struct GlommioSleep(glommio::timer::Timer);

impl Future for GlommioSleep {
type Output = ();

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
match Pin::new(&mut self.0).poll(cx) {
Poll::Ready(_) => Poll::Ready(()),
Poll::Pending => Poll::Pending,
}
}
}

impl hyper::rt::Sleep for GlommioSleep {}
unsafe impl Send for GlommioSleep {}
unsafe impl Sync for GlommioSleep {}

#[derive(Clone, Copy, Debug)]
pub struct GlommioTimer;

impl hyper::rt::Timer for GlommioTimer {
fn sleep(&self, duration: std::time::Duration) -> Pin<Box<dyn hyper::rt::Sleep>> {
Box::pin(GlommioSleep(glommio::timer::Timer::new(duration)))
}

fn sleep_until(&self, deadline: std::time::Instant) -> Pin<Box<dyn hyper::rt::Sleep>> {
Box::pin(GlommioSleep(glommio::timer::Timer::new(
deadline - std::time::Instant::now(),
)))
}
}

struct Body {
// Our Body type is !Send and !Sync:
_marker: PhantomData<*const ()>,
Expand Down
4 changes: 2 additions & 2 deletions examples/hyper_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ mod hyper_compat {
sync::Semaphore,
};
use hyper::{
Error, Request, Response,
body::{Body as HttpBody, Bytes, Frame, Incoming},
service::service_fn,
Error, Request, Response,
};

use std::{
Expand Down Expand Up @@ -173,7 +173,7 @@ mod hyper_compat {
}

use glommio::{CpuSet, LocalExecutorPoolBuilder, PoolPlacement};
use hyper::{body::Incoming, Method, Request, Response, StatusCode};
use hyper::{Method, Request, Response, StatusCode, body::Incoming};
use hyper_compat::ResponseBody;
use std::convert::Infallible;

Expand Down
2 changes: 1 addition & 1 deletion examples/ping_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
use glommio::{enclose, LocalExecutor};
use glommio::{LocalExecutor, enclose};
use std::{cell::RefCell, rc::Rc};

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/sharding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use futures_lite::{future::ready, stream::repeat_with, FutureExt, StreamExt};
use futures_lite::{FutureExt, StreamExt, future::ready, stream::repeat_with};

use glommio::{
channels::{
Expand Down
5 changes: 2 additions & 3 deletions examples/storage.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
use byte_unit::{Byte, UnitType};
use clap::{Arg, Command};
use futures_lite::{
stream::{self, StreamExt},
AsyncReadExt, AsyncWriteExt,
stream::{self, StreamExt},
};
use glommio::{
enclose,
LocalExecutorBuilder, Placement, enclose,
io::{
BufferedFile, DmaFile, DmaStreamReader, DmaStreamReaderBuilder, DmaStreamWriterBuilder,
MergedBufferLimit, ReadAmplificationLimit, StreamReaderBuilder, StreamWriterBuilder,
},
LocalExecutorBuilder, Placement,
};
use std::{
cell::Cell,
Expand Down
76 changes: 38 additions & 38 deletions glommio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.9.0"
authors = [
"Glauber Costa <glommer@gmail.com>",
"Hippolyte Barraud <hippolyte.barraud@datadoghq.com>",
"DataDog <info@datadoghq.com>"
"DataDog <info@datadoghq.com>",
]
edition = "2021"
description = "Glommio is a thread-per-core crate that makes writing highly parallel asynchronous applications in a thread-per-core architecture easier for rustaceans."
Expand All @@ -15,55 +15,55 @@ keywords = ["linux", "rust", "async", "iouring", "thread-per-core"]
categories = ["asynchronous", "concurrency", "os", "filesystem", "network-programming"]
readme = "../README.md"
# This is also documented in the README.md under "Supported Rust Versions"
rust-version = "1.70"
rust-version = "1.92"

[features]
bench = []
debugging = []

# Unstable features based on nightly
native-tls = []
nightly = ["native-tls"]

[dependencies]
ahash = "0.7"
ahash = "0.8"
backtrace = { version = "0.3" }
bitflags = "2.4"
bitmaps = "3.1"
buddy-alloc = "0.4"
concurrent-queue = "1.2"
bencher = "0.1.5"
bitflags = "2.10"
bitmaps = "3.2"
buddy-alloc = "0.6"
concurrent-queue = "2.5"
crossbeam = "0.8"
enclose = "1.1"
flume = { version = "0.11", features = ["async"] }
futures-lite = "2.6.0"
intrusive-collections = "0.9"
lazy_static = "1.4"
enclose = "1.2"
flume = { version = "0.12", features = ["async"] }
futures-lite = "2.6"
intrusive-collections = "0.10"
lazy_static = "1.5"
libc = "0.2"
lockfree = "0.5"
log = "0.4"
nix = { version = "0.27", features = ["event", "fs", "ioctl", "mman", "net", "poll", "sched", "time"] }
nix = { version = "0.30", features = ["event", "fs", "ioctl", "mman", "net", "poll", "sched", "time"] }
pin-project-lite = "0.2"
rlimit = "0.6"
rlimit = "0.10"
scoped-tls = "1.0"
scopeguard = "1.1"
signal-hook = { version = "0.3" }
sketches-ddsketch = "0.1"
smallvec = { version = "1.7", features = ["union"] }
socket2 = { version = "0.4", features = ["all"] }
scopeguard = "1.2"
signal-hook = { version = "0.4" }
sketches-ddsketch = "0.3"
smallvec = { version = "1.15", features = ["union"] }
socket2 = { version = "0.6", features = ["all"] }
tracing = "0.1"
typenum = "1.15"

[dev-dependencies]
fastrand = "2"
futures = "0"
hdrhistogram = "7"
pretty_env_logger = "0"
rand = "0"
tokio = { version = "1", default-features = false, features = ["rt", "macros", "rt-multi-thread", "net", "io-util", "time", "sync"] }
tracing-subscriber = { version = "0", features = ["env-filter"] }
typenum = "1.19"

[build-dependencies]
cc = "1.0"

[features]
bench = []
debugging = []
cc = "1.2"

# Unstable features based on nightly
native-tls = []
nightly = ["native-tls"]
[dev-dependencies]
fastrand = "2.3"
futures = "0.3"
hdrhistogram = "7.5"
pretty_env_logger = "0.5"
rand = "0.9"
tokio = { version = "1.49", default-features = false, features = ["rt", "macros", "rt-multi-thread", "net", "io-util", "time", "sync"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[[bench]]
name = "executor"
Expand Down
Loading