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

WIP Igni/windowstests #3

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
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
63 changes: 32 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
[package]
name = "nuclei"
version = "0.1.0"
authors = ["Mahmut Bulut <[email protected]>"]
edition = "2018"
description = "Proactive IO & runtime system"
keywords = ["io", "async", "runtime", "uring", "iouring", "proactor"]
categories = ["concurrency", "asynchronous"]
homepage = "https://github.com/vertexclique/nuclei"
repository = "https://github.com/vertexclique/nuclei"
description = "Proactive IO & runtime system"
documentation = "https://docs.rs/nuclei"
license = "Apache-2.0/MIT"
readme = "README.md"
edition = "2018"
exclude = [
"data/*",
".github/*",
"examples/*",
"graphstore/*",
"tests/*",
"img/*",
"ci/*",
"benches/*",
"doc/*",
"*.png",
"*.dot",
"*.yml",
"*.toml",
"*.md"
"data/*",
".github/*",
"examples/*",
"graphstore/*",
"tests/*",
"img/*",
"ci/*",
"benches/*",
"doc/*",
"*.png",
"*.dot",
"*.yml",
"*.toml",
"*.md",
]
homepage = "https://github.com/vertexclique/nuclei"
keywords = ["io", "async", "runtime", "uring", "iouring", "proactor"]
license = "Apache-2.0/MIT"
name = "nuclei"
readme = "README.md"
repository = "https://github.com/vertexclique/nuclei"
version = "0.1.0"

[features]
default = ["bastion", "iouring"]
Expand All @@ -35,29 +35,30 @@ default = ["bastion", "iouring"]
epoll = []
iouring = ["iou", "uring-sys"]

bastion = ["agnostik/runtime_bastion"]
tokio = ["agnostik/runtime_tokio"]
asyncstd = ["agnostik/runtime_asyncstd"]
bastion = ["agnostik/runtime_bastion"]
smol = ["agnostik/runtime_smol"]
tokio = ["agnostik/runtime_tokio"]

[dependencies]
lever = "0.1.1-alpha.8"
futures = "0.3.5"
futures-util = "0.3.5"
socket2 = { version = "0.3.12", features = ["pair", "unix"] }
libc = "0.2"
pin-utils = "0.1.0"
once_cell = "1.4.0"
agnostik = "0.1.3"
pin-utils = "0.1.0"
socket2 = {version = "0.3.12", features = ["pair", "unix"]}
winapi = "0.3.9"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
winapi = "0.3.9"
winapi = { version = "0.3.9", default-features = false }

Then add each feature as needed, that will drastically reduce compile times.


# Other backends
[target.'cfg(target_os = "linux")'.dependencies]
iou = { version = "0.0.0-ringbahn.1", optional = true }
uring-sys = { version = "0.6.1", optional = true }
iou = {version = "0.0.0-ringbahn.1", optional = true}
uring-sys = {version = "0.6.1", optional = true}

[dev-dependencies]
anyhow = "1.0.31"
async-h1 = "2.0.2"
async-dup = "1.1.0"
async-h1 = "2.0.2"
http-types = "2.2.1"
num_cpus = "1.13.0"
num_cpus = "1.13.0"
26 changes: 12 additions & 14 deletions examples/fread-vect.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use nuclei::*;
use std::io;
use std::time::Duration;
use std::fs::{File, OpenOptions};
use std::io;
use std::path::PathBuf;
use std::time::Duration;

use futures::io::IoSliceMut;
use futures::AsyncRead;
use futures_util::io::AsyncReadExt;
use futures::io::IoSliceMut;
use std::ops::Deref;

const IOVEC_WIDTH: usize = 1 << 10;
Expand All @@ -30,18 +30,16 @@ fn main() -> io::Result<()> {
let mut file = Handle::<File>::new(fo).unwrap();
file.read_vectored(&mut bufs[..]).await.unwrap();

vec![
buf1,
buf2,
buf3,
]
vec![buf1, buf2, buf3]
});

x.iter()
.enumerate()
.for_each(|(idx, e)| {
println!("::: iovec ::: {}, data ::: \n\n{}\n\n", idx, String::from_utf8_lossy(&e[..]));
});
x.iter().enumerate().for_each(|(idx, e)| {
println!(
"::: iovec ::: {}, data ::: \n\n{}\n\n",
idx,
String::from_utf8_lossy(&e[..])
);
});

