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

Commit

Permalink
Rename _get_e2e_device_keys_txn
Browse files Browse the repository at this point in the history
... to `_get_e2e_device_keys_and_signatures_txn`, to better reflect what it
does.
  • Loading branch information
richvdh committed Sep 1, 2020
1 parent aa07c37 commit ba5e36c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/8223.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

0 comments on commit ba5e36c

Please sign in to comment.