Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/indexer.py
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | def register_tools(self, tools): | ||||
else: | else: | ||||
raise ValueError('Configuration tool(s) must be a dict or list!') | raise ValueError('Configuration tool(s) must be a dict or list!') | ||||
if tools: | if tools: | ||||
return self.idx_storage.indexer_configuration_add(tools) | return self.idx_storage.indexer_configuration_add(tools) | ||||
else: | else: | ||||
return [] | return [] | ||||
@abc.abstractmethod | |||||
def index(self, id, data): | def index(self, id, data): | ||||
"""Index computation for the id and associated raw data. | """Index computation for the id and associated raw data. | ||||
Args: | Args: | ||||
id (bytes): identifier | id (bytes): identifier | ||||
data (bytes): id's data from storage or objstorage depending on | data (bytes): id's data from storage or objstorage depending on | ||||
object type | object type | ||||
Returns: | Returns: | ||||
dict: a dict that makes sense for the | dict: a dict that makes sense for the | ||||
:meth:`.persist_index_computations` method. | :meth:`.persist_index_computations` method. | ||||
""" | """ | ||||
pass | raise NotImplementedError() | ||||
def filter(self, ids): | def filter(self, ids): | ||||
"""Filter missing ids for that particular indexer. | """Filter missing ids for that particular indexer. | ||||
Args: | Args: | ||||
ids ([bytes]): list of ids | ids ([bytes]): list of ids | ||||
Yields: | Yields: | ||||
▲ Show 20 Lines • Show All 405 Lines • Show Last 20 Lines |