rename / simplify tester stub for now
Signed-off-by: Jason Volk <jason@zemos.net> Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
b19d2ad5b0
commit
3585e8a2ef
6 changed files with 19 additions and 42 deletions
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -567,7 +567,6 @@ dependencies = [
|
||||||
"hickory-resolver",
|
"hickory-resolver",
|
||||||
"hmac",
|
"hmac",
|
||||||
"hot-lib-reloader",
|
"hot-lib-reloader",
|
||||||
"hot_lib",
|
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper 1.3.1",
|
"hyper 1.3.1",
|
||||||
|
@ -1347,10 +1346,6 @@ dependencies = [
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hot_lib"
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "html5ever"
|
name = "html5ever"
|
||||||
version = "0.26.0"
|
version = "0.26.0"
|
||||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -16,19 +16,11 @@ edition = "2021"
|
||||||
# See also `rust-toolchain.toml`
|
# See also `rust-toolchain.toml`
|
||||||
rust-version = "1.76.0"
|
rust-version = "1.76.0"
|
||||||
|
|
||||||
# for hot lib reload
|
|
||||||
[workspace]
|
|
||||||
members = ["hot_lib"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
console-subscriber = { version = "0.1", optional = true }
|
console-subscriber = { version = "0.1", optional = true }
|
||||||
|
|
||||||
# for hot lib reload
|
# for hot lib reload
|
||||||
# see https://github.com/rksm/hot-lib-reloader-rs?tab=readme-ov-file#usage for more details if you are a dev
|
|
||||||
hot-lib-reloader = { version = "^0.7", optional = true }
|
hot-lib-reloader = { version = "^0.7", optional = true }
|
||||||
hot_lib = { path = "hot_lib", optional = true }
|
|
||||||
# not sure if we need this, will anyone be using hot lib reload on release profile?
|
|
||||||
#no-mangle-if-debug = { version = "*" }
|
|
||||||
|
|
||||||
# Used for secure identifiers
|
# Used for secure identifiers
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
@ -408,7 +400,7 @@ perf_measurements = [
|
||||||
# incompatible with release_max_log_level
|
# incompatible with release_max_log_level
|
||||||
tokio_console = ["console-subscriber", "tokio/tracing"]
|
tokio_console = ["console-subscriber", "tokio/tracing"]
|
||||||
|
|
||||||
hot_reload = ["dep:hot-lib-reloader", "hot_lib"]
|
hot_reload = ["dep:hot-lib-reloader"]
|
||||||
|
|
||||||
hardened_malloc = ["hardened_malloc-rs"]
|
hardened_malloc = ["hardened_malloc-rs"]
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "hot_lib"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
crate-type = ["rlib", "dylib"]
|
|
||||||
|
|
||||||
# cargo watch -w hot_lib -x 'build -p hot_lib'
|
|
||||||
# ^this will rebuild upon cargo detecting any changes
|
|
|
@ -1,7 +0,0 @@
|
||||||
//! hot reloadable functions, generally called by the admin room test commands
|
|
||||||
//! see <https://github.com/rksm/hot-lib-reloader-rs?tab=readme-ov-file#usage> for more details if you are a dev
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub fn test_command() {
|
|
||||||
println!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
||||||
}
|
|
|
@ -26,10 +26,7 @@ use serde_json::value::to_raw_value;
|
||||||
use tokio::sync::{Mutex, MutexGuard};
|
use tokio::sync::{Mutex, MutexGuard};
|
||||||
use tracing::{error, warn};
|
use tracing::{error, warn};
|
||||||
|
|
||||||
use self::fsck::FsckCommand;
|
use self::{fsck::FsckCommand, tester::TesterCommands};
|
||||||
#[cfg(feature = "hot_reload")]
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
use self::test_cmd::TestCommands;
|
|
||||||
use super::pdu::PduBuilder;
|
use super::pdu::PduBuilder;
|
||||||
use crate::{
|
use crate::{
|
||||||
service::admin::{
|
service::admin::{
|
||||||
|
@ -47,9 +44,7 @@ pub(crate) mod media;
|
||||||
pub(crate) mod query;
|
pub(crate) mod query;
|
||||||
pub(crate) mod room;
|
pub(crate) mod room;
|
||||||
pub(crate) mod server;
|
pub(crate) mod server;
|
||||||
#[cfg(feature = "hot_reload")]
|
pub(crate) mod tester;
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub(crate) mod test_cmd;
|
|
||||||
pub(crate) mod user;
|
pub(crate) mod user;
|
||||||
|
|
||||||
const PAGE_SIZE: usize = 100;
|
const PAGE_SIZE: usize = 100;
|
||||||
|
@ -94,9 +89,8 @@ enum AdminCommand {
|
||||||
/// - Query all the database getters and iterators
|
/// - Query all the database getters and iterators
|
||||||
Fsck(FsckCommand),
|
Fsck(FsckCommand),
|
||||||
|
|
||||||
#[cfg(feature = "hot_reload")]
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
Test(TestCommands),
|
Tester(TesterCommands),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -314,8 +308,7 @@ impl Service {
|
||||||
AdminCommand::Debug(command) => debug::process(command, body).await?,
|
AdminCommand::Debug(command) => debug::process(command, body).await?,
|
||||||
AdminCommand::Query(command) => query::process(command, body).await?,
|
AdminCommand::Query(command) => query::process(command, body).await?,
|
||||||
AdminCommand::Fsck(command) => fsck::process(command, body).await?,
|
AdminCommand::Fsck(command) => fsck::process(command, body).await?,
|
||||||
#[cfg(feature = "hot_reload")]
|
AdminCommand::Tester(command) => tester::process(command, body).await?,
|
||||||
AdminCommand::Test(command) => test_cmd::process(command, body).await?,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(reply_message_content)
|
Ok(reply_message_content)
|
||||||
|
|
14
src/service/admin/tester/mod.rs
Normal file
14
src/service/admin/tester/mod.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
use ruma::events::room::message::RoomMessageEventContent;
|
||||||
|
|
||||||
|
use crate::Result;
|
||||||
|
|
||||||
|
#[cfg_attr(test, derive(Debug))]
|
||||||
|
#[derive(clap::Subcommand)]
|
||||||
|
pub(crate) enum TesterCommands {
|
||||||
|
Tester,
|
||||||
|
}
|
||||||
|
pub(crate) async fn process(command: TesterCommands, _body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||||
|
Ok(match command {
|
||||||
|
TesterCommands::Tester => RoomMessageEventContent::notice_plain(String::from("complete")),
|
||||||
|
})
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue