-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(MSD): migrate warp to axum (#162)
* migrating to axum * refactored * repinning
- Loading branch information
1 parent
e09734b
commit 096ed24
Showing
12 changed files
with
1,082 additions
and
1,193 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 10 additions & 15 deletions
25
rs/ic-observability/multiservice-discovery/src/server_handlers/delete_definition_handler.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 11 additions & 8 deletions
19
rs/ic-observability/multiservice-discovery/src/server_handlers/get_definition_handler.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
use warp::reply::json; | ||
use warp::Reply; | ||
use axum::extract::State; | ||
use axum::http::StatusCode; | ||
use axum::Json; | ||
|
||
use crate::definition::DefinitionsSupervisor; | ||
use crate::server_handlers::dto::DefinitionDto; | ||
use crate::server_handlers::WebResult; | ||
|
||
pub(super) async fn get_definitions(supervisor: DefinitionsSupervisor) -> WebResult<impl Reply> { | ||
let definitions = supervisor.definitions.lock().await; | ||
use super::Server; | ||
|
||
let list = &definitions | ||
pub(super) async fn get_definitions( | ||
State(supervisor): State<Server>, | ||
) -> Result<Json<Vec<DefinitionDto>>, (StatusCode, String)> { | ||
let definitions = supervisor.supervisor.definitions.lock().await; | ||
|
||
let list = definitions | ||
.iter() | ||
.map(|(_, d)| { | ||
let x = &d.definition; | ||
x.into() | ||
}) | ||
.collect::<Vec<DefinitionDto>>(); | ||
Ok(json(list)) | ||
Ok(Json(list)) | ||
} |
Oops, something went wrong.