2022-08-14 13:38:21 +02:00
|
|
|
pub trait Data {
|
2020-08-26 11:15:52 -04:00
|
|
|
/// Builds a StateMap by iterating over all keys that start
|
|
|
|
|
/// with state_hash, this gives the full state for the given state_hash.
|
2022-08-14 13:38:21 +02:00
|
|
|
async fn state_full_ids(&self, shortstatehash: u64) -> Result<BTreeMap<u64, Arc<EventId>>>;
|
2022-06-18 16:38:41 +02:00
|
|
|
|
2022-08-14 13:38:21 +02:00
|
|
|
async fn state_full(
|
2021-03-17 22:30:25 +01:00
|
|
|
&self,
|
|
|
|
|
shortstatehash: u64,
|
2022-08-14 13:38:21 +02:00
|
|
|
) -> Result<HashMap<(StateEventType, String), Arc<PduEvent>>>;
|
2020-08-06 08:29:59 -04:00
|
|
|
|
2020-09-17 14:44:47 +02:00
|
|
|
/// Returns a single PDU from `room_id` with key (`event_type`, `state_key`).
|
2022-08-14 13:38:21 +02:00
|
|
|
fn state_get_id(
|
2020-09-17 14:44:47 +02:00
|
|
|
&self,
|
2021-03-17 22:30:25 +01:00
|
|
|
shortstatehash: u64,
|
2022-04-06 21:31:29 +02:00
|
|
|
event_type: &StateEventType,
|
2020-09-17 14:44:47 +02:00
|
|
|
state_key: &str,
|
2022-08-14 13:38:21 +02:00
|
|
|
) -> Result<Option<Arc<EventId>>>;
|
2020-08-06 08:29:59 -04:00
|
|
|
|
2021-04-11 21:01:27 +02:00
|
|
|
/// Returns a single PDU from `room_id` with key (`event_type`, `state_key`).
|
2022-08-14 13:38:21 +02:00
|
|
|
fn state_get(
|
2021-04-11 21:01:27 +02:00
|
|
|
&self,
|
|
|
|
|
shortstatehash: u64,
|
2022-04-06 21:31:29 +02:00
|
|
|
event_type: &StateEventType,
|
2021-04-11 21:01:27 +02:00
|
|
|
state_key: &str,
|
2022-08-14 13:38:21 +02:00
|
|
|
) -> Result<Option<Arc<PduEvent>>>;
|
2021-04-11 21:01:27 +02:00
|
|
|
|
2021-01-16 16:37:20 -05:00
|
|
|
/// Returns the state hash for this pdu.
|
2022-08-14 13:38:21 +02:00
|
|
|
fn pdu_shortstatehash(&self, event_id: &EventId) -> Result<Option<u64>>;
|
2020-08-06 08:29:59 -04:00
|
|
|
|
2020-05-03 17:25:31 +02:00
|
|
|
/// Returns the full room state.
|
2022-08-14 13:38:21 +02:00
|
|
|
async fn room_state_full(
|
2020-12-31 08:40:49 -05:00
|
|
|
&self,
|
|
|
|
|
room_id: &RoomId,
|
2022-08-14 13:38:21 +02:00
|
|
|
) -> Result<HashMap<(StateEventType, String), Arc<PduEvent>>>;
|
2020-05-03 17:25:31 +02:00
|
|
|
|
2021-04-11 21:01:27 +02:00
|
|
|
/// Returns a single PDU from `room_id` with key (`event_type`, `state_key`).
|
2022-08-14 13:38:21 +02:00
|
|
|
fn room_state_get_id(
|
2021-04-11 21:01:27 +02:00
|
|
|
&self,
|
|
|
|
|
room_id: &RoomId,
|
2022-04-06 21:31:29 +02:00
|
|
|
event_type: &StateEventType,
|
2021-04-11 21:01:27 +02:00
|
|
|
state_key: &str,
|
2022-08-14 13:38:21 +02:00
|
|
|
) -> Result<Option<Arc<EventId>>>;
|
2021-04-11 21:01:27 +02:00
|
|
|
|
2020-08-26 11:15:52 -04:00
|
|
|
/// Returns a single PDU from `room_id` with key (`event_type`, `state_key`).
|
2022-08-14 13:38:21 +02:00
|
|
|
fn room_state_get(
|
2020-06-12 13:18:25 +02:00
|
|
|
&self,
|
|
|
|
|
room_id: &RoomId,
|
2022-04-06 21:31:29 +02:00
|
|
|
event_type: &StateEventType,
|
2020-06-12 13:18:25 +02:00
|
|
|
state_key: &str,
|
2022-08-14 13:38:21 +02:00
|
|
|
) -> Result<Option<Arc<PduEvent>>>;
|
|
|
|
|
}
|