diff options
| author | tv <tv@krebsco.de> | 2026-10-26 21:43:42 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 21:43:42 +0100 |
| commit | 3374b029bea44fed6ad5a46a7a05c269ce61af58 (patch) | |
| tree | ca9eba49e886c9dcd4416c4fe7790ca34f07f376 /src/api/peers.rs | |
| parent | 137b1547f847ff2402ea9e634b64ee2196a75075 (diff) | |
replace utoipa by static openapi.yaml
Diffstat (limited to 'src/api/peers.rs')
| -rw-r--r-- | src/api/peers.rs | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/src/api/peers.rs b/src/api/peers.rs index eb522b0..9af24c0 100644 --- a/src/api/peers.rs +++ b/src/api/peers.rs @@ -8,7 +8,6 @@ use axum::{ use serde::{Deserialize, Serialize}; use tokio::time::Instant; use tracing::warn; -use utoipa::ToSchema; use super::store_status; use crate::document::replica::Epoch; @@ -18,14 +17,14 @@ use crate::state::{AppState, HelloState, Incidents, Liveness}; use crate::swarm::peer::forgotten_path; use crate::transport::traffic::PeerTraffic; -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] #[serde(rename_all = "lowercase")] pub(crate) enum PeerLivenessStatus { Active, Dormant, } -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub(crate) struct EpochInfo { generation: u64, @@ -42,7 +41,7 @@ impl From<Epoch> for EpochInfo { } } -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub(crate) struct PeerStatus { public_key: String, @@ -75,7 +74,7 @@ pub(crate) struct PeerStatus { sync_throughput: Option<ThroughputInfo>, } -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub(crate) struct ThroughputInfo { bytes_per_sec: f64, @@ -84,7 +83,7 @@ pub(crate) struct ThroughputInfo { secs_ago: u64, } -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub(crate) struct PeerListResponse { /// Our own alias (`--alias`). @@ -102,18 +101,7 @@ pub(crate) struct DeletePeerQuery { force: Option<String>, } -#[utoipa::path( - get, - path = "/peers", - tag = "Peers", - responses( - ( - status = 200, - description = "Lists known peers and their local replication status", - body = PeerListResponse - ) - ) -)] +/// `GET /peers` (`docs/openapi.yaml`). pub(crate) async fn list_peers( State(state): State<AppState>, ) -> Result<Json<PeerListResponse>, StatusCode> { @@ -182,21 +170,7 @@ pub(crate) async fn list_peers( })) } -#[utoipa::path( - delete, - path = "/peers/{peer}", - tag = "Peers", - params( - ("peer" = String, Path, description = "Peer public key"), - ("force" = Option<String>, Query, description = "`true` or `alive`: also forget a peer that is currently alive; it returns on its next message") - ), - responses( - (status = 204, description = "Swarm-wide forget recorded"), - (status = 400, description = "Not a public key, or the local node's own key"), - (status = 409, description = "Peer is alive; pass force=alive"), - (status = 503, description = "Node is not ready") - ) -)] +/// `DELETE /peers/{pk}`: forgets a peer swarm-wide. pub(crate) async fn delete_peer( State(state): State<AppState>, Path(peer): Path<String>, |
