use std::{collections::HashSet, sync::Arc}; use ruma::{EventId, OwnedEventId, OwnedRoomId, RoomId}; use crate::{ service::{ globals::marker, rooms::short::{ShortEventId, ShortStateHash}, }, utils::on_demand_hashmap::KeyToken, Result, }; pub(crate) trait Data: Send + Sync { /// Returns the last state hash key added to the db for the given room. fn get_room_shortstatehash( &self, room_id: &RoomId, ) -> Result>; /// Set the state hash to a new version, but does not update `state_cache`. fn set_room_state( &self, room_id: &KeyToken, new_shortstatehash: ShortStateHash, ) -> Result<()>; /// Associates a state with an event. fn set_event_state( &self, shorteventid: ShortEventId, shortstatehash: ShortStateHash, ) -> Result<()>; /// Returns all events we would send as the `prev_events` of the next event. fn get_forward_extremities( &self, room_id: &RoomId, ) -> Result>>; /// Replace the forward extremities of the room. fn set_forward_extremities( &self, room_id: &KeyToken, event_ids: Vec, ) -> Result<()>; }