summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-15 11:47:23 +0100
committerErik Johnston <erik@matrix.org>2016-09-15 11:47:23 +0100
commit211786ecd629588f2481c94217a4a388b090c993 (patch)
tree0ba7a3190107ffc2c87d10546ed111ad9f68d7f2 /synapse/storage
parentBase public room list off of public_rooms stream (diff)
downloadsynapse-211786ecd629588f2481c94217a4a388b090c993.tar.xz
Stream public room changes down replication
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/room.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index 8aa4545939..2ef13d7403 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -307,3 +307,19 @@ class RoomStore(SQLBaseStore):
         return self.runInteraction(
             "get_public_room_changes", get_public_room_changes_txn
         )
+
+    def get_all_new_public_rooms(self, prev_id, current_id, limit):
+        def get_all_new_public_rooms(txn):
+            sql = ("""
+                SELECT stream_id, room_id, visibility FROM public_room_list_stream
+                WHERE stream_id > ? AND stream_id <= ?
+                ORDER BY stream_id ASC
+                LIMIT ?
+            """)
+
+            txn.execute(sql, (prev_id, current_id, limit,))
+            return txn.fetchall()
+
+        return self.runInteraction(
+            "get_all_new_public_rooms", get_all_new_public_rooms
+        )