summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-06-15 12:47:05 +0100
committerErik Johnston <erik@matrix.org>2017-06-16 11:47:11 +0100
commit6aa5bc86351a617546f0adacfebab3388716be3f (patch)
treeb11119ec7cfb2c01d4419884e96580cf0d7313fe /synapse/storage
parentInclude users who share room with requester in user directory (diff)
downloadsynapse-6aa5bc86351a617546f0adacfebab3388716be3f.tar.xz
Initial worker impl
Diffstat (limited to '')
-rw-r--r--synapse/storage/events.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 72ce84b0b8..90041b0da4 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -2284,6 +2284,24 @@ class EventsStore(SQLBaseStore):
 
         defer.returnValue((int(res["topological_ordering"]), int(res["stream_ordering"])))
 
+    def get_max_current_state_delta_stream_id(self):
+        return self._stream_id_gen.get_current_token()
+
+    def get_all_updated_current_state_deltas(self, from_token, to_token, limit):
+        def get_all_updated_current_state_deltas_txn(txn):
+            sql = """
+                SELECT stream_id, room_id, type, state_key, event_id
+                FROM current_state_delta_stream
+                WHERE ? < stream_id AND stream_id <= ?
+                ORDER BY stream_id ASC LIMIT ?
+            """
+            txn.execute(sql, (from_token, to_token, limit))
+            return txn.fetchall()
+        return self.runInteraction(
+            "get_all_updated_current_state_deltas",
+            get_all_updated_current_state_deltas_txn,
+        )
+
 
 AllNewEventsResult = namedtuple("AllNewEventsResult", [
     "new_forward_events", "new_backfill_events",