Skip to content

Commit

Permalink
migrate to hyper v1 (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl authored Sep 27, 2024
1 parent 826e820 commit 74286f9
Show file tree
Hide file tree
Showing 8 changed files with 593 additions and 219 deletions.
749 changes: 552 additions & 197 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ http = "0.2.12"
httptest = "0.16.1"
human_bytes = "0.4.3"
humantime = "2.1.0"
hyper = { version = "0.14", features = [ "full" ] }
hyper-staticfile = "0.9.6"
hyper = { version = "1", features = [ "full" ] }
hyper-staticfile = "0.10.0"
indicatif = { version = "0.17.8", features = ["rayon"] }
itertools = "0.13.0"
libc = "0.2"
Expand All @@ -76,7 +76,8 @@ rayon = "1.10.0"
rand = { version = "0.8.5", features = ["min_const_gen", "small_rng"] }
rand_chacha = "0.3.1"
reedline = "0.33.0"
reqwest = { version = "0.11", features = ["default", "blocking", "json", "stream"] }
reqwest = { version = "0.12", features = ["default", "blocking", "json", "stream"] }
reqwest11 = { package = "reqwest", version = "0.11", features = ["default", "blocking", "json", "stream"] }
ringbuffer = "0.15.0"
rusqlite = { version = "0.32" }
rustls-pemfile = { version = "1.0.4" }
Expand Down Expand Up @@ -112,16 +113,16 @@ usdt = "0.5.0"
uuid = { version = "1", features = [ "serde", "v4" ] }

# git
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] }
dropshot = { version = "0.12.0", features = [ "usdt-probes" ] }
omicron-common = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
nexus-client = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
internal-dns = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
omicron-uuid-kinds = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
openapi-lint = { git = "https://github.com/oxidecomputer/openapi-lint", branch = "main" }
oximeter = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
oximeter-producer = { git = "https://github.com/oxidecomputer/omicron", branch = "main" }
progenitor = { git = "https://github.com/oxidecomputer/progenitor", branch = "main" }
progenitor-client = { git = "https://github.com/oxidecomputer/progenitor", branch = "main" }
progenitor = "0.8.0"
progenitor-client = "0.8.0"

# local path
crucible = { path = "./upstairs" }
Expand Down
17 changes: 11 additions & 6 deletions downstairs/src/repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use std::path::PathBuf;
use std::sync::Arc;

use dropshot::ApiDescription;
use dropshot::Body;
use dropshot::ConfigDropshot;
use dropshot::HandlerTaskMode;
use dropshot::HttpError;
use dropshot::HttpResponseOk;
use dropshot::HttpServerStarter;
use dropshot::RequestContext;
use dropshot::{endpoint, Path};
use http::{Response, StatusCode};
use hyper::Body;
use hyper::{Response, StatusCode};
use schemars::JsonSchema;
use serde::Deserialize;

Expand Down Expand Up @@ -152,7 +152,9 @@ async fn get_extent_file(
get_a_file(extent_path).await
}

async fn get_a_file(path: PathBuf) -> Result<Response<Body>, HttpError> {
async fn get_a_file(
path: PathBuf,
) -> Result<Response<dropshot::Body>, HttpError> {
/*
* Make sure our file is neither a link nor a directory.
*/
Expand Down Expand Up @@ -181,13 +183,16 @@ async fn get_a_file(path: PathBuf) -> Result<Response<Body>, HttpError> {
)
})?;

let file_stream = hyper_staticfile::FileBytesStream::new(file);
let file_access = hyper_staticfile::vfs::TokioFileAccess::new(file);
let file_stream =
hyper_staticfile::util::FileBytesStream::new(file_access);
let body = Body::wrap(hyper_staticfile::Body::Full(file_stream));
let content_type = "application/octet-stream".to_string();

