Files
continuwuity/src/admin/debug/mod.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

119 lines
2.6 KiB
Rust
Raw Normal View History

mod commands;
2024-06-23 09:06:25 +00:00
pub(crate) mod tester;
use clap::Subcommand;
2024-12-14 21:58:01 -05:00
use conduwuit::Result;
use ruma::{OwnedEventId, OwnedServerName};
2024-07-27 00:11:41 +00:00
use self::tester::TesterCommand;
use crate::admin_command_dispatch;
2024-07-24 00:14:03 +00:00
#[admin_command_dispatch]
#[derive(Debug, Subcommand)]
2025-05-24 00:28:09 +01:00
pub enum DebugCommand {
/// Echo input of admin command
2024-06-16 02:14:19 +00:00
Echo {
message: Vec<String>,
},
/// Parse and print a PDU from a JSON
///
/// The PDU event is only checked for validity and is not added to the
/// database.
///
/// This command needs a JSON blob provided in a Markdown code block below
/// the command.
ParsePdu,
/// Forces device lists for all local and remote users to be updated (as
/// having new keys available)
ForceDeviceListUpdates,
/// Change tracing log level/filter on the fly
///
/// This accepts the same format as the `log` config option.
ChangeLogLevel {
/// Log level/filter
filter: Option<String>,
/// Resets the log level/filter to the one in your config
#[arg(short, long)]
reset: bool,
},
/// Verify JSON signatures
///
/// This command needs a JSON blob provided in a Markdown code block below
/// the command.
VerifyJson,
/// Verify PDU
///
/// This re-verifies a PDU existing in the database found by ID.
VerifyPdu {
event_id: OwnedEventId,
},
/// Runs a server name through Continuwuity's true destination resolution
/// process
///
/// Useful for debugging well-known issues
ResolveTrueDestination {
server_name: OwnedServerName,
#[arg(short, long)]
no_cache: bool,
},
2024-04-27 04:50:20 -07:00
/// Print extended memory usage
2025-01-18 01:32:37 +00:00
///
/// Optional argument is a character mask (a sequence of characters in any
/// order) which enable additional extended statistics. Known characters are
/// "abdeglmx". For convenience, a '*' will enable everything.
MemoryStats {
opts: Option<String>,
},
2024-06-23 09:06:25 +00:00
/// Print general tokio runtime metric totals.
2024-06-25 05:05:02 +00:00
RuntimeMetrics,
/// Print detailed tokio runtime metrics accumulated since last command
2024-06-25 05:05:02 +00:00
/// invocation.
RuntimeInterval,
/// Print the current time
2024-07-24 00:15:03 +00:00
Time,
/// Get database statistics
DatabaseStats {
property: Option<String>,
#[arg(short, long, alias("column"))]
map: Option<String>,
},
/// Trim memory usage
TrimMemory,
/// List database files
DatabaseFiles {
map: Option<String>,
#[arg(long)]
level: Option<i32>,
},
/// Send a test email to the invoking admin's email address
SendTestEmail,
/// Lists room IDs by forward extremity count in descending order
RoomsByExtremityCount {
page: Option<usize>,
},
/// Developer test stubs
2024-06-23 09:06:25 +00:00
#[command(subcommand)]
2024-07-24 00:14:03 +00:00
#[allow(non_snake_case)]
2024-08-28 04:09:46 +00:00
#[clap(hide(true))]
2024-06-23 09:06:25 +00:00
Tester(TesterCommand),
}