mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-08-18 11:14:41 +02:00
refactor: restore src/service/rooms/state/data.rs
This commit is contained in:
parent
28644f236e
commit
1442c64420
16
src/service/rooms/state/data.rs
Normal file
16
src/service/rooms/state/data.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
pub trait Data {
|
||||
fn get_room_shortstatehash(room_id: &RoomId);
|
||||
}
|
||||
|
||||
/// Returns the last state hash key added to the db for the given room.
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn current_shortstatehash(&self, room_id: &RoomId) -> Result<Option<u64>> {
|
||||
self.roomid_shortstatehash
|
||||
.get(room_id.as_bytes())?
|
||||
.map_or(Ok(None), |bytes| {
|
||||
Ok(Some(utils::u64_from_bytes(&bytes).map_err(|_| {
|
||||
Error::bad_database("Invalid shortstatehash in roomid_shortstatehash")
|
||||
})?))
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in a new issue