cache compressed state in a sorted structure for logarithmic queries with partial keys
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
ea49b60273
commit
4add39d0fe
7 changed files with 118 additions and 73 deletions
|
@ -15,7 +15,7 @@ use ruma::{
|
|||
OwnedEventId, RoomId, RoomVersionId,
|
||||
};
|
||||
|
||||
use crate::rooms::state_compressor::CompressedStateEvent;
|
||||
use crate::rooms::state_compressor::CompressedState;
|
||||
|
||||
#[implement(super::Service)]
|
||||
#[tracing::instrument(name = "resolve", level = "debug", skip_all)]
|
||||
|
@ -24,7 +24,7 @@ pub async fn resolve_state(
|
|||
room_id: &RoomId,
|
||||
room_version_id: &RoomVersionId,
|
||||
incoming_state: HashMap<u64, OwnedEventId>,
|
||||
) -> Result<Arc<HashSet<CompressedStateEvent>>> {
|
||||
) -> Result<Arc<CompressedState>> {
|
||||
trace!("Loading current room state ids");
|
||||
let current_sstatehash = self
|
||||
.services
|
||||
|
@ -91,7 +91,7 @@ pub async fn resolve_state(
|
|||
.await;
|
||||
|
||||
trace!("Compressing state...");
|
||||
let new_room_state: HashSet<_> = self
|
||||
let new_room_state: CompressedState = self
|
||||
.services
|
||||
.state_compressor
|
||||
.compress_state_events(
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
use std::{
|
||||
borrow::Borrow,
|
||||
collections::{BTreeMap, HashSet},
|
||||
iter::once,
|
||||
sync::Arc,
|
||||
time::Instant,
|
||||
};
|
||||
use std::{borrow::Borrow, collections::BTreeMap, iter::once, sync::Arc, time::Instant};
|
||||
|
||||
use conduwuit::{
|
||||
debug, debug_info, err, implement, trace,
|
||||
|
@ -19,7 +13,10 @@ use ruma::{
|
|||
};
|
||||
|
||||
use super::{get_room_version_id, to_room_version};
|
||||
use crate::rooms::{state_compressor::HashSetCompressStateEvent, timeline::RawPduId};
|
||||
use crate::rooms::{
|
||||
state_compressor::{CompressedState, HashSetCompressStateEvent},
|
||||
timeline::RawPduId,
|
||||
};
|
||||
|
||||
#[implement(super::Service)]
|
||||
pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
||||
|
@ -173,7 +170,7 @@ pub(super) async fn upgrade_outlier_to_timeline_pdu(
|
|||
incoming_pdu.prev_events.len()
|
||||
);
|
||||
|
||||
let state_ids_compressed: Arc<HashSet<_>> = self
|
||||
let state_ids_compressed: Arc<CompressedState> = self
|
||||
.services
|
||||
.state_compressor
|
||||
.compress_state_events(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue