From bd7195111cf4abe34a1f55b996a8c638a051577f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 14:16:23 +0000 Subject: [PATCH 1/7] fix(deps): update rust crate axum to 0.6.2 --- server/Cargo.lock | 82 ++++++++++++----------------------------------- server/Cargo.toml | 2 +- 2 files changed, 22 insertions(+), 62 deletions(-) diff --git a/server/Cargo.lock b/server/Cargo.lock index 14d80e8..0aac2c0 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -54,12 +54,12 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.5.17" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" +checksum = "1304eab461cf02bd70b083ed8273388f9724c549b316ba3d1e213ce0e9e7fb7e" dependencies = [ "async-trait", - "axum-core 0.2.9", + "axum-core", "bitflags", "bytes", "futures-util", @@ -67,13 +67,15 @@ dependencies = [ "http-body", "hyper", "itoa", - "matchit 0.5.0", + "matchit", "memchr", "mime", "percent-encoding", "pin-project-lite", + "rustversion", "serde", "serde_json", + "serde_path_to_error", "serde_urlencoded", "sync_wrapper", "tokio", @@ -83,56 +85,11 @@ dependencies = [ "tower-service", ] -[[package]] -name = "axum" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744864363a200a5e724a7e61bc8c11b6628cf2e3ec519c8a1a48e609a8156b40" -dependencies = [ - "async-trait", - "axum-core 0.3.0", - "bitflags", - "bytes", - "futures-util", - "http", - "http-body", - "hyper", - "itoa", - "matchit 0.6.0", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper", - "tower", - "tower-http", - "tower-layer", - "tower-service", -] - [[package]] name = "axum-core" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http", - "http-body", - "mime", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92" +checksum = "f487e40dc9daee24d8a1779df88522f159a54a980f99cfbe43db0be0bd3444a8" dependencies = [ "async-trait", "bytes", @@ -482,15 +439,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "matchit" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" - -[[package]] -name = "matchit" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfc802da7b1cf80aefffa0c7b2f77247c8b32206cc83c270b61264f5b360a80" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" [[package]] name = "memchr" @@ -846,7 +797,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "axum 0.5.17", + "axum", "envy", "indexmap", "pbjson-types", @@ -890,6 +841,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b04f22b563c91331a10074bda3dd5492e3cc39d56bd557e91c0af42b6c7341" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1048,7 +1008,7 @@ checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" dependencies = [ "async-stream", "async-trait", - "axum 0.6.0", + "axum", "base64", "bytes", "flate2", diff --git a/server/Cargo.toml b/server/Cargo.toml index ab7fbaa..94d1e4a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -axum = "0.5.17" +axum = "0.6.2" async-trait = "0.1.61" pbjson-types = "0.5.1" prost = "0.11.6" From 1a9c010f5cffb5bfaac6f9ef21e3fdfa3a314e0b Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Wed, 18 Jan 2023 23:29:20 +0900 Subject: [PATCH 2/7] fix: use State extractor --- server/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 124e5fc..47a25e0 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -135,6 +135,7 @@ mod infra_axum_handlers { use crate::domain::PlayerDataRepository; use crate::use_cases::GetAllPlayerDataUseCase; use axum::body; + use axum::extract::State; use axum::handler::Handler; use axum::http::StatusCode; use axum::response::{IntoResponse, Response}; @@ -199,7 +200,7 @@ mod infra_axum_handlers { ) } - pub fn handle_get_metrics(state: SharedAppState) -> impl Handler<()> { + pub fn handle_get_metrics(State(state): State) -> impl Handler<()> { // we need a separate handler function to create an error tracing span #[tracing::instrument] async fn handler(state: &SharedAppState) -> Response { @@ -437,7 +438,8 @@ mod app { use axum::Router; Router::new() - .route("/metrics", get(handle_get_metrics(shared_state.clone()))) + .route("/metrics", get(handle_get_metrics)) + .with_state(shared_state.clone()) .layer(TraceLayer::new_for_http()) }; From bb6406e0156cfb4f9e4eed8a37633938c7ff1e46 Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Wed, 18 Jan 2023 23:39:13 +0900 Subject: [PATCH 3/7] fix: fix compile error --- server/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index 47a25e0..d4c4114 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -200,7 +200,7 @@ mod infra_axum_handlers { ) } - pub fn handle_get_metrics(State(state): State) -> impl Handler<()> { + pub fn handle_get_metrics(State(state): State) { // we need a separate handler function to create an error tracing span #[tracing::instrument] async fn handler(state: &SharedAppState) -> Response { From 8dabaae31ce09d46065fb2bb113b376f67293903 Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Wed, 18 Jan 2023 23:44:28 +0900 Subject: [PATCH 4/7] fix: fix compile error --- server/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index d4c4114..ac48323 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -200,7 +200,7 @@ mod infra_axum_handlers { ) } - pub fn handle_get_metrics(State(state): State) { + pub fn handle_get_metrics(State(state): State) -> impl Handler<_, _, _> { // we need a separate handler function to create an error tracing span #[tracing::instrument] async fn handler(state: &SharedAppState) -> Response { From fda938055d078d7d9ebc9a806dcdf01ffd1b75cb Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Wed, 18 Jan 2023 23:55:53 +0900 Subject: [PATCH 5/7] fix: fix compile error about generics --- server/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index ac48323..b2876d7 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -200,7 +200,9 @@ mod infra_axum_handlers { ) } - pub fn handle_get_metrics(State(state): State) -> impl Handler<_, _, _> { + pub fn handle_get_metrics( + State(state): State, + ) -> impl Handler<_, SharedAppState, ()> { // we need a separate handler function to create an error tracing span #[tracing::instrument] async fn handler(state: &SharedAppState) -> Response { From cbe267b581040fac1f85c450732787f45369d8a7 Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Thu, 19 Jan 2023 00:00:56 +0900 Subject: [PATCH 6/7] fix: fix compile error --- server/src/main.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index b2876d7..fdec14a 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -200,9 +200,7 @@ mod infra_axum_handlers { ) } - pub fn handle_get_metrics( - State(state): State, - ) -> impl Handler<_, SharedAppState, ()> { + pub fn handle_get_metrics(State(state): State) -> () { // we need a separate handler function to create an error tracing span #[tracing::instrument] async fn handler(state: &SharedAppState) -> Response { From fc314deeeb7702d8358bdaa2944b18203b01bb2d Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Thu, 19 Jan 2023 00:03:28 +0900 Subject: [PATCH 7/7] revert: fix: compile error --- server/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index fdec14a..b2876d7 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -200,7 +200,9 @@ mod infra_axum_handlers { ) } - pub fn handle_get_metrics(State(state): State) -> () { + pub fn handle_get_metrics( + State(state): State, + ) -> impl Handler<_, SharedAppState, ()> { // we need a separate handler function to create an error tracing span #[tracing::instrument] async fn handler(state: &SharedAppState) -> Response {