summary refs log tree commit diff
path: root/synapse/storage/receipts.py
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-03-01 15:08:24 +0000
committerMark Haines <mjark@negativecurvature.net>2016-03-01 15:08:24 +0000
commita612ce66597f2d3837c468803044e0400e385fe6 (patch)
tree0b5734ff804d1b7e24ea0039783695055f49f556 /synapse/storage/receipts.py
parentMerge pull request #613 from matrix-org/markjh/yield (diff)
parentAdd a /replication API for extracting the updates that happened on (diff)
downloadsynapse-a612ce66597f2d3837c468803044e0400e385fe6.tar.xz
Merge pull request #489 from matrix-org/markjh/replication
Add a /replication API for extracting the updates that happened on synapse.
Diffstat (limited to 'synapse/storage/receipts.py')
-rw-r--r--synapse/storage/receipts.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/receipts.py b/synapse/storage/receipts.py
index cd6dca4901..dbc074d6b5 100644
--- a/synapse/storage/receipts.py
+++ b/synapse/storage/receipts.py
@@ -390,3 +390,19 @@ class ReceiptsStore(SQLBaseStore):
                 "data": json.dumps(data),
             }
         )
+
+    def get_all_updated_receipts(self, last_id, current_id, limit):
+        def get_all_updated_receipts_txn(txn):
+            sql = (
+                "SELECT stream_id, room_id, receipt_type, user_id, event_id, data"
+                " FROM receipts_linearized"
+                " WHERE ? < stream_id AND stream_id <= ?"
+                " ORDER BY stream_id ASC"
+                " LIMIT ?"
+            )
+            txn.execute(sql, (last_id, current_id, limit))
+
+            return txn.fetchall()
+        return self.runInteraction(
+            "get_all_updated_receipts", get_all_updated_receipts_txn
+        )