mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 08:39:25 -05:00
add pydoc
This commit is contained in:
parent
7a6df013cc
commit
a6c8f7c875
@ -423,7 +423,11 @@ class SyncHandler(object):
|
||||
|
||||
Args:
|
||||
event(synapse.events.EventBase): event of interest
|
||||
|
||||
types(list[(str|None, str|None)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. If `state_key` is None,
|
||||
all events are returned of the given type. Presence of type of `None`
|
||||
indicates that types not in the list should not be filtered out.
|
||||
May be None, which matches any key.
|
||||
Returns:
|
||||
A Deferred map from ((type, state_key)->Event)
|
||||
"""
|
||||
@ -440,6 +444,11 @@ class SyncHandler(object):
|
||||
Args:
|
||||
room_id(str): room for which to get state
|
||||
stream_position(StreamToken): point at which to get state
|
||||
types(list[(str|None, str|None)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. If `state_key` is None,
|
||||
all events are returned of the given type. Presence of type of `None`
|
||||
indicates that types not in the list should not be filtered out.
|
||||
May be None, which matches any key.
|
||||
|
||||
Returns:
|
||||
A Deferred map from ((type, state_key)->Event)
|
||||
@ -472,8 +481,6 @@ class SyncHandler(object):
|
||||
be None.
|
||||
now_token(str): Token of the end of the current batch.
|
||||
full_state(bool): Whether to force returning the full state.
|
||||
lazy_load_members(bool): Whether to only return state for members
|
||||
referenced in this timeline segment
|
||||
|
||||
Returns:
|
||||
A deferred new event dictionary
|
||||
@ -496,7 +503,7 @@ class SyncHandler(object):
|
||||
types = [
|
||||
(EventTypes.Member, state_key)
|
||||
for state_key in set(
|
||||
event.sender # FIXME: we also care about targets etc.
|
||||
event.sender # FIXME: we also care about invite targets etc.
|
||||
for event in batch.events
|
||||
)
|
||||
]
|
||||
@ -1398,7 +1405,8 @@ class SyncHandler(object):
|
||||
return
|
||||
|
||||
state = yield self.compute_state_delta(
|
||||
room_id, batch, sync_config, since_token, now_token, full_state=full_state
|
||||
room_id, batch, sync_config, since_token, now_token,
|
||||
full_state=full_state
|
||||
)
|
||||
|
||||
if room_builder.rtype == "joined":
|
||||
|
@ -182,7 +182,19 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _get_state_groups_from_groups(self, groups, types):
|
||||
"""Returns dictionary state_group -> (dict of (type, state_key) -> event id)
|
||||
"""Returns the state groups for a given set of groups, filtering on
|
||||
types of state events.
|
||||
|
||||
Args:
|
||||
groups(list[int]): list of state group IDs to query
|
||||
types(list[str|None, str|None])|None: List of 2-tuples of the form
|
||||
(`type`, `state_key`), where a `state_key` of `None` matches all
|
||||
state_keys for the `type`. Presence of type of `None` indicates
|
||||
that types not in the list should not be filtered out. If None,
|
||||
all types are returned.
|
||||
|
||||
Returns:
|
||||
dictionary state_group -> (dict of (type, state_key) -> event id)
|
||||
"""
|
||||
results = {}
|
||||
|
||||
@ -204,6 +216,9 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
if types is not None:
|
||||
type_set = set(types)
|
||||
if (None, None) in type_set:
|
||||
# special case (None, None) to mean that other types should be
|
||||
# returned - i.e. we were just filtering down the state keys
|
||||
# for particular types.
|
||||
include_other_types = True
|
||||
type_set.remove((None, None))
|
||||
types = list(type_set) # deduplicate types list
|
||||
@ -360,10 +375,12 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
that are in the `types` list.
|
||||
|
||||
Args:
|
||||
event_ids (list)
|
||||
types (list): List of (type, state_key) tuples which are used to
|
||||
filter the state fetched. `state_key` may be None, which matches
|
||||
any `state_key`
|
||||
event_ids (list[string])
|
||||
types (list[(str|None, str|None)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. If `state_key` is None,
|
||||
all events are returned of the given type. Presence of type of `None`
|
||||
indicates that types not in the list should not be filtered out.
|
||||
May be None, which matches any key.
|
||||
|
||||
Returns:
|
||||
deferred: A list of dicts corresponding to the event_ids given.
|
||||
@ -399,9 +416,11 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
|
||||
Args:
|
||||
event_ids(list(str)): events whose state should be returned
|
||||
types(list[(str, str)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. May be None, which
|
||||
matches any key
|
||||
types(list[(str|None, str|None)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. If `state_key` is None,
|
||||
all events are returned of the given type. Presence of type of `None`
|
||||
indicates that types not in the list should not be filtered out.
|
||||
May be None, which matches any key.
|
||||
|
||||
Returns:
|
||||
A deferred dict from event_id -> (type, state_key) -> state_event
|
||||
@ -427,9 +446,11 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
|
||||
Args:
|
||||
event_id(str): event whose state should be returned
|
||||
types(list[(str, str)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. May be None, which
|
||||
matches any key
|
||||
types(list[(str|None, str|None)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. If `state_key` is None,
|
||||
all events are returned of the given type. Presence of type of `None`
|
||||
indicates that types not in the list should not be filtered out.
|
||||
May be None, which matches any key.
|
||||
|
||||
Returns:
|
||||
A deferred dict from (type, state_key) -> state_event
|
||||
@ -444,9 +465,11 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
|
||||
Args:
|
||||
event_id(str): event whose state should be returned
|
||||
types(list[(str, str)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. May be None, which
|
||||
matches any key
|
||||
types(list[(str|None, str|None)]|None): List of (type, state_key) tuples
|
||||
which are used to filter the state fetched. If `state_key` is None,
|
||||
all events are returned of the given type. Presence of type of `None`
|
||||
indicates that types not in the list should not be filtered out.
|
||||
May be None, which matches any key.
|
||||
|
||||
Returns:
|
||||
A deferred dict from (type, state_key) -> state_event
|
||||
@ -492,11 +515,11 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
missing state.
|
||||
|
||||
Args:
|
||||
group: The state group to lookup
|
||||
types (list): List of 2-tuples of the form (`type`, `state_key`),
|
||||
where a `state_key` of `None` matches all state_keys for the
|
||||
`type`. Presence of type of `None` indicates that types not
|
||||
in the list should not be filtered out.
|
||||
group(int): The state group to lookup
|
||||
types(list[str|None, str|None]): List of 2-tuples of the form
|
||||
(`type`, `state_key`), where a `state_key` of `None` matches all
|
||||
state_keys for the `type`. Presence of type of `None` indicates
|
||||
that types not in the list should not be filtered out.
|
||||
"""
|
||||
is_all, known_absent, state_dict_ids = self._state_group_cache.get(group)
|
||||
|
||||
@ -560,9 +583,18 @@ class StateGroupWorkerStore(SQLBaseStore):
|
||||
@defer.inlineCallbacks
|
||||
def _get_state_for_groups(self, groups, types=None):
|
||||
"""Given list of groups returns dict of group -> list of state events
|
||||
with matching types. `types` is a list of `(type, state_key)`, where
|
||||
a `state_key` of None matches all state_keys. If `types` is None then
|
||||
all events are returned.
|
||||
with matching types.
|
||||
|
||||
Args:
|
||||
groups(list[int]): list of groups whose state to query
|
||||
types(list[str|None, str|None]|None): List of 2-tuples of the form
|
||||
(`type`, `state_key`), where a `state_key` of `None` matches all
|
||||
state_keys for the `type`. Presence of type of `None` indicates
|
||||
that types not in the list should not be filtered out. If None,
|
||||
all events are returned.
|
||||
|
||||
Returns:
|
||||
dict of group -> list of state events
|
||||
"""
|
||||
if types:
|
||||
types = frozenset(types)
|
||||
|
Loading…
Reference in New Issue
Block a user