mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-21 01:31:24 +01:00
Add wrapper types for short IDs
This commit is contained in:
parent
f1642c92d1
commit
b0f33207fe
28 changed files with 427 additions and 232 deletions
|
|
@ -3,25 +3,33 @@ use std::{collections::HashSet, sync::Arc};
|
|||
use ruma::{EventId, OwnedEventId, OwnedRoomId, RoomId};
|
||||
|
||||
use crate::{
|
||||
service::globals::marker, utils::on_demand_hashmap::KeyToken, Result,
|
||||
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<Option<u64>>;
|
||||
fn get_room_shortstatehash(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
) -> Result<Option<ShortStateHash>>;
|
||||
|
||||
/// Set the state hash to a new version, but does not update `state_cache`.
|
||||
fn set_room_state(
|
||||
&self,
|
||||
room_id: &KeyToken<OwnedRoomId, marker::State>,
|
||||
new_shortstatehash: u64,
|
||||
new_shortstatehash: ShortStateHash,
|
||||
) -> Result<()>;
|
||||
|
||||
/// Associates a state with an event.
|
||||
fn set_event_state(
|
||||
&self,
|
||||
shorteventid: u64,
|
||||
shortstatehash: u64,
|
||||
shorteventid: ShortEventId,
|
||||
shortstatehash: ShortStateHash,
|
||||
) -> Result<()>;
|
||||
|
||||
/// Returns all events we would send as the `prev_events` of the next event.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue