Use immutabledict instead of frozendict (#15113)

Additionally:

* Consistently use `freeze()` in test

---------

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
David Robertson 2023-03-22 17:15:34 +00:00 committed by GitHub
parent cabe4a3005
commit 3b0083c92a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 123 additions and 243 deletions

View file

@ -33,7 +33,7 @@ from typing import (
)
import attr
from frozendict import frozendict
from immutabledict import immutabledict
from prometheus_client import Counter, Histogram
from synapse.api.constants import EventTypes
@ -105,14 +105,18 @@ class _StateCacheEntry:
#
# This can be None if we have a `state_group` (as then we can fetch the
# state from the DB.)
self._state = frozendict(state) if state is not None else None
self._state: Optional[StateMap[str]] = (
immutabledict(state) if state is not None else None
)
# the ID of a state group if one and only one is involved.
# otherwise, None otherwise?
self.state_group = state_group
self.prev_group = prev_group
self.delta_ids = frozendict(delta_ids) if delta_ids is not None else None
self.delta_ids: Optional[StateMap[str]] = (
immutabledict(delta_ids) if delta_ids is not None else None
)
async def get_state(
self,