Update EventContext get_current_event_ids and get_prev_event_ids to accept state filters and update calls where possible (#12791)

This commit is contained in:
Shay 2022-05-20 01:54:12 -07:00 committed by GitHub
parent 2be5a2b07b
commit 71e8afe34d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 65 additions and 18 deletions

View file

@ -634,16 +634,19 @@ class StateGroupStorage:
return group_to_state
async def get_state_ids_for_group(self, state_group: int) -> StateMap[str]:
async def get_state_ids_for_group(
self, state_group: int, state_filter: Optional[StateFilter] = None
) -> StateMap[str]:
"""Get the event IDs of all the state in the given state group
Args:
state_group: A state group for which we want to get the state IDs.
state_filter: specifies the type of state event to fetch from DB, example: EventTypes.JoinRules
Returns:
Resolves to a map of (type, state_key) -> event_id
"""
group_to_state = await self.get_state_for_groups((state_group,))
group_to_state = await self.get_state_for_groups((state_group,), state_filter)
return group_to_state[state_group]