Skip to content

Commit

Permalink
Update axum to 0.8.1 (#10332)
Browse files Browse the repository at this point in the history
Only a few things that needed updating:

- async_trait was removed
- Message::Text takes a Utf8Bytes object instead of a String

Signed-off-by: Tristan Partin <[email protected]>
Co-authored-by: Conrad Ludgate <[email protected]>
  • Loading branch information
tristan957 and Conrad Ludgate authored Jan 28, 2025
1 parent 47677ba commit 15fecb8
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 87 deletions.
125 changes: 69 additions & 56 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ aws-smithy-types = "1.2"
aws-credential-types = "1.2.0"
aws-sigv4 = { version = "1.2", features = ["sign-http"] }
aws-types = "1.3"
axum = { version = "0.7.9", features = ["ws"] }
axum = { version = "0.8.1", features = ["ws"] }
base64 = "0.13.0"
bincode = "1.3"
bindgen = "0.70"
Expand Down
6 changes: 1 addition & 5 deletions compute_tools/src/http/extract/json.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::ops::{Deref, DerefMut};

use axum::{
async_trait,
extract::{rejection::JsonRejection, FromRequest, Request},
};
use axum::extract::{rejection::JsonRejection, FromRequest, Request};
use compute_api::responses::GenericAPIError;
use http::StatusCode;

Expand All @@ -12,7 +9,6 @@ use http::StatusCode;
#[derive(Debug, Clone, Copy, Default)]
pub(crate) struct Json<T>(pub T);

#[async_trait]
impl<S, T> FromRequest<S> for Json<T>
where
axum::Json<T>: FromRequest<S, Rejection = JsonRejection>,
Expand Down
6 changes: 1 addition & 5 deletions compute_tools/src/http/extract/path.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::ops::{Deref, DerefMut};

use axum::{
async_trait,
extract::{rejection::PathRejection, FromRequestParts},
};
use axum::extract::{rejection::PathRejection, FromRequestParts};
use compute_api::responses::GenericAPIError;
use http::{request::Parts, StatusCode};

Expand All @@ -12,7 +9,6 @@ use http::{request::Parts, StatusCode};
#[derive(Debug, Clone, Copy, Default)]
pub(crate) struct Path<T>(pub T);

#[async_trait]
impl<S, T> FromRequestParts<S> for Path<T>
where
axum::extract::Path<T>: FromRequestParts<S, Rejection = PathRejection>,
Expand Down
6 changes: 1 addition & 5 deletions compute_tools/src/http/extract/query.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::ops::{Deref, DerefMut};

use axum::{
async_trait,
extract::{rejection::QueryRejection, FromRequestParts},
};
use axum::extract::{rejection::QueryRejection, FromRequestParts};
use compute_api::responses::GenericAPIError;
use http::{request::Parts, StatusCode};

Expand All @@ -12,7 +9,6 @@ use http::{request::Parts, StatusCode};
#[derive(Debug, Clone, Copy, Default)]
pub(crate) struct Query<T>(pub T);

#[async_trait]
impl<S, T> FromRequestParts<S> for Query<T>
where
axum::extract::Query<T>: FromRequestParts<S, Rejection = QueryRejection>,
Expand Down
2 changes: 1 addition & 1 deletion compute_tools/src/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async fn serve(port: u16, compute: Arc<ComputeNode>) {
.route("/database_schema", get(database_schema::get_schema_dump))
.route("/dbs_and_roles", get(dbs_and_roles::get_catalog_objects))
.route(
"/extension_server/*filename",
"/extension_server/{*filename}",
post(extension_server::download_extension),
)
.route("/extensions", post(extensions::install_extension))
Expand Down
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ allow = [
"MIT",
"MPL-2.0",
"OpenSSL",
"Unicode-DFS-2016",
"Unicode-3.0",
"Zlib",
]
confidence-threshold = 0.8
exceptions = [
Expand Down
12 changes: 6 additions & 6 deletions libs/vm_monitor/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! (notifying it of upscale).
use anyhow::{bail, Context};
use axum::extract::ws::{Message, WebSocket};
use axum::extract::ws::{Message, Utf8Bytes, WebSocket};
use futures::{
stream::{SplitSink, SplitStream},
SinkExt, StreamExt,
Expand Down Expand Up @@ -82,21 +82,21 @@ impl Dispatcher {

let highest_shared_version = match monitor_range.highest_shared_version(&agent_range) {
Ok(version) => {
sink.send(Message::Text(
sink.send(Message::Text(Utf8Bytes::from(
serde_json::to_string(&ProtocolResponse::Version(version)).unwrap(),
))
)))
.await
.context("failed to notify agent of negotiated protocol version")?;
version
}
Err(e) => {
sink.send(Message::Text(
sink.send(Message::Text(Utf8Bytes::from(
serde_json::to_string(&ProtocolResponse::Error(format!(
"Received protocol version range {} which does not overlap with {}",
agent_range, monitor_range
)))
.unwrap(),
))
)))
.await
.context("failed to notify agent of no overlap between protocol version ranges")?;
Err(e).context("error determining suitable protocol version range")?
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Dispatcher {

let json = serde_json::to_string(&message).context("failed to serialize message")?;
self.sink
.send(Message::Text(json))
.send(Message::Text(Utf8Bytes::from(json)))
.await
.context("stream error sending message")
}
Expand Down
13 changes: 6 additions & 7 deletions pageserver/compaction/src/simulator/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,12 @@ pub fn draw_history<W: std::io::Write>(history: &[LayerTraceEvent], mut output:

// Fill in and thicken rectangle if it's an
// image layer so that we can see it.
let mut style = Style::default();
style.fill = Fill::Color(rgb(0x80, 0x80, 0x80));
style.stroke = Stroke::Color(rgb(0, 0, 0), 0.5);
let mut style = Style {
fill: Fill::Color(rgb(0x80, 0x80, 0x80)),
stroke: Stroke::Color(rgb(0, 0, 0), 0.5),
opacity: 1.0,
stroke_opacity: 1.0,
};

let y_start = lsn_max - lsn_start;
let y_end = lsn_max - lsn_end;
Expand Down Expand Up @@ -214,10 +217,6 @@ pub fn draw_history<W: std::io::Write>(history: &[LayerTraceEvent], mut output:
files_seen.insert(f);
}

let mut record_style = Style::default();
record_style.fill = Fill::Color(rgb(0x80, 0x80, 0x80));
record_style.stroke = Stroke::None;

writeln!(svg, "{}", EndSvg)?;

let mut layer_events_str = String::new();
Expand Down

1 comment on commit 15fecb8

@github-actions
Copy link

Choose a reason for hiding this comment

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

7565 tests run: 7203 passed, 0 failed, 362 skipped (full report)


Flaky tests (9)

Postgres 17

Postgres 14

Code coverage* (full report)

  • functions: 33.5% (8502 of 25357 functions)
  • lines: 49.3% (71504 of 145139 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
15fecb8 at 2025-01-28T18:12:44.478Z :recycle:

Please sign in to comment.