summary refs log tree commit diff
path: root/synapse/state
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-07-15 13:20:47 +0100
committerGitHub <noreply@github.com>2022-07-15 12:20:47 +0000
commit7281591f4cf81db2fa9e00187d9a91179c6e6a98 (patch)
tree3e5e5711687d2834f1f894f3a7f5f9548ec336ac /synapse/state
parentUpdate locked frozendict version to 2.3.2 (#13284) (diff)
downloadsynapse-7281591f4cf81db2fa9e00187d9a91179c6e6a98.tar.xz
Use state before join to determine if we `_should_perform_remote_join` (#13270)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Diffstat (limited to 'synapse/state')
-rw-r--r--synapse/state/__init__.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py

index 3a65bd0849..56606e9afb 100644 --- a/synapse/state/__init__.py +++ b/synapse/state/__init__.py
@@ -153,22 +153,27 @@ class StateHandler: ReplicationUpdateCurrentStateRestServlet.make_client(hs) ) - async def get_current_state_ids( + async def compute_state_after_events( self, room_id: str, - latest_event_ids: Collection[str], + event_ids: Collection[str], ) -> StateMap[str]: - """Get the current state, or the state at a set of events, for a room + """Fetch the state after each of the given event IDs. Resolve them and return. + + This is typically used where `event_ids` is a collection of forward extremities + in a room, intended to become the `prev_events` of a new event E. If so, the + return value of this function represents the state before E. Args: - room_id: - latest_event_ids: The forward extremities to resolve. + room_id: the room_id containing the given events. + event_ids: the events whose state should be fetched and resolved. Returns: - the state dict, mapping from (event_type, state_key) -> event_id + the state dict (a mapping from (event_type, state_key) -> event_id) which + holds the resolution of the states after the given event IDs. """ - logger.debug("calling resolve_state_groups from get_current_state_ids") - ret = await self.resolve_state_groups_for_events(room_id, latest_event_ids) + logger.debug("calling resolve_state_groups from compute_state_after_events") + ret = await self.resolve_state_groups_for_events(room_id, event_ids) return await ret.get_state(self._state_storage_controller, StateFilter.all()) async def get_current_users_in_room(