diff options
author | Erik Johnston <erik@matrix.org> | 2019-01-29 22:00:33 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-01-29 22:00:33 +0000 |
commit | a696c48133d9f9a94f8b078aeacce0bef0d693b4 (patch) | |
tree | 8137f14c734d351f52af038265103f275276646a /synapse/storage | |
parent | Update synapse/storage/events_worker.py (diff) | |
parent | Merge pull request #4483 from matrix-org/erikj/event_v2 (diff) | |
download | synapse-a696c48133d9f9a94f8b078aeacce0bef0d693b4.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/redactions_eiah
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/event_federation.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py index d3b9dea1d6..38809ed0fc 100644 --- a/synapse/storage/event_federation.py +++ b/synapse/storage/event_federation.py @@ -125,6 +125,29 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, return dict(txn) + @defer.inlineCallbacks + def get_max_depth_of(self, event_ids): + """Returns the max depth of a set of event IDs + + Args: + event_ids (list[str]) + + Returns + Deferred[int] + """ + rows = yield self._simple_select_many_batch( + table="events", + column="event_id", + iterable=event_ids, + retcols=("depth",), + desc="get_max_depth_of", + ) + + if not rows: + defer.returnValue(0) + else: + defer.returnValue(max(row["depth"] for row in rows)) + def _get_oldest_events_in_room_txn(self, txn, room_id): return self._simple_select_onecol_txn( txn, |