Skip to content

Commit 53b8a54

Browse files
committed
chore(sdk): Rename update to update_with_event_cache in latest_events.
This patch renames the `update` methods to `update_with_event_cache` in the `latest_events` module. It frees the road to introduce `update_with_send_queue`.
1 parent 04d1c4c commit 53b8a54

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

crates/matrix-sdk/src/latest_events/latest_event.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ impl LatestEvent {
6767
self.value.subscribe().await
6868
}
6969

70-
/// Update the inner latest event value.
71-
pub async fn update(
70+
/// Update the inner latest event value, based on the event cache
71+
/// (specifically with a [`RoomEventCache`]).
72+
pub async fn update_with_event_cache(
7273
&mut self,
7374
room_event_cache: &RoomEventCache,
7475
power_levels: &Option<(&UserId, RoomPowerLevels)>,

crates/matrix-sdk/src/latest_events/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,9 @@ impl RoomLatestEvents {
507507
self.per_thread.get(thread_id)
508508
}
509509

510-
/// Update the latest events for the room and its threads.
511-
async fn update(&mut self) {
510+
/// Update the latest events for the room and its threads, based on the
511+
/// event cache data.
512+
async fn update_with_event_cache(&mut self) {
512513
// Get the power levels of the user for the current room if the `WeakRoom` is
513514
// still valid.
514515
//
@@ -525,10 +526,10 @@ impl RoomLatestEvents {
525526
None => None,
526527
};
527528

528-
self.for_the_room.update(&self.room_event_cache, &power_levels).await;
529+
self.for_the_room.update_with_event_cache(&self.room_event_cache, &power_levels).await;
529530

530531
for latest_event in self.per_thread.values_mut() {
531-
latest_event.update(&self.room_event_cache, &power_levels).await;
532+
latest_event.update_with_event_cache(&self.room_event_cache, &power_levels).await;
532533
}
533534
}
534535
}
@@ -677,7 +678,7 @@ async fn compute_latest_events(
677678
let mut rooms = registered_rooms.rooms.write().await;
678679

679680
if let Some(room_latest_events) = rooms.get_mut(room_id) {
680-
room_latest_events.update().await;
681+
room_latest_events.update_with_event_cache().await;
681682
} else {
682683
error!(?room_id, "Failed to find the room");
683684

0 commit comments

Comments
 (0)