Ok(Response::builder()
.status(StatusCode::OK)
.header(http::header::CONTENT_TYPE, content_type)
.body(file_stream.into_body())?)
.header(hyper::header::CONTENT_TYPE, content_type)
.body(body)?)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pantry/src/pantry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ impl Pantry {
"volume {} is no longer active!",
volume_id
)),
http::StatusCode::GONE,
hyper::StatusCode::GONE,
format!("volume {} is no longer active!", volume_id),
))
} else {
Expand Down
1 change: 1 addition & 0 deletions upstairs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ uuid.workspace = true
aes-gcm-siv.workspace = true
rand_chacha.workspace = true
reqwest.workspace = true
reqwest11.workspace = true
crucible-workspace-hack.workspace = true
nexus-client = { workspace = true, optional = true }
internal-dns = { workspace = true, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions upstairs/src/downstairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub(crate) struct Downstairs {

/// A reqwest client, to be reused when creating Nexus clients
#[cfg(feature = "notify-nexus")]
reqwest_client: reqwest::Client,
reqwest_client: reqwest11::Client,
}

/// State machine for a live-repair operation
Expand Down Expand Up @@ -300,7 +300,7 @@ impl Downstairs {
ddef: None,

#[cfg(feature = "notify-nexus")]
reqwest_client: reqwest::ClientBuilder::new()
reqwest_client: reqwest11::ClientBuilder::new()
.connect_timeout(std::time::Duration::from_secs(15))
.timeout(std::time::Duration::from_secs(15))
.build()
Expand Down
2 changes: 1 addition & 1 deletion upstairs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ pub fn up_main(
#[cfg(feature = "notify-nexus")]
pub(crate) async fn get_nexus_client(
log: &Logger,
client: reqwest::Client,
client: reqwest11::Client,
target_addrs: &[SocketAddr],
) -> Option<nexus_client::Client> {
use internal_dns::resolver::Resolver;
Expand Down
24 changes: 18 additions & 6 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,54 +118,66 @@ zerocopy = { version = "0.7", features = ["derive", "simd"] }
[target.x86_64-unknown-linux-gnu.dependencies]
bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1" }
dof = { version = "0.3", default-features = false, features = ["des"] }
hyper = { version = "0.14", features = ["full"] }
hyper-582f2526e08bb6a0 = { package = "hyper", version = "0.14", features = ["full"] }
hyper-dff4ba8e3ae991db = { package = "hyper", version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
mio = { version = "1", features = ["net", "os-ext"] }
once_cell = { version = "1", features = ["unstable"] }
rustix = { version = "0.38", features = ["fs", "stdio", "termios"] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pki-types = { version = "1", features = ["std"] }
spin = { version = "0.9", default-features = false, features = ["once", "spin_mutex"] }

[target.x86_64-unknown-linux-gnu.build-dependencies]
dof = { version = "0.3", default-features = false, features = ["des"] }
hyper = { version = "0.14", features = ["full"] }
hyper-582f2526e08bb6a0 = { package = "hyper", version = "0.14", features = ["full"] }
mio = { version = "1", features = ["net", "os-ext"] }
once_cell = { version = "1", features = ["unstable"] }
rustix = { version = "0.38", features = ["fs", "stdio", "termios"] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pki-types = { version = "1", features = ["std"] }
spin = { version = "0.9", default-features = false, features = ["once", "spin_mutex"] }

[target.aarch64-apple-darwin.dependencies]
hyper = { version = "0.14", features = ["full"] }
hyper-582f2526e08bb6a0 = { package = "hyper", version = "0.14", features = ["full"] }
hyper-dff4ba8e3ae991db = { package = "hyper", version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
mio = { version = "1", features = ["net", "os-ext"] }
once_cell = { version = "1", features = ["unstable"] }
rustix = { version = "0.38", features = ["fs", "stdio", "termios"] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pki-types = { version = "1", features = ["std"] }

[target.aarch64-apple-darwin.build-dependencies]
hyper = { version = "0.14", features = ["full"] }
hyper-582f2526e08bb6a0 = { package = "hyper", version = "0.14", features = ["full"] }
mio = { version = "1", features = ["net", "os-ext"] }
once_cell = { version = "1", features = ["unstable"] }
rustix = { version = "0.38", features = ["fs", "stdio", "termios"] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pki-types = { version = "1", features = ["std"] }

[target.x86_64-unknown-illumos.dependencies]
bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1" }
dof = { version = "0.3", default-features = false, features = ["des"] }
hyper = { version = "0.14", features = ["full"] }
hyper-582f2526e08bb6a0 = { package = "hyper", version = "0.14", features = ["full"] }
hyper-dff4ba8e3ae991db = { package = "hyper", version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
mio = { version = "1", features = ["net", "os-ext"] }
once_cell = { version = "1", features = ["unstable"] }
rustix = { version = "0.38", features = ["fs", "stdio", "termios"] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pki-types = { version = "1", features = ["std"] }
spin = { version = "0.9", default-features = false, features = ["once", "spin_mutex"] }
toml_edit = { version = "0.19", features = ["serde"] }

[target.x86_64-unknown-illumos.build-dependencies]
dof = { version = "0.3", default-features = false, features = ["des"] }
hyper = { version = "0.14", features = ["full"] }
hyper-582f2526e08bb6a0 = { package = "hyper", version = "0.14", features = ["full"] }
mio = { version = "1", features = ["net", "os-ext"] }
once_cell = { version = "1", features = ["unstable"] }
rustix = { version = "0.38", features = ["fs", "stdio", "termios"] }
rustls = { version = "0.21", features = ["dangerous_configuration"] }
rustls-pki-types = { version = "1", features = ["std"] }
spin = { version = "0.9", default-features = false, features = ["once", "spin_mutex"] }
toml_edit = { version = "0.19", features = ["serde"] }

Expand Down

0 comments on commit 74286f9

Please sign in to comment.