From 5c61b4d4a3c52311237ae5423b9cb83c3dcfe4b7 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 7 Oct 2025 18:10:24 +0000 Subject: [PATCH] Add room state accessor iterating state_keys joined by respective event_id. Signed-off-by: Jason Volk --- src/api/mod.rs | 2 +- .../rooms/state_accessor/room_state.rs | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/api/mod.rs b/src/api/mod.rs index 1141f6c6..344c4300 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,4 +1,4 @@ -#![type_length_limit = "163840"] //TODO: REDUCE ME +#![type_length_limit = "589824"] //TODO: REDUCE ME #![allow(clippy::toplevel_ref_arg)] pub mod client; diff --git a/src/service/rooms/state_accessor/room_state.rs b/src/service/rooms/state_accessor/room_state.rs index 0879c648..9e0dc024 100644 --- a/src/service/rooms/state_accessor/room_state.rs +++ b/src/service/rooms/state_accessor/room_state.rs @@ -99,6 +99,30 @@ where .await } +/// Iterates the state_keys for an event_type in the state joined by the +/// `event_id` from the current state. +#[implement(super::Service)] +#[tracing::instrument(skip(self), level = "debug")] +pub fn room_state_keys_with_ids<'a, Id>( + &'a self, + room_id: &'a RoomId, + event_type: &'a StateEventType, +) -> impl Stream> + Send + 'a +where + Id: for<'de> Deserialize<'de> + Send + Sized + ToOwned + 'a, + ::Owned: Borrow, +{ + self.services + .state + .get_room_shortstatehash(room_id) + .map_ok(|shortstatehash| { + self.state_keys_with_ids(shortstatehash, event_type) + .map(Ok) + }) + .map_err(move |e| err!(Database("Missing state for {room_id:?}: {e:?}"))) + .try_flatten_stream() +} + /// Iterates the state_keys for an event_type in the state #[implement(super::Service)] #[tracing::instrument(skip(self), level = "debug")]