tuwunel_admin/query/peer_status/mod.rs
1mod record_failure;
2mod record_success;
3mod should_attempt;
4mod snapshot;
5
6use clap::Subcommand;
7use ruma::OwnedServerName;
8use tuwunel_core::Result;
9
10use crate::admin_command_dispatch;
11
12/// Per-server reachability store backed by the `servername_status` CF and
13/// exposed through `tuwunel_service::federation::Service`.
14#[admin_command_dispatch(handler_prefix = "peer_status")]
15#[derive(Debug, Subcommand)]
16pub(crate) enum PeerStatusCommand {
17 /// List populated buckets, optionally filtered to one server.
18 Snapshot {
19 server_name: Option<OwnedServerName>,
20 },
21
22 /// Resolve the verdict the sender would observe right now for
23 /// `server_name`.
24 ShouldAttempt {
25 server_name: OwnedServerName,
26 },
27
28 /// Diagnostic: clear the current-window bucket for `server_name` as if a
29 /// transaction had just succeeded. Does not touch prior buckets, so the
30 /// walk-back streak still reflects the existing history.
31 RecordSuccess {
32 server_name: OwnedServerName,
33 },
34
35 /// Diagnostic: write a synthetic failure into the current-window bucket
36 /// for `server_name`. `--permanent` records a permanent verdict; otherwise
37 /// the value is transient.
38 RecordFailure {
39 server_name: OwnedServerName,
40 #[arg(long)]
41 permanent: bool,
42 },
43}