Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/replayer/replay.py
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | def get_object(objstorage, obj_id): | ||||
except Exception as exc: | except Exception as exc: | ||||
raise ReplayError(obj_id=obj_id, exc=exc) from None | raise ReplayError(obj_id=obj_id, exc=exc) from None | ||||
@content_replay_retry | @content_replay_retry | ||||
def put_object(objstorage, obj_id, obj): | def put_object(objstorage, obj_id, obj): | ||||
try: | try: | ||||
with statsd.timed(CONTENT_DURATION_METRIC, tags={"request": "put"}): | with statsd.timed(CONTENT_DURATION_METRIC, tags={"request": "put"}): | ||||
obj = objstorage.add(obj, obj_id, check_presence=False) | objstorage.add(obj, obj_id, check_presence=False) | ||||
logger.debug("stored %(obj_id)s", {"obj_id": hash_to_hex(obj_id)}) | logger.debug("stored %(obj_id)s", {"obj_id": hash_to_hex(obj_id)}) | ||||
except Exception as exc: | except Exception as exc: | ||||
raise ReplayError(obj_id=obj_id, exc=exc) from None | raise ReplayError(obj_id=obj_id, exc=exc) from None | ||||
def copy_object(obj_id, src, dst): | def copy_object(obj_id, src, dst): | ||||
obj = get_object(src, obj_id) | obj = get_object(src, obj_id) | ||||
if obj is not None: | if obj is not None: | ||||
▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines |