check+clarify online backups are RocksDB only

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-20 00:50:22 -04:00 committed by June
parent 7af78cf708
commit 694986db29

View file

@ -437,7 +437,8 @@ enum ServerCommand {
amount: u32, amount: u32,
}, },
/// - Backup the database /// - Performs an online backup of the database (only available for RocksDB
/// at the moment)
BackupDatabase, BackupDatabase,
/// - List database backups /// - List database backups
@ -1882,6 +1883,12 @@ impl Service {
RoomMessageEventContent::text_plain(result) RoomMessageEventContent::text_plain(result)
}, },
ServerCommand::BackupDatabase => { ServerCommand::BackupDatabase => {
if !cfg!(feature = "rocksdb") {
return Ok(RoomMessageEventContent::text_plain(
"Only RocksDB supports online backups in conduwuit.",
));
}
let mut result = tokio::task::spawn_blocking(move || match services().globals.db.backup() { let mut result = tokio::task::spawn_blocking(move || match services().globals.db.backup() {
Ok(_) => String::new(), Ok(_) => String::new(),
Err(e) => (*e).to_string(), Err(e) => (*e).to_string(),