mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-12 05:14:19 -05:00
Merge pull request #2836 from matrix-org/rav/resolve_state_events_docstring
Docstring fixes
This commit is contained in:
commit
9dcd667ac2
@ -58,7 +58,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):
|
||||||
|
# dict[(str, str), str] map from (type, state_key) to event_id
|
||||||
self.state = frozendict(state)
|
self.state = frozendict(state)
|
||||||
|
|
||||||
|
# the ID of a state group if one and only one is involved.
|
||||||
|
# otherwise, None otherwise?
|
||||||
self.state_group = state_group
|
self.state_group = state_group
|
||||||
|
|
||||||
self.prev_group = prev_group
|
self.prev_group = prev_group
|
||||||
@ -288,11 +292,12 @@ class StateHandler(object):
|
|||||||
""" Given a list of event_ids this method fetches the state at each
|
""" Given a list of event_ids this method fetches the state at each
|
||||||
event, resolves conflicts between them and returns them.
|
event, resolves conflicts between them and returns them.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
room_id (str):
|
||||||
|
event_ids (list[str]):
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
a Deferred tuple of (`state_group`, `state`, `prev_state`).
|
Deferred[_StateCacheEntry]: resolved state
|
||||||
`state_group` is the name of a state group if one and only one is
|
|
||||||
involved. `state` is a map from (type, state_key) to event, and
|
|
||||||
`prev_state` is a list of event ids.
|
|
||||||
"""
|
"""
|
||||||
logger.debug("resolve_state_groups event_ids %s", event_ids)
|
logger.debug("resolve_state_groups event_ids %s", event_ids)
|
||||||
|
|
||||||
@ -437,8 +442,8 @@ def resolve_events_with_state_map(state_sets, state_map):
|
|||||||
state_sets.
|
state_sets.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
dict[(str, str), synapse.events.FrozenEvent]:
|
dict[(str, str), str]:
|
||||||
a map from (type, state_key) to event.
|
a map from (type, state_key) to event_id.
|
||||||
"""
|
"""
|
||||||
if len(state_sets) == 1:
|
if len(state_sets) == 1:
|
||||||
return state_sets[0]
|
return state_sets[0]
|
||||||
@ -460,6 +465,21 @@ def _seperate(state_sets):
|
|||||||
"""Takes the state_sets and figures out which keys are conflicted and
|
"""Takes the state_sets and figures out which keys are conflicted and
|
||||||
which aren't. i.e., which have multiple different event_ids associated
|
which aren't. i.e., which have multiple different event_ids associated
|
||||||
with them in different state sets.
|
with them in different state sets.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
state_sets(list[dict[(str, str), str]]):
|
||||||
|
List of dicts of (type, state_key) -> event_id, which are the
|
||||||
|
different state groups to resolve.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
(dict[(str, str), str], dict[(str, str), set[str]]):
|
||||||
|
A tuple of (unconflicted_state, conflicted_state), where:
|
||||||
|
|
||||||
|
unconflicted_state is a dict mapping (type, state_key)->event_id
|
||||||
|
for unconflicted state keys.
|
||||||
|
|
||||||
|
conflicted_state is a dict mapping (type, state_key) to a set of
|
||||||
|
event ids for conflicted state keys.
|
||||||
"""
|
"""
|
||||||
unconflicted_state = dict(state_sets[0])
|
unconflicted_state = dict(state_sets[0])
|
||||||
conflicted_state = {}
|
conflicted_state = {}
|
||||||
@ -500,8 +520,8 @@ def resolve_events_with_factory(state_sets, state_map_factory):
|
|||||||
a Deferred of dict of event_id to event.
|
a Deferred of dict of event_id to event.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
Deferred[dict[(str, str), synapse.events.FrozenEvent]]:
|
Deferred[dict[(str, str), str]]:
|
||||||
a map from (type, state_key) to event.
|
a map from (type, state_key) to event_id.
|
||||||
"""
|
"""
|
||||||
if len(state_sets) == 1:
|
if len(state_sets) == 1:
|
||||||
defer.returnValue(state_sets[0])
|
defer.returnValue(state_sets[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user