diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-08-28 07:28:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 07:28:53 -0400 |
commit | d5e73cb6aa56fbd267ca957e64ad893a9ef28708 (patch) | |
tree | 37fad0a115287864b1031d4511958ba4bef4ab85 /synapse/state/v1.py | |
parent | Move and refactor LoginRestServlet helper methods (#8182) (diff) | |
download | synapse-d5e73cb6aa56fbd267ca957e64ad893a9ef28708.tar.xz |
Define StateMap as immutable and add a MutableStateMap type. (#8183)
Diffstat (limited to 'synapse/state/v1.py')
-rw-r--r-- | synapse/state/v1.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/state/v1.py b/synapse/state/v1.py index 0eb7fdd9e5..a493279cbd 100644 --- a/synapse/state/v1.py +++ b/synapse/state/v1.py @@ -32,7 +32,7 @@ from synapse.api.constants import EventTypes from synapse.api.errors import AuthError from synapse.api.room_versions import RoomVersions from synapse.events import EventBase -from synapse.types import StateMap +from synapse.types import MutableStateMap, StateMap logger = logging.getLogger(__name__) @@ -131,7 +131,7 @@ async def resolve_events_with_store( def _seperate( state_sets: Iterable[StateMap[str]], -) -> Tuple[StateMap[str], StateMap[Set[str]]]: +) -> Tuple[MutableStateMap[str], MutableStateMap[Set[str]]]: """Takes the state_sets and figures out which keys are conflicted and which aren't. i.e., which have multiple different event_ids associated with them in different state sets. @@ -152,7 +152,7 @@ def _seperate( """ state_set_iterator = iter(state_sets) unconflicted_state = dict(next(state_set_iterator)) - conflicted_state = {} # type: StateMap[Set[str]] + conflicted_state = {} # type: MutableStateMap[Set[str]] for state_set in state_set_iterator: for key, value in state_set.items(): @@ -208,7 +208,7 @@ def _create_auth_events_from_maps( def _resolve_with_state( - unconflicted_state_ids: StateMap[str], + unconflicted_state_ids: MutableStateMap[str], conflicted_state_ids: StateMap[Set[str]], auth_event_ids: StateMap[str], state_map: Dict[str, EventBase], @@ -241,7 +241,7 @@ def _resolve_with_state( def _resolve_state_events( - conflicted_state: StateMap[List[EventBase]], auth_events: StateMap[EventBase] + conflicted_state: StateMap[List[EventBase]], auth_events: MutableStateMap[EventBase] ) -> StateMap[EventBase]: """ This is where we actually decide which of the conflicted state to use. |