Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/__init__.py
Show First 20 Lines • Show All 619 Lines • ▼ Show 20 Lines | class IndexerStorage: | ||||
@db_transaction_generator() | @db_transaction_generator() | ||||
def revision_intrinsic_metadata_get(self, ids, db=None, cur=None): | def revision_intrinsic_metadata_get(self, ids, db=None, cur=None): | ||||
"""Retrieve revision metadata per id. | """Retrieve revision metadata per id. | ||||
Args: | Args: | ||||
ids (iterable): sha1 checksums | ids (iterable): sha1 checksums | ||||
Yields: | Yields: | ||||
dictionaries with the following keys: | : dictionaries with the following keys: | ||||
- **id** (bytes) | - **id** (bytes) | ||||
- **metadata** (str): associated metadata | - **metadata** (str): associated metadata | ||||
- **tool** (dict): tool used to compute metadata | - **tool** (dict): tool used to compute metadata | ||||
- **mappings** (List[str]): list of mappings used to translate | - **mappings** (List[str]): list of mappings used to translate | ||||
these metadata | these metadata | ||||
""" | """ | ||||
Show All 33 Lines | class IndexerStorage: | ||||
@remote_api_endpoint('revision_intrinsic_metadata/delete') | @remote_api_endpoint('revision_intrinsic_metadata/delete') | ||||
@db_transaction() | @db_transaction() | ||||
def revision_intrinsic_metadata_delete(self, entries, db=None, cur=None): | def revision_intrinsic_metadata_delete(self, entries, db=None, cur=None): | ||||
"""Remove revision metadata from the storage. | """Remove revision metadata from the storage. | ||||
Args: | Args: | ||||
entries (dict): dictionaries with the following keys: | entries (dict): dictionaries with the following keys: | ||||
- **id** (bytes): revision identifier | - **id** (bytes): revision identifier | ||||
- **indexer_configuration_id** (int): tool used to compute | - **indexer_configuration_id** (int): tool used to compute | ||||
metadata | metadata | ||||
""" | """ | ||||
db.revision_intrinsic_metadata_delete(entries, cur) | db.revision_intrinsic_metadata_delete(entries, cur) | ||||
@remote_api_endpoint('origin_intrinsic_metadata') | @remote_api_endpoint('origin_intrinsic_metadata') | ||||
@db_transaction_generator() | @db_transaction_generator() | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | class IndexerStorage: | ||||
@remote_api_endpoint('origin_intrinsic_metadata/delete') | @remote_api_endpoint('origin_intrinsic_metadata/delete') | ||||
@db_transaction() | @db_transaction() | ||||
def origin_intrinsic_metadata_delete( | def origin_intrinsic_metadata_delete( | ||||
self, entries, db=None, cur=None): | self, entries, db=None, cur=None): | ||||
"""Remove origin metadata from the storage. | """Remove origin metadata from the storage. | ||||
Args: | Args: | ||||
entries (dict): dictionaries with the following keys: | entries (dict): dictionaries with the following keys: | ||||
- **id** (str): origin urls | - **id** (str): origin urls | ||||
- **indexer_configuration_id** (int): tool used to compute | - **indexer_configuration_id** (int): tool used to compute | ||||
metadata | metadata | ||||
""" | """ | ||||
db.origin_intrinsic_metadata_delete(entries, cur) | db.origin_intrinsic_metadata_delete(entries, cur) | ||||
@remote_api_endpoint('origin_intrinsic_metadata/search/fulltext') | @remote_api_endpoint('origin_intrinsic_metadata/search/fulltext') | ||||
@db_transaction_generator() | @db_transaction_generator() | ||||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |