Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/indexer.py
Show First 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | ) -> Dict: | ||||
self.log.exception("Problem when reading contents metadata.") | self.log.exception("Problem when reading contents metadata.") | ||||
status = "failed" | status = "failed" | ||||
finally: | finally: | ||||
summary["status"] = status | summary["status"] = status | ||||
return summary | return summary | ||||
class ContentPartitionIndexer(BaseIndexer): | class ContentPartitionIndexer(BaseIndexer): | ||||
"""A content range indexer. | """A content partition indexer. | ||||
This expects as input a partition_id and a nb_partitions. This will then index the | This expects as input a partition_id and a nb_partitions. This will then index the | ||||
contents within that partition. | contents within that partition. | ||||
To work on a list of ids, use the :class:`ContentIndexer` instead. | To work on a list of ids, use the :class:`ContentIndexer` instead. | ||||
Note: :class:`ContentPartitionIndexer` is not an instantiable | Note: :class:`ContentPartitionIndexer` is not an instantiable | ||||
object. To use it, one should inherit from this class and override | object. To use it, one should inherit from this class and override | ||||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | ) -> Dict: | ||||
status = "failed" | status = "failed" | ||||
finally: | finally: | ||||
summary["status"] = status | summary["status"] = status | ||||
if count > 0 and count_object_added_key: | if count > 0 and count_object_added_key: | ||||
summary[count_object_added_key] = count | summary[count_object_added_key] = count | ||||
return summary | return summary | ||||
# alias for retrocompatibility | |||||
ContentRangeIndexer = ContentPartitionIndexer | |||||
class OriginIndexer(BaseIndexer): | class OriginIndexer(BaseIndexer): | ||||
"""An object type indexer, inherits from the :class:`BaseIndexer` and | """An object type indexer, inherits from the :class:`BaseIndexer` and | ||||
implements Origin indexing using the run method | implements Origin indexing using the run method | ||||
Note: the :class:`OriginIndexer` is not an instantiable object. | Note: the :class:`OriginIndexer` is not an instantiable object. | ||||
To use it in another context one should inherit from this class | To use it in another context one should inherit from this class | ||||
and override the methods mentioned in the :class:`BaseIndexer` | and override the methods mentioned in the :class:`BaseIndexer` | ||||
class. | class. | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |