Line data Source code
1 : use crate::http::JsonResponse;
2 : use axum::Form;
3 : use http::StatusCode;
4 :
5 0 : pub(in crate::http) async fn promote(
6 0 : compute: axum::extract::State<std::sync::Arc<crate::compute::ComputeNode>>,
7 0 : Form(safekeepers_lsn): Form<compute_api::responses::SafekeepersLsn>,
8 0 : ) -> axum::response::Response {
9 0 : let state = compute.promote(safekeepers_lsn).await;
10 0 : if let compute_api::responses::PromoteState::Failed { error } = state {
11 0 : return JsonResponse::error(StatusCode::INTERNAL_SERVER_ERROR, error);
12 0 : }
13 0 : JsonResponse::success(StatusCode::OK, state)
14 0 : }
|