summary refs log tree commit diff
path: root/synapse/federation/units.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-17 10:29:23 +0000
committerErik Johnston <erik@matrix.org>2014-11-17 10:29:23 +0000
commit8c45c8b8b98c5a0e98bf4051994fed9847aadd08 (patch)
tree12c7ac945749c68b81e3ae55c39dfd58ae824bf0 /synapse/federation/units.py
parentMove getLastMessage to modelService. (diff)
parentMerge remote-tracking branch 'origin/develop' into merge_pdu_event_objects (diff)
downloadsynapse-8c45c8b8b98c5a0e98bf4051994fed9847aadd08.tar.xz
Merge pull request #14 from matrix-org/merge_pdu_event_objects
Merge pdu and event objects
Diffstat (limited to 'synapse/federation/units.py')
-rw-r--r--synapse/federation/units.py79
1 files changed, 1 insertions, 78 deletions
diff --git a/synapse/federation/units.py b/synapse/federation/units.py
index 70412439cd..6e708edb8c 100644
--- a/synapse/federation/units.py
+++ b/synapse/federation/units.py
@@ -25,83 +25,6 @@ import logging
 logger = logging.getLogger(__name__)
 
 
-class Pdu(JsonEncodedObject):
-    """ A Pdu represents a piece of data sent from a server and is associated
-    with a context.
-
-    A Pdu can be classified as "state". For a given context, we can efficiently
-    retrieve all state pdu's that haven't been clobbered. Clobbering is done
-    via a unique constraint on the tuple (context, type, state_key). A pdu
-    is a state pdu if `is_state` is True.
-
-    Example pdu::
-
-        {
-            "event_id": "$78c:example.com",
-            "origin_server_ts": 1404835423000,
-            "origin": "bar",
-            "prev_ids": [
-                ["23b", "foo"],
-                ["56a", "bar"],
-            ],
-            "content": { ... },
-        }
-
-    """
-
-    valid_keys = [
-        "event_id",
-        "room_id",
-        "origin",
-        "origin_server_ts",
-        "type",
-        "destinations",
-        "prev_events",
-        "depth",
-        "content",
-        "hashes",
-        "user_id",
-        "auth_events",
-        "signatures",  # Below this are keys valid only for State Pdus.
-        "state_key",
-        "prev_state",
-    ]
-
-    internal_keys = [
-        "destinations",
-        "transaction_id",
-        "outlier",
-    ]
-
-    required_keys = [
-        "event_id",
-        "room_id",
-        "origin",
-        "origin_server_ts",
-        "type",
-        "content",
-    ]
-
-    # TODO: We need to make this properly load content rather than
-    # just leaving it as a dict. (OR DO WE?!)
-
-    def __init__(self, destinations=[], prev_events=[],
-                 outlier=False, hashes={}, signatures={}, **kwargs):
-        super(Pdu, self).__init__(
-            destinations=destinations,
-            prev_events=prev_events,
-            outlier=outlier,
-            hashes=hashes,
-            signatures=signatures,
-            **kwargs
-        )
-
-    def __str__(self):
-        return "(%s, %s)" % (self.__class__.__name__, repr(self.__dict__))
-
-    def __repr__(self):
-        return "<%s, %s>" % (self.__class__.__name__, repr(self.__dict__))
-
 
 class Edu(JsonEncodedObject):
     """ An Edu represents a piece of data sent from one homeserver to another.
@@ -202,6 +125,6 @@ class Transaction(JsonEncodedObject):
         for p in pdus:
             p.transaction_id = kwargs["transaction_id"]
 
-        kwargs["pdus"] = [p.get_dict() for p in pdus]
+        kwargs["pdus"] = [p.get_pdu_json() for p in pdus]
 
         return Transaction(**kwargs)