diff options
author | Erik Johnston <erikj@jki.re> | 2019-01-29 14:07:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-29 14:07:23 +0000 |
commit | b8d75ef53eae4d4922325c5f1a02e93881f36888 (patch) | |
tree | 7eab7f65c77d0987d4ca072efb49b3c75811d896 /synapse/storage | |
parent | Implement MSC1708 (.well-known lookups for server routing) (#4489) (diff) | |
parent | Correctly set context.app_service (diff) | |
download | synapse-b8d75ef53eae4d4922325c5f1a02e93881f36888.tar.xz |
Merge pull request #4481 from matrix-org/erikj/event_builder
Refactor event building into EventBuilder
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, |