From b45b1896aafbb4e22e0f9912cb73edc9969aece1 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 21 Aug 2024 22:09:57 -0500 Subject: [PATCH] Fill out docstring --- synapse/storage/databases/main/events.py | 31 +++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index 2965821f84..5cf0f5dbd0 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -271,7 +271,6 @@ class PersistEventsStore: from being updated by these events. This should be set to True for backfilled events because backfilled events in the past do not affect the current local state. - sliding_sync_table_changes: TODO Returns: Resolves when the events have been persisted @@ -792,7 +791,10 @@ class PersistEventsStore: state_delta_for_room: The current-state delta for the room. new_forward_extremities: The new forward extremities for the room: a set of the event ids which are the forward extremities. - sliding_sync_table_changes: TODO + sliding_sync_table_changes: Changes to the + `sliding_sync_membership_snapshots` and `sliding_sync_joined_rooms` tables + derived from the given `delta_state` (see + `_calculate_sliding_sync_table_changes(...)`) Raises: PartialStateConflictError: if attempting to persist a partial state event in @@ -1453,7 +1455,17 @@ class PersistEventsStore: state_delta: DeltaState, sliding_sync_table_changes: SlidingSyncTableChanges, ) -> None: - """Update the current state stored in the datatabase for the given room""" + """ + Update the current state stored in the datatabase for the given room + + Args: + room_id + state_delta: Changes to the current state of the room + sliding_sync_table_changes: Changes to the + `sliding_sync_membership_snapshots` and `sliding_sync_joined_rooms` tables + derived from the given `delta_state` (see + `_calculate_sliding_sync_table_changes(...)`) + """ if state_delta.is_noop(): return @@ -1476,6 +1488,19 @@ class PersistEventsStore: stream_id: int, sliding_sync_table_changes: SlidingSyncTableChanges, ) -> None: + """ + Handles updating tables that track the current state of a room. + + Args: + txn + room_id + delta_state: Changes to the current state of the room + stream_id: TODO + sliding_sync_table_changes: Changes to the + `sliding_sync_membership_snapshots` and `sliding_sync_joined_rooms` tables + derived from the given `delta_state` (see + `_calculate_sliding_sync_table_changes(...)`) + """ to_delete = delta_state.to_delete to_insert = delta_state.to_insert