LCOV - code coverage report
Current view: top level - compute_tools/src/http/routes - promote.rs (source / functions) Coverage Total Hit
Test: 1d5975439f3c9882b18414799141ebf9a3922c58.info Lines: 0.0 % 17 0
Test Date: 2025-07-31 15:59:03 Functions: 0.0 % 2 0

            Line data    Source code
       1              : use crate::http::JsonResponse;
       2              : use axum::extract::Json;
       3              : use compute_api::responses::PromoteConfig;
       4              : use http::StatusCode;
       5              : 
       6            0 : pub(in crate::http) async fn promote(
       7            0 :     compute: axum::extract::State<std::sync::Arc<crate::compute::ComputeNode>>,
       8            0 :     Json(cfg): Json<PromoteConfig>,
       9            0 : ) -> axum::response::Response {
      10              :     // Return early at the cost of extra parsing spec
      11            0 :     let pspec = match crate::compute::ParsedSpec::try_from(cfg.spec) {
      12            0 :         Ok(p) => p,
      13            0 :         Err(e) => return JsonResponse::error(StatusCode::BAD_REQUEST, e),
      14              :     };
      15              : 
      16            0 :     let cfg = PromoteConfig {
      17            0 :         spec: pspec.spec,
      18            0 :         wal_flush_lsn: cfg.wal_flush_lsn,
      19            0 :     };
      20            0 :     let state = compute.promote(cfg).await;
      21            0 :     if let compute_api::responses::PromoteState::Failed { error: _ } = state {
      22            0 :         return JsonResponse::create_response(StatusCode::INTERNAL_SERVER_ERROR, state);
      23            0 :     }
      24            0 :     JsonResponse::success(StatusCode::OK, state)
      25            0 : }
        

Generated by: LCOV version 2.1-beta