From 434fcac357ef0e5826be93fb7695e6faa1c70c38 Mon Sep 17 00:00:00 2001 From: Vadim Kharitonov Date: Fri, 23 Dec 2022 10:23:28 +0100 Subject: [PATCH] Remove unused HTTP endpoints from compute_ctl --- compute_tools/src/http/api.rs | 30 +------------- compute_tools/src/http/openapi_spec.yaml | 51 ------------------------ 2 files changed, 1 insertion(+), 80 deletions(-) diff --git a/compute_tools/src/http/api.rs b/compute_tools/src/http/api.rs index 4c8bbc608b..44f83e5003 100644 --- a/compute_tools/src/http/api.rs +++ b/compute_tools/src/http/api.rs @@ -9,29 +9,11 @@ use hyper::{Body, Method, Request, Response, Server, StatusCode}; use log::{error, info}; use serde_json; -use crate::compute::{ComputeNode, ComputeStatus}; +use crate::compute::ComputeNode; // Service function to handle all available routes. async fn routes(req: Request, compute: Arc) -> Response { match (req.method(), req.uri().path()) { - // Timestamp of the last Postgres activity in the plain text. - // DEPRECATED in favour of /status - (&Method::GET, "/last_activity") => { - info!("serving /last_active GET request"); - let state = compute.state.read().unwrap(); - - // Use RFC3339 format for consistency. - Response::new(Body::from(state.last_active.to_rfc3339())) - } - - // Has compute setup process finished? -> true/false. - // DEPRECATED in favour of /status - (&Method::GET, "/ready") => { - info!("serving /ready GET request"); - let status = compute.get_status(); - Response::new(Body::from(format!("{}", status == ComputeStatus::Running))) - } - // Serialized compute state. (&Method::GET, "/status") => { info!("serving /status GET request"); @@ -46,16 +28,6 @@ async fn routes(req: Request, compute: Arc) -> Response Response::new(Body::from(serde_json::to_string(&compute.metrics).unwrap())) } - // DEPRECATED, use POST instead - (&Method::GET, "/check_writability") => { - info!("serving /check_writability GET request"); - let res = crate::checker::check_writability(&compute).await; - match res { - Ok(_) => Response::new(Body::from("true")), - Err(e) => Response::new(Body::from(e.to_string())), - } - } - (&Method::POST, "/check_writability") => { info!("serving /check_writability POST request"); let res = crate::checker::check_writability(&compute).await; diff --git a/compute_tools/src/http/openapi_spec.yaml b/compute_tools/src/http/openapi_spec.yaml index 9c0f8e3ccd..a857531d26 100644 --- a/compute_tools/src/http/openapi_spec.yaml +++ b/compute_tools/src/http/openapi_spec.yaml @@ -37,58 +37,7 @@ paths: schema: $ref: "#/components/schemas/ComputeMetrics" - /ready: - get: - deprecated: true - tags: - - "info" - summary: Check whether compute startup process finished successfully - description: "" - operationId: computeIsReady - responses: - "200": - description: Compute is ready ('true') or not ('false') - content: - text/plain: - schema: - type: string - example: "true" - - /last_activity: - get: - deprecated: true - tags: - - "info" - summary: Get timestamp of the last compute activity - description: "" - operationId: getLastComputeActivityTS - responses: - "200": - description: Timestamp of the last compute activity - content: - text/plain: - schema: - type: string - example: "2022-10-12T07:20:50.52Z" - /check_writability: - get: - deprecated: true - tags: - - "check" - summary: Check that we can write new data on this compute - description: "" - operationId: checkComputeWritabilityDeprecated - responses: - "200": - description: Check result - content: - text/plain: - schema: - type: string - description: Error text or 'true' if check passed - example: "true" - post: tags: - "check"