Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/replay.py
Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | elif object_type in ('directory', 'revision', 'release', | ||||
# 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) | ||||
elif object_type == 'origin_visit': | elif object_type == 'origin_visit': | ||||
for visit in objects: | for visit in objects: | ||||
if 'type' in visit['origin']: | if 'type' in visit['origin']: | ||||
storage.origin_add_one(visit['origin']) | storage.origin_add_one(visit['origin']) | ||||
if 'metadata' not in visit: | |||||
visit['metadata'] = None | |||||
storage.origin_visit_upsert(objects) | storage.origin_visit_upsert(objects) | ||||
else: | else: | ||||
logger.warning('Received a series of %s, this should not happen', | logger.warning('Received a series of %s, this should not happen', | ||||
object_type) | object_type) | ||||
def is_hash_in_bytearray(hash_, array, nb_hashes, hash_size=SHA1_SIZE): | def is_hash_in_bytearray(hash_, array, nb_hashes, hash_size=SHA1_SIZE): | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |