Use better decorator names.

This commit is contained in:
Jorik Schellekens 2019-07-17 13:56:29 +01:00
parent cffba280de
commit d395650bcf
11 changed files with 38 additions and 38 deletions

View file

@ -508,7 +508,7 @@ class FederationServer(FederationBase):
def on_query_user_devices(self, origin, user_id):
return self.on_query_request("user_devices", user_id)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
@log_function
def on_claim_client_keys(self, origin, content):

View file

@ -46,7 +46,7 @@ class DeviceWorkerHandler(BaseHandler):
self.state = hs.get_state_handler()
self._auth_handler = hs.get_auth_handler()
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_devices_by_user(self, user_id):
"""
@ -70,7 +70,7 @@ class DeviceWorkerHandler(BaseHandler):
opentracing.log_kv(device_map)
return devices
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_device(self, user_id, device_id):
""" Retrieve the given device
@ -97,7 +97,7 @@ class DeviceWorkerHandler(BaseHandler):
return device
@measure_func("device.get_user_ids_changed")
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_user_ids_changed(self, user_id, from_token):
"""Get list of users that have had the devices updated, or have newly
@ -287,7 +287,7 @@ class DeviceHandler(DeviceWorkerHandler):
raise errors.StoreError(500, "Couldn't generate a device ID.")
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def delete_device(self, user_id, device_id):
""" Delete the given device
@ -321,7 +321,7 @@ class DeviceHandler(DeviceWorkerHandler):
yield self.notify_device_update(user_id, [device_id])
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def delete_all_devices_for_user(self, user_id, except_device_id=None):
"""Delete all of the user's devices
@ -399,7 +399,7 @@ class DeviceHandler(DeviceWorkerHandler):
else:
raise
@opentracing.trace_defered_function
@opentracing.trace_deferred
@measure_func("notify_device_update")
@defer.inlineCallbacks
def notify_device_update(self, user_id, device_ids):
@ -485,7 +485,7 @@ class DeviceListEduUpdater(object):
iterable=True,
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def incoming_device_list_update(self, origin, edu_content):
"""Called on incoming device list update from federation. Responsible

View file

@ -46,7 +46,7 @@ class E2eKeysHandler(object):
"client_keys", self.on_federation_query_client_keys
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def query_devices(self, query_body, timeout):
""" Handle a device key query from a client
@ -125,7 +125,7 @@ class E2eKeysHandler(object):
r[user_id] = remote_queries[user_id]
# Now fetch any devices that we don't have in our cache
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def do_remote_query(destination):
destination_query = remote_queries_not_in_cache[destination]
@ -158,7 +158,7 @@ class E2eKeysHandler(object):
return {"device_keys": results, "failures": failures}
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def query_local_devices(self, query):
"""Get E2E device keys for local users
@ -222,7 +222,7 @@ class E2eKeysHandler(object):
res = yield self.query_local_devices(device_keys_query)
return {"device_keys": res}
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def claim_one_time_keys(self, query, timeout):
local_query = []
@ -251,7 +251,7 @@ class E2eKeysHandler(object):
key_id: json.loads(json_bytes)
}
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def claim_client_keys(destination):
opentracing.set_tag("destination", destination)

View file

@ -50,7 +50,7 @@ class E2eRoomKeysHandler(object):
# changed.
self._upload_linearizer = Linearizer("upload_room_keys_lock")
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_room_keys(self, user_id, version, room_id=None, session_id=None):
"""Bulk get the E2E room keys for a given backup, optionally filtered to a given
@ -89,7 +89,7 @@ class E2eRoomKeysHandler(object):
opentracing.log_kv(results)
return results
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def delete_room_keys(self, user_id, version, room_id=None, session_id=None):
"""Bulk delete the E2E room keys for a given backup, optionally filtered to a given
@ -111,7 +111,7 @@ class E2eRoomKeysHandler(object):
with (yield self._upload_linearizer.queue(user_id)):
yield self.store.delete_e2e_room_keys(user_id, version, room_id, session_id)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def upload_room_keys(self, user_id, version, room_keys):
"""Bulk upload a list of room keys into a given backup version, asserting
@ -257,7 +257,7 @@ class E2eRoomKeysHandler(object):
return False
return True
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def create_version(self, user_id, version_info):
"""Create a new backup version. This automatically becomes the new
@ -316,7 +316,7 @@ class E2eRoomKeysHandler(object):
raise
return res
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def delete_version(self, user_id, version=None):
"""Deletes a given version of the user's e2e_room_keys backup
@ -337,7 +337,7 @@ class E2eRoomKeysHandler(object):
else:
raise
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def update_version(self, user_id, version, version_info):
"""Update the info about a given version of the user's backup

View file

@ -69,7 +69,7 @@ class KeyUploadServlet(RestServlet):
self.auth = hs.get_auth()
self.e2e_keys_handler = hs.get_e2e_keys_handler()
@opentracing.trace_defered_function_using_operation_name("upload_keys")
@opentracing.trace_deferred_using_operation_name("upload_keys")
@defer.inlineCallbacks
def on_POST(self, request, device_id):
requester = yield self.auth.get_user_by_req(request, allow_guest=True)
@ -183,7 +183,7 @@ class KeyChangesServlet(RestServlet):
self.auth = hs.get_auth()
self.device_handler = hs.get_device_handler()
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def on_GET(self, request):
requester = yield self.auth.get_user_by_req(request, allow_guest=True)

