mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-04 00:44:10 -04:00
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>
This commit is contained in:
parent
d765ada84f
commit
7281591f4c
4 changed files with 35 additions and 24 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue