From a2b4c07cf700a5c0c1e95330db7b10729b00b666 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 1 Jul 2025 21:46:30 +0000 Subject: [PATCH] Additional internal pdu getters. Signed-off-by: Jason Volk --- src/service/rooms/timeline/data.rs | 33 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/service/rooms/timeline/data.rs b/src/service/rooms/timeline/data.rs index 42bede4f..9fe403fe 100644 --- a/src/service/rooms/timeline/data.rs +++ b/src/service/rooms/timeline/data.rs @@ -87,14 +87,21 @@ impl Data { .map(|pdu_id| pdu_id.pdu_count()) } + /// Returns the json of a pdu. + pub(super) async fn get_outlier_pdu_json( + &self, + event_id: &EventId, + ) -> Result { + self.eventid_outlierpdu + .get(event_id) + .await + .deserialized() + } + /// Returns the json of a pdu. pub(super) async fn get_pdu_json(&self, event_id: &EventId) -> Result { let accepted = self.get_non_outlier_pdu_json(event_id).boxed(); - let outlier = self - .eventid_outlierpdu - .get(event_id) - .map(Deserialized::deserialized) - .boxed(); + let outlier = self.get_outlier_pdu_json(event_id).boxed(); select_ok([accepted, outlier]).await.map(at!(0)) } @@ -133,16 +140,22 @@ impl Data { self.pduid_pdu.exists(&pduid).await } + /// Returns the pdu. + /// + /// Checks the `eventid_outlierpdu` Tree if not found in the timeline. + pub(super) async fn get_outlier_pdu(&self, event_id: &EventId) -> Result { + self.eventid_outlierpdu + .get(event_id) + .await + .deserialized() + } + /// Returns the pdu. /// /// Checks the `eventid_outlierpdu` Tree if not found in the timeline. pub(super) async fn get_pdu(&self, event_id: &EventId) -> Result { let accepted = self.get_non_outlier_pdu(event_id).boxed(); - let outlier = self - .eventid_outlierpdu - .get(event_id) - .map(Deserialized::deserialized) - .boxed(); + let outlier = self.get_outlier_pdu(event_id).boxed(); select_ok([accepted, outlier]).await.map(at!(0)) }