summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-10-31 10:47:34 +0000
committerErik Johnston <erik@matrix.org>2014-10-31 10:47:34 +0000
commit21fe249d62deafceca05cc114d5d6bec3e815b8c (patch)
treef7f24bbda7e6df1a12da0324639720a9d5eea20f /synapse/handlers/federation.py
parentold_state_events should be a dict not list (diff)
downloadsynapse-21fe249d62deafceca05cc114d5d6bec3e815b8c.tar.xz
Actually don't store any PDUs
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r--synapse/handlers/federation.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 9f457ce292..18cb1d4e97 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -415,6 +415,28 @@ class FederationHandler(BaseHandler):
             for e in events
         ])
 
+    @defer.inlineCallbacks
+    @log_function
+    def get_persisted_pdu(self, pdu_id, origin):
+        """ Get a PDU from the database with given origin and id.
+
+        Returns:
+            Deferred: Results in a `Pdu`.
+        """
+        event = yield self.store.get_event(
+            self.pdu_codec.encode_event_id(pdu_id, origin),
+            allow_none=True,
+        )
+
+        if event:
+            defer.returnValue(self.pdu_codec.pdu_from_event(event))
+        else:
+            defer.returnValue(None)
+
+    @log_function
+    def get_min_depth_for_context(self, context):
+        return self.store.get_min_depth(context)
+
     @log_function
     def _on_user_joined(self, user, room_id):
         waiters = self.waiting_for_join_list.get((user.to_string(), room_id), [])