Room deletion (fixes #43)

This commit is contained in:
dasha_uwu
2025-08-22 20:21:05 +05:00
parent 7a3496869b
commit d05d3f710f
15 changed files with 447 additions and 7 deletions

View File

@@ -9,12 +9,13 @@ use serde_json::json;
use tuwunel_core::{
Event, Result, err,
matrix::pdu::{PduCount, PduEvent, PduId, RawPduId},
trace,
utils::{
ReadyExt,
stream::{TryIgnore, WidebandExt},
},
};
use tuwunel_database::{Deserialized, Map};
use tuwunel_database::{Deserialized, Interfix, Map};
pub struct Service {
db: Data,
@@ -191,4 +192,20 @@ impl Service {
.await
.deserialized()
}
pub(super) async fn delete_all_rooms_threads(&self, room_id: &RoomId) -> Result {
let prefix = (room_id, Interfix);
self.db
.threadid_userids
.keys_prefix_raw(&prefix)
.ignore_err()
.ready_for_each(|key| {
trace!("Removing key: {key:?}");
self.db.threadid_userids.remove(key);
})
.await;
Ok(())
}
}