LCOV - code coverage report
Current view: top level - compute_tools/src/http/routes - check_writability.rs (source / functions) Coverage Total Hit
Test: 07bee600374ccd486c69370d0972d9035964fe68.info Lines: 0.0 % 10 0
Test Date: 2025-02-20 13:11:02 Functions: 0.0 % 2 0

            Line data    Source code
       1              : use std::sync::Arc;
       2              : 
       3              : use axum::{extract::State, response::Response};
       4              : use compute_api::responses::ComputeStatus;
       5              : use http::StatusCode;
       6              : 
       7              : use crate::{checker::check_writability, compute::ComputeNode, http::JsonResponse};
       8              : 
       9              : /// Check that the compute is currently running.
      10            0 : pub(in crate::http) async fn is_writable(State(compute): State<Arc<ComputeNode>>) -> Response {
      11            0 :     let status = compute.get_status();
      12            0 :     if status != ComputeStatus::Running {
      13            0 :         return JsonResponse::invalid_status(status);
      14            0 :     }
      15            0 : 
      16            0 :     match check_writability(&compute).await {
      17            0 :         Ok(_) => JsonResponse::success(StatusCode::OK, true),
      18            0 :         Err(e) => JsonResponse::error(StatusCode::INTERNAL_SERVER_ERROR, e),
      19              :     }
      20            0 : }
        

Generated by: LCOV version 2.1-beta