summary refs log tree commit diff
path: root/synapse/storage/devices.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-01-27 13:36:39 +0000
committerErik Johnston <erik@matrix.org>2017-01-27 14:31:35 +0000
commit252b503fc8626078141dc6b82eeff63607874347 (patch)
tree72667c5deb13c6f3cbcbc802ecf9c898a8c6d004 /synapse/storage/devices.py
parentComment (diff)
downloadsynapse-252b503fc8626078141dc6b82eeff63607874347.tar.xz
Hook device list updates to replication
Diffstat (limited to '')
-rw-r--r--synapse/storage/devices.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py
index 00317b0c1f..2b2cebacfa 100644
--- a/synapse/storage/devices.py
+++ b/synapse/storage/devices.py
@@ -458,6 +458,21 @@ class DeviceStore(SQLBaseStore):
         rows = yield self._execute("get_user_whose_devices_changed", None, sql, from_key)
         defer.returnValue(set(row["user_id"] for row in rows))
 
+    def get_users_and_hosts_device_list_changes(self, from_key):
+        """Return a list of `(stream_id, user_id, destination)` which is the
+        combined list of changes to devices, and which destinations need to be
+        poked. `destination` may be None if no destinations need to be poked.
+        """
+        sql = """
+            SELECT stream_id, user_id, destination FROM device_lists_stream
+            LEFT JOIN device_lists_outbound_pokes USING (stream_id, user_id, device_id)
+            WHERE stream_id > ?
+        """
+        return self._execute(
+            "get_users_and_hosts_device_list", None,
+            sql, from_key,
+        )
+
     @defer.inlineCallbacks
     def add_device_change_to_streams(self, user_id, device_ids, hosts):
         """Persist that a user's devices have been updated, and which hosts