summary refs log tree commit diff
path: root/synapse/storage/stream.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-05-09 11:55:34 +0100
committerErik Johnston <erik@matrix.org>2018-05-09 11:55:34 +0100
commitc4af4c24ca988832018feaf0ac5a2f6dbb8bfe68 (patch)
tree9fec1d41be28a78afcffdd77b5f532e607543a81 /synapse/storage/stream.py
parentRefactor pagination DB API to return concrete type (diff)
downloadsynapse-c4af4c24ca988832018feaf0ac5a2f6dbb8bfe68.tar.xz
Refactor get_recent_events_for_room return type
There is no reason to return a tuple of tokens when the last token is
always the token passed as an argument. Changing it makes it consistent
with other storage APIs
Diffstat (limited to '')
-rw-r--r--synapse/storage/stream.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/synapse/storage/stream.py b/synapse/storage/stream.py
index 772d2c6198..b5baacd32c 100644
--- a/synapse/storage/stream.py
+++ b/synapse/storage/stream.py
@@ -359,6 +359,20 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
 
     @defer.inlineCallbacks
     def get_recent_events_for_room(self, room_id, limit, end_token):
+        """Get the most recent events in the room in topological ordering.
+
+        Args:
+            room_id (str)
+            limit (int)
+            end_token (str): The stream token representing now.
+
+        Returns:
+            Deferred[tuple[list[FrozenEvent],  str]]: Returns a list of
+            events and a token pointint to the start of the returned
+            events.
+            The events returned are in ascending order.
+        """
+
         rows, token = yield self.get_recent_event_ids_for_room(
             room_id, limit, end_token,
         )
@@ -372,7 +386,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
 
         self._set_before_and_after(events, rows)
 
-        defer.returnValue((events, (token, end_token)))
+        defer.returnValue((events, token))
 
     @defer.inlineCallbacks
     def get_recent_event_ids_for_room(self, room_id, limit, end_token):