Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Rename _get_e2e_device_keys_txn #8222

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8222.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor queries for device keys and cross-signatures.
4 changes: 2 additions & 2 deletions synapse/storage/databases/main/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ async def _get_device_update_edus_by_remote(
"""
devices = (
await self.db_pool.runInteraction(
"_get_e2e_device_keys_txn",
self._get_e2e_device_keys_txn,
"get_e2e_device_keys_and_signatures_txn",
self._get_e2e_device_keys_and_signatures_txn,
query_map.keys(),
include_all_devices=True,
include_deleted_devices=True,
Expand Down
10 changes: 6 additions & 4 deletions synapse/storage/databases/main/end_to_end_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_e2e_device_keys_for_federation_query_txn(
) -> Tuple[int, List[JsonDict]]:
now_stream_id = self.get_device_stream_token()

devices = self._get_e2e_device_keys_txn(txn, [(user_id, None)])
devices = self._get_e2e_device_keys_and_signatures_txn(txn, [(user_id, None)])

if devices:
user_devices = devices[user_id]
Expand Down Expand Up @@ -96,7 +96,9 @@ async def get_e2e_device_keys_for_cs_api(
return {}

results = await self.db_pool.runInteraction(
"get_e2e_device_keys", self._get_e2e_device_keys_txn, query_list,
"get_e2e_device_keys_and_signatures_txn",
self._get_e2e_device_keys_and_signatures_txn,
query_list,
)

# Build the result structure, un-jsonify the results, and add the
Expand All @@ -120,9 +122,9 @@ async def get_e2e_device_keys_for_cs_api(
return rv

@trace
def _get_e2e_device_keys_txn(
def _get_e2e_device_keys_and_signatures_txn(
self, txn, query_list, include_all_devices=False, include_deleted_devices=False
):
) -> Dict[str, Dict[str, Optional[Dict]]]:
set_tag("include_all_devices", include_all_devices)
set_tag("include_deleted_devices", include_deleted_devices)

Expand Down