diff options
author | Matthew Hodgson <matthew@matrix.org> | 2016-04-04 00:38:21 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2016-04-04 00:38:21 +0100 |
commit | 9f7dc2bef7cd39645ae74d96f2919a3f9fdb65ac (patch) | |
tree | b818eb0b962de7e860584bb5286f98e60e12ac75 /synapse/state.py | |
parent | report image size (bytewise) in OG meta (diff) | |
parent | Merge pull request #686 from matrix-org/markjh/doc_strings (diff) | |
download | synapse-9f7dc2bef7cd39645ae74d96f2919a3f9fdb65ac.tar.xz |
Merge branch 'develop' into matthew/preview_urls
Diffstat (limited to 'synapse/state.py')
-rw-r--r-- | synapse/state.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/synapse/state.py b/synapse/state.py index 41d32e664a..1bca0f8f78 100644 --- a/synapse/state.py +++ b/synapse/state.py @@ -86,7 +86,8 @@ class StateHandler(object): If `event_type` is specified, then the method returns only the one event (or None) with that `event_type` and `state_key`. - :returns map from (type, state_key) to event + Returns: + map from (type, state_key) to event """ event_ids = yield self.store.get_latest_event_ids_in_room(room_id) @@ -100,7 +101,7 @@ class StateHandler(object): defer.returnValue(state) @defer.inlineCallbacks - def compute_event_context(self, event, old_state=None, outlier=False): + def compute_event_context(self, event, old_state=None): """ Fills out the context with the `current state` of the graph. The `current state` here is defined to be the state of the event graph just before the event - i.e. it never includes `event` @@ -115,7 +116,7 @@ class StateHandler(object): """ context = EventContext() - if outlier: + if event.internal_metadata.is_outlier(): # If this is an outlier, then we know it shouldn't have any current # state. Certainly store.get_current_state won't return any, and # persisting the event won't store the state group. @@ -176,10 +177,11 @@ class StateHandler(object): """ Given a list of event_ids this method fetches the state at each event, resolves conflicts between them and returns them. - :returns a Deferred tuple of (`state_group`, `state`, `prev_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. + Returns: + a Deferred tuple of (`state_group`, `state`, `prev_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) @@ -251,9 +253,10 @@ class StateHandler(object): def _resolve_events(self, state_sets, event_type=None, state_key=""): """ - :returns a tuple (new_state, prev_states). new_state is a map - from (type, state_key) to event. prev_states is a list of event_ids. - :rtype: (dict[(str, str), synapse.events.FrozenEvent], list[str]) + Returns + (dict[(str, str), synapse.events.FrozenEvent], list[str]): a tuple + (new_state, prev_states). new_state is a map from (type, state_key) + to event. prev_states is a list of event_ids. """ with Measure(self.clock, "state._resolve_events"): state = {} |