mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-24 00:20:37 +00:00
This is a refactor to create better abstractions related to our management server. It cleans up the code, and prepares everything for authorized communication to and from the control plane. Signed-off-by: Tristan Partin <tristan@neon.tech>
15 lines
499 B
Rust
15 lines
499 B
Rust
use std::{ops::Deref, sync::Arc};
|
|
|
|
use axum::{extract::State, http::StatusCode, response::Response};
|
|
use compute_api::responses::ComputeStatusResponse;
|
|
|
|
use crate::{compute::ComputeNode, http::JsonResponse};
|
|
|
|
/// Retrieve the state of the comute.
|
|
pub(in crate::http) async fn get_status(State(compute): State<Arc<ComputeNode>>) -> Response {
|
|
let state = compute.state.lock().unwrap();
|
|
let body = ComputeStatusResponse::from(state.deref());
|
|
|
|
JsonResponse::success(StatusCode::OK, body)
|
|
}
|