refactor: work on search

This commit is contained in:
Timo Kösters 2022-07-10 16:28:43 +02:00 committed by Nyaaori
parent 91ad250177
commit b0029c49b9
No known key found for this signature in database
GPG key ID: E7819C3ED4D1F82E
16 changed files with 37 additions and 1007 deletions

View file

@ -0,0 +1,16 @@
impl service::room::metadata::Data for KeyValueDatabase {
fn exists(&self, room_id: &RoomId) -> Result<bool> {
let prefix = match self.get_shortroomid(room_id)? {
Some(b) => b.to_be_bytes().to_vec(),
None => return Ok(false),
};
// Look for PDUs in that room.
Ok(self
.pduid_pdu
.iter_from(&prefix, false)
.next()
.filter(|(k, _)| k.starts_with(&prefix))
.is_some())
}
}