summary refs log tree commit diff
path: root/synapse/state.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-01-30 14:17:47 +0000
committerErik Johnston <erik@matrix.org>2015-01-30 14:17:47 +0000
commit84b78c3b5fe3f5e82c3fdf1a2a1c7eed62e1b887 (patch)
tree0475ae5759bd17bc76780a7f376e8a7bd900a430 /synapse/state.py
parentSplit up replication_layer module into client, server and transaction queue (diff)
parentMerge branch 'new_state_resolution' of github.com:matrix-org/synapse into rej... (diff)
downloadsynapse-84b78c3b5fe3f5e82c3fdf1a2a1c7eed62e1b887.tar.xz
Merge branch 'rejections_storage' of github.com:matrix-org/synapse into replication_split
Diffstat (limited to 'synapse/state.py')
-rw-r--r--synapse/state.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/synapse/state.py b/synapse/state.py
index d9fdfb34be..dff11711a6 100644
--- a/synapse/state.py
+++ b/synapse/state.py
@@ -37,13 +37,15 @@ def _get_state_key_from_event(event):
 KeyStateTuple = namedtuple("KeyStateTuple", ("context", "type", "state_key"))
 
 
+AuthEventTypes = (EventTypes.Create, EventTypes.Member, EventTypes.PowerLevels,)
+
+
 class StateHandler(object):
     """ Responsible for doing state conflict resolution.
     """
 
     def __init__(self, hs):
         self.store = hs.get_datastore()
-        # self.auth = hs.get_auth()
         self.hs = hs
 
     @defer.inlineCallbacks
@@ -215,7 +217,7 @@ class StateHandler(object):
 
         auth_events = {
             k: e for k, e in unconflicted_state.items()
-            if k[0] in (EventTypes.Create, EventTypes.Member, EventTypes.PowerLevels,)
+            if k[0] in AuthEventTypes
         }
 
         try:
@@ -240,10 +242,6 @@ class StateHandler(object):
             1. power levels
             2. memberships
             3. other events.
-
-        :param conflicted_state:
-        :param auth_events:
-        :return:
         """
         resolved_state = {}
         power_key = (EventTypes.PowerLevels, "")
@@ -305,4 +303,4 @@ class StateHandler(object):
         def key_func(e):
             return -int(e.depth), hashlib.sha1(e.event_id).hexdigest()
 
-        return sorted(events, key=key_func)
\ No newline at end of file
+        return sorted(events, key=key_func)