Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/replay.py
Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | |||||
def _insert_objects(object_type, objects, storage): | def _insert_objects(object_type, objects, storage): | ||||
objects = fix_objects(object_type, objects) | objects = fix_objects(object_type, objects) | ||||
if object_type == 'content': | if object_type == 'content': | ||||
# TODO: insert 'content' in batches | # TODO: insert 'content' in batches | ||||
for object_ in objects: | for object_ in objects: | ||||
try: | try: | ||||
if object_.get('status') == 'absent': | |||||
storage.skipped_content_add([object_]) | |||||
else: | |||||
storage.content_add_metadata([object_]) | storage.content_add_metadata([object_]) | ||||
except HashCollision as e: | except HashCollision as e: | ||||
logger.error('Hash collision: %s', e.args) | logger.error('Hash collision: %s', e.args) | ||||
elif object_type in ('directory', 'revision', 'release', | elif object_type in ('directory', 'revision', 'release', | ||||
'snapshot', 'origin'): | 'snapshot', 'origin'): | ||||
# TODO: split batches that are too large for the storage | # TODO: split batches that are too large for the storage | ||||
# to handle? | # to handle? | ||||
method = getattr(storage, object_type + '_add') | method = getattr(storage, object_type + '_add') | ||||
method(objects) | method(objects) | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |