diff options
author | Erik Johnston <erik@matrix.org> | 2014-11-07 15:35:53 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-11-07 15:35:53 +0000 |
commit | 02c3b1c9e2afa27753e9ce898e5455b6489541b4 (patch) | |
tree | 48bda5021f9fce4d52aa0b70fe47ee6a1bc2be56 /synapse/storage/event_federation.py | |
parent | Implement invite part of invite join dance (diff) | |
download | synapse-02c3b1c9e2afa27753e9ce898e5455b6489541b4.tar.xz |
Add '/event_auth/' federation api
Diffstat (limited to 'synapse/storage/event_federation.py')
-rw-r--r-- | synapse/storage/event_federation.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py index d66a49e9f2..06e32d592d 100644 --- a/synapse/storage/event_federation.py +++ b/synapse/storage/event_federation.py @@ -32,6 +32,24 @@ class EventFederationStore(SQLBaseStore): ) def _get_auth_chain_txn(self, txn, event_id): + results = self._get_auth_chain_ids_txn(txn, event_id) + + sql = "SELECT * FROM events WHERE event_id = ?" + rows = [] + for ev_id in results: + c = txn.execute(sql, (ev_id,)) + rows.extend(self.cursor_to_dict(c)) + + return self._parse_events_txn(txn, rows) + + def get_auth_chain_ids(self, event_id): + return self.runInteraction( + "get_auth_chain_ids", + self._get_auth_chain_ids_txn, + event_id + ) + + def _get_auth_chain_ids_txn(self, txn, event_id): results = set() base_sql = ( @@ -48,13 +66,7 @@ class EventFederationStore(SQLBaseStore): front = [r[0] for r in txn.fetchall()] results.update(front) - sql = "SELECT * FROM events WHERE event_id = ?" - rows = [] - for ev_id in results: - c = txn.execute(sql, (ev_id,)) - rows.extend(self.cursor_to_dict(c)) - - return self._parse_events_txn(txn, rows) + return list(results) def get_oldest_events_in_room(self, room_id): return self.runInteraction( |