summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-06-16 13:01:19 +0100
committerGitHub <noreply@github.com>2017-06-16 13:01:19 +0100
commitdfeca6cf40cdc151b75aa9ec1a3258faf50f7f82 (patch)
treea99404e75b53026d7b35dcc214c749b604763db4 /synapse/storage/events.py
parentMerge pull request #2280 from matrix-org/erikj/share_room_user_dir (diff)
parentInitial worker impl (diff)
downloadsynapse-dfeca6cf40cdc151b75aa9ec1a3258faf50f7f82.tar.xz
Merge pull request #2286 from matrix-org/erikj/split_out_user_dir
Split out user directory to a separate process
Diffstat (limited to 'synapse/storage/events.py')
-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 f60ed889d5..2b7340c1d9 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -2269,6 +2269,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",