refactor: work on search
This commit is contained in:
parent
91ad250177
commit
b0029c49b9
16 changed files with 37 additions and 1007 deletions
16
src/database/key_value/rooms/metadata.rs
Normal file
16
src/database/key_value/rooms/metadata.rs
Normal 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())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue