Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Rename StateCacheEntry.state to reduce confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jul 14, 2022
1 parent f4866ce commit c6ba3ad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions synapse/state/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _gen_state_id() -> str:


class _StateCacheEntry:
__slots__ = ["state", "state_group", "prev_group", "delta_ids"]
__slots__ = ["_state", "state_group", "prev_group", "delta_ids"]

def __init__(
self,
Expand All @@ -97,7 +97,7 @@ def __init__(
raise Exception("Either state or state group must be not None")

# A map from (type, state_key) to event_id.
self.state = frozendict(state) if state is not None else None
self._state = frozendict(state) if state is not None else None

# the ID of a state group if one and only one is involved.
# otherwise, None otherwise?
Expand All @@ -115,8 +115,8 @@ async def get_state(
looking up the state group in the DB.
"""

if self.state is not None:
return self.state
if self._state is not None:
return self._state

assert self.state_group is not None

Expand All @@ -129,7 +129,7 @@ def __len__(self) -> int:
# cache eviction purposes. This is why if `self.state` is None it's fine
# to return 1.

return len(self.state) if self.state else 1
return len(self._state) if self._state else 1


class StateHandler:
Expand Down

0 comments on commit c6ba3ad

Please sign in to comment.