summaryrefslogtreecommitdiff
path: root/src/database/key_value/rooms/state.rs
diff options
context:
space:
mode:
authorTimo Kösters <timo@koesters.xyz>2022-09-06 23:15:09 +0200
committerNyaaori <+@nyaaori.cat>2022-10-10 13:25:01 +0200
commit057f8364cc317dc8646043abd6c8ff3ef759625f (patch)
treef80bf450aa962947ab2651376768e021113a7ef6 /src/database/key_value/rooms/state.rs
parent82e7f57b389d011bc8d80f9142f723b3cd1e1ad2 (diff)
downloadconduit-057f8364cc317dc8646043abd6c8ff3ef759625f.zip
fix: some compile time errors
Only 174 errors left!
Diffstat (limited to 'src/database/key_value/rooms/state.rs')
-rw-r--r--src/database/key_value/rooms/state.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/database/key_value/rooms/state.rs b/src/database/key_value/rooms/state.rs
index 5daf6c6..192dbb8 100644
--- a/src/database/key_value/rooms/state.rs
+++ b/src/database/key_value/rooms/state.rs
@@ -1,4 +1,11 @@
-impl service::room::state::Data for KeyValueDatabase {
+use ruma::{RoomId, EventId};
+use std::sync::Arc;
+use std::{sync::MutexGuard, collections::HashSet};
+use std::fmt::Debug;
+
+use crate::{service, database::KeyValueDatabase, utils, Error};
+
+impl service::rooms::state::Data for KeyValueDatabase {
fn get_room_shortstatehash(&self, room_id: &RoomId) -> Result<Option<u64>> {
self.roomid_shortstatehash
.get(room_id.as_bytes())?
@@ -9,21 +16,21 @@ impl service::room::state::Data for KeyValueDatabase {
})
}
- fn set_room_state(&self, room_id: &RoomId, new_shortstatehash: u64
- _mutex_lock: &MutexGuard<'_, StateLock>, // Take mutex guard to make sure users get the room state mutex
+ fn set_room_state(&self, room_id: &RoomId, new_shortstatehash: u64,
+ _mutex_lock: &MutexGuard<'_, ()>, // Take mutex guard to make sure users get the room state mutex
) -> Result<()> {
self.roomid_shortstatehash
.insert(room_id.as_bytes(), &new_shortstatehash.to_be_bytes())?;
Ok(())
}
- fn set_event_state(&self) -> Result<()> {
- db.shorteventid_shortstatehash
+ fn set_event_state(&self, shorteventid: Vec<u8>, shortstatehash: Vec<u8>) -> Result<()> {
+ self.shorteventid_shortstatehash
.insert(&shorteventid.to_be_bytes(), &shortstatehash.to_be_bytes())?;
Ok(())
}
- fn get_pdu_leaves(&self, room_id: &RoomId) -> Result<HashSet<Arc<EventId>>> {
+ fn get_forward_extremities(&self, room_id: &RoomId) -> Result<HashSet<Arc<EventId>>> {
let mut prefix = room_id.as_bytes().to_vec();
prefix.push(0xff);
@@ -38,11 +45,11 @@ impl service::room::state::Data for KeyValueDatabase {
.collect()
}
- fn set_forward_extremities(
+ fn set_forward_extremities<'a>(
&self,
room_id: &RoomId,
event_ids: impl IntoIterator<Item = &'a EventId> + Debug,
- _mutex_lock: &MutexGuard<'_, StateLock>, // Take mutex guard to make sure users get the room state mutex
+ _mutex_lock: &MutexGuard<'_, ()>, // Take mutex guard to make sure users get the room state mutex
) -> Result<()> {
let mut prefix = room_id.as_bytes().to_vec();
prefix.push(0xff);