View file

@ -312,7 +312,7 @@ class RoomKeysVersionServlet(RestServlet):
self.auth = hs.get_auth()
self.e2e_room_keys_handler = hs.get_e2e_room_keys_handler()
@opentracing.trace_defered_function_using_operation_name("get_room_keys_version")
@opentracing.trace_deferred_using_operation_name("get_room_keys_version")
@defer.inlineCallbacks
def on_GET(self, request, version):
"""

View file

@ -43,7 +43,7 @@ class SendToDeviceRestServlet(servlet.RestServlet):
self.txns = HttpTransactionCache(hs)
self.device_message_handler = hs.get_device_message_handler()
@opentracing.trace_defered_function_using_operation_name("sendToDevice")
@opentracing.trace_deferred_using_operation_name("sendToDevice")
def on_PUT(self, request, message_type, txn_id):
opentracing.set_tag("message_type", message_type)
opentracing.set_tag("txn_id", txn_id)

View file

@ -73,7 +73,7 @@ class DeviceInboxWorkerStore(SQLBaseStore):
"get_new_messages_for_device", get_new_messages_for_device_txn
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def delete_messages_for_device(self, user_id, device_id, up_to_stream_id):
"""
@ -127,7 +127,7 @@ class DeviceInboxWorkerStore(SQLBaseStore):
return count
@opentracing.trace_function
@opentracing.trace
def get_new_device_msgs_for_remote(
self, destination, last_stream_id, current_stream_id, limit
):
@ -159,7 +159,7 @@ class DeviceInboxWorkerStore(SQLBaseStore):
# This can happen if we run out of room for EDUs in the transaction.
return defer.succeed(([], last_stream_id))
@opentracing.trace_function
@opentracing.trace
def get_new_messages_for_remote_destination_txn(txn):
sql = (
"SELECT stream_id, messages_json FROM device_federation_outbox"
@ -185,7 +185,7 @@ class DeviceInboxWorkerStore(SQLBaseStore):
get_new_messages_for_remote_destination_txn,
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
def delete_device_msgs_for_remote(self, destination, up_to_stream_id):
"""Used to delete messages when the remote destination acknowledges
their receipt.
@ -236,7 +236,7 @@ class DeviceInboxStore(DeviceInboxWorkerStore, BackgroundUpdateStore):
expiry_ms=30 * 60 * 1000,
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def add_messages_to_device_inbox(
self, local_messages_by_user_then_device, remote_messages_by_destination

View file

@ -74,7 +74,7 @@ class DeviceWorkerStore(SQLBaseStore):
return {d["device_id"]: d for d in devices}
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_devices_by_remote(self, destination, from_stream_id, limit):
"""Get stream of updates to send to remote servers
@ -306,7 +306,7 @@ class DeviceWorkerStore(SQLBaseStore):
def get_device_stream_token(self):
return self._device_list_id_gen.get_current_token()
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_user_devices_from_cache(self, query_list):
"""Get the devices (and keys if any) for remote users from the cache.

View file

@ -104,7 +104,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
}
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_e2e_room_keys(self, user_id, version, room_id=None, session_id=None):
"""Bulk get the E2E room keys for a given backup, optionally filtered to a given
@ -163,7 +163,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
return sessions
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def delete_e2e_room_keys(self, user_id, version, room_id=None, session_id=None):
"""Bulk delete the E2E room keys for a given backup, optionally filtered to a given
@ -247,7 +247,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"get_e2e_room_keys_version_info", _get_e2e_room_keys_version_info_txn
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
def create_e2e_room_keys_version(self, user_id, info):
"""Atomically creates a new version of this user's e2e_room_keys store
with the given version info.
@ -288,7 +288,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"create_e2e_room_keys_version_txn", _create_e2e_room_keys_version_txn
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
def update_e2e_room_keys_version(self, user_id, version, info):
"""Update a given backup version
@ -305,7 +305,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
desc="update_e2e_room_keys_version",
)
@opentracing.trace_defered_function
@opentracing.trace_deferred
def delete_e2e_room_keys_version(self, user_id, version=None):
"""Delete a given backup version of the user's room keys.
Doesn't delete their actual key data.

View file

@ -25,7 +25,7 @@ from ._base import SQLBaseStore, db_to_json
class EndToEndKeyWorkerStore(SQLBaseStore):
@opentracing.trace_defered_function
@opentracing.trace_deferred
@defer.inlineCallbacks
def get_e2e_device_keys(
self, query_list, include_all_devices=False, include_deleted_devices=False
@ -60,7 +60,7 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
return results
@opentracing.trace_function
@opentracing.trace
def _get_e2e_device_keys_txn(
self, txn, query_list, include_all_devices=False, include_deleted_devices=False
):
@ -251,7 +251,7 @@ class EndToEndKeyStore(EndToEndKeyWorkerStore, SQLBaseStore):
def claim_e2e_one_time_keys(self, query_list):
"""Take a list of one time keys out of the database"""
@opentracing.trace_function
@opentracing.trace
def _claim_e2e_one_time_keys(txn):
sql = (
"SELECT key_id, key_json FROM e2e_one_time_keys_json"