|
|
@ -26,6 +26,7 @@ from synapse.events.snapshot import EventContext |
|
|
|
from synapse.util.async import Linearizer |
|
|
|
from synapse.util.async import Linearizer |
|
|
|
|
|
|
|
|
|
|
|
from collections import namedtuple |
|
|
|
from collections import namedtuple |
|
|
|
|
|
|
|
from frozendict import frozendict |
|
|
|
|
|
|
|
|
|
|
|
import logging |
|
|
|
import logging |
|
|
|
import hashlib |
|
|
|
import hashlib |
|
|
@ -58,11 +59,11 @@ class _StateCacheEntry(object): |
|
|
|
__slots__ = ["state", "state_group", "state_id", "prev_group", "delta_ids"] |
|
|
|
__slots__ = ["state", "state_group", "state_id", "prev_group", "delta_ids"] |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, state, state_group, prev_group=None, delta_ids=None): |
|
|
|
def __init__(self, state, state_group, prev_group=None, delta_ids=None): |
|
|
|
self.state = state |
|
|
|
self.state = frozendict(state) |
|
|
|
self.state_group = state_group |
|
|
|
self.state_group = state_group |
|
|
|
|
|
|
|
|
|
|
|
self.prev_group = prev_group |
|
|
|
self.prev_group = prev_group |
|
|
|
self.delta_ids = delta_ids |
|
|
|
self.delta_ids = frozendict(delta_ids) if delta_ids is not None else None |
|
|
|
|
|
|
|
|
|
|
|
# The `state_id` is a unique ID we generate that can be used as ID for |
|
|
|
# The `state_id` is a unique ID we generate that can be used as ID for |
|
|
|
# this collection of state. Usually this would be the same as the |
|
|
|
# this collection of state. Usually this would be the same as the |
|
|
@ -255,6 +256,7 @@ class StateHandler(object): |
|
|
|
context.prev_group = entry.prev_group |
|
|
|
context.prev_group = entry.prev_group |
|
|
|
context.delta_ids = entry.delta_ids |
|
|
|
context.delta_ids = entry.delta_ids |
|
|
|
if context.delta_ids is not None: |
|
|
|
if context.delta_ids is not None: |
|
|
|
|
|
|
|
context.delta_ids = dict(context.delta_ids) |
|
|
|
context.delta_ids[key] = event.event_id |
|
|
|
context.delta_ids[key] = event.event_id |
|
|
|
else: |
|
|
|
else: |
|
|
|
context.current_state_ids = context.prev_state_ids |
|
|
|
context.current_state_ids = context.prev_state_ids |
|
|
|