use std::sync::Arc; use ruma::{events::StateEventType, EventId, RoomId}; use super::{ShortEventId, ShortRoomId, ShortStateHash, ShortStateKey}; use crate::Result; pub(crate) trait Data: Send + Sync { /// The returned bool indicates whether it was created fn get_or_create_shorteventid( &self, event_id: &EventId, ) -> Result<(ShortEventId, bool)>; fn get_shortstatekey( &self, event_type: &StateEventType, state_key: &str, ) -> Result>; /// The returned bool indicates whether it was created fn get_or_create_shortstatekey( &self, event_type: &StateEventType, state_key: &str, ) -> Result<(ShortStateKey, bool)>; fn get_eventid_from_short( &self, shorteventid: ShortEventId, ) -> Result>; fn get_statekey_from_short( &self, shortstatekey: ShortStateKey, ) -> Result<(StateEventType, String)>; /// Returns `(shortstatehash, already_existed)` fn get_or_create_shortstatehash( &self, state_hash: &[u8], ) -> Result<(ShortStateHash, bool)>; fn get_shortroomid(&self, room_id: &RoomId) -> Result>; fn get_or_create_shortroomid( &self, room_id: &RoomId, ) -> Result; }