Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/writer/kafka.py
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | def _get_key(self, object_type, object_): | ||||
elif object_type == 'content': | elif object_type == 'content': | ||||
return object_['sha1'] # TODO: use a dict of hashes | return object_['sha1'] # TODO: use a dict of hashes | ||||
elif object_type == 'skipped_content': | elif object_type == 'skipped_content': | ||||
return { | return { | ||||
hash: object_[hash] | hash: object_[hash] | ||||
for hash in DEFAULT_ALGORITHMS | for hash in DEFAULT_ALGORITHMS | ||||
} | } | ||||
elif object_type == 'origin': | elif object_type == 'origin': | ||||
return {'url': object_['url'], 'type': object_['type']} | return {'url': object_['url']} | ||||
elif object_type == 'origin_visit': | elif object_type == 'origin_visit': | ||||
return { | return { | ||||
'origin': object_['origin'], | 'origin': object_['origin'], | ||||
'date': str(object_['date']), | 'date': str(object_['date']), | ||||
} | } | ||||
else: | else: | ||||
raise ValueError('Unknown object type: %s.' % object_type) | raise ValueError('Unknown object type: %s.' % object_type) | ||||
Show All 32 Lines |