Ok(())
}
}
8 changes: 4 additions & 4 deletions examples/fread.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use nuclei::*;
use std::io;
use std::time::Duration;
use std::fs::{File, OpenOptions};
use std::io;
use std::path::PathBuf;
use std::time::Duration;
use std::time::Duration;

use futures::AsyncRead;
use futures_util::io::AsyncReadExt;


fn main() -> io::Result<()> {
let x = drive(async {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
Expand All @@ -25,4 +25,4 @@ fn main() -> io::Result<()> {
println!("Length of file is {}", x.len());

Ok(())
}
}
18 changes: 11 additions & 7 deletions examples/fwrite-vect.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use nuclei::*;
use std::io;
use std::time::Duration;
use std::fs::{File, OpenOptions};
use std::io;
use std::path::PathBuf;
use std::time::Duration;

use futures::{AsyncRead, AsyncWriteExt, AsyncSeek, AsyncSeekExt};
use futures_util::io::AsyncReadExt;
use futures::io::IoSliceMut;
use std::ops::Deref;
use futures::{AsyncRead, AsyncSeek, AsyncSeekExt, AsyncWriteExt};
use futures_util::io::AsyncReadExt;
use std::io::{IoSlice, Read, SeekFrom};
use std::ops::Deref;

const IOVEC_WIDTH: usize = 1 << 10;

Expand All @@ -27,7 +27,11 @@ fn main() -> io::Result<()> {
IoSlice::new(&buf3),
];

let fo = OpenOptions::new().read(true).write(true).open(&path).unwrap();
let fo = OpenOptions::new()
.read(true)
.write(true)
.open(&path)
.unwrap();
let mut file = Handle::<File>::new(fo).unwrap();
file.write_vectored(&bufs[..]).await.unwrap();

Expand All @@ -44,4 +48,4 @@ fn main() -> io::Result<()> {
println!("SG write was: {}", x);

Ok(())
}
}
14 changes: 9 additions & 5 deletions examples/fwrite.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use nuclei::*;
use std::io;
use std::time::Duration;
use std::fs::{File, OpenOptions};
use std::io;
use std::path::PathBuf;
use std::time::Duration;

use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, AsyncSeek, AsyncSeekExt};
use futures::io::SeekFrom;
use futures::{AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt, AsyncWrite, AsyncWriteExt};

const DARK_MATTER_TEXT: &'static str = "\
Dark matter is a form of matter thought to account for approximately \
Expand All @@ -31,7 +31,11 @@ fn main() -> io::Result<()> {
path.push("data");
path.push("dark-matter");

let fo = OpenOptions::new().read(true).write(true).open(&path).unwrap();
let fo = OpenOptions::new()
.read(true)
.write(true)
.open(&path)
.unwrap();
let mut file = Handle::<File>::new(fo).unwrap();
file.write_all(dark_matter.as_bytes()).await.unwrap();

Expand All @@ -45,4 +49,4 @@ fn main() -> io::Result<()> {
println!("Length of file is {}", x.len());

Ok(())
}
}
6 changes: 3 additions & 3 deletions examples/h1-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use nuclei::*;
use std::net::TcpListener;

use anyhow::Result;
use futures::prelude::*;
use http_types::{Request, Response, StatusCode};
use async_dup::Arc;
use futures::pending;
use futures::prelude::*;
use http_types::{Request, Response, StatusCode};

/// Serves a request and returns a response.
async fn serve(req: Request) -> http_types::Result<Response> {
Expand All @@ -30,7 +30,7 @@ async fn listen(listener: Handle<TcpListener>) -> Result<()> {
// Spawn a background task serving this connection.
let stream = Arc::new(stream);
spawn(async move {
if let Err(err) = async_h1::accept( stream, serve).await {
if let Err(err) = async_h1::accept(stream, serve).await {
println!("Connection error: {:#?}", err);
}
});
Expand Down
4 changes: 2 additions & 2 deletions examples/tcp-server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use futures::io;
use nuclei::*;
use std::net::{TcpListener, TcpStream};
use futures::io;

async fn echo(stream: Handle<TcpStream>) -> io::Result<()> {
io::copy(&stream, &mut &stream).await?;
Expand All @@ -23,4 +23,4 @@ fn main() -> io::Result<()> {
spawn_blocking(|| echo(stream));
}
})
}
}
Loading