Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/interface.py
Show All 9 Lines | |||||
from swh.core.api import remote_api_endpoint | from swh.core.api import remote_api_endpoint | ||||
from swh.core.api.classes import PagedResult as CorePagedResult | from swh.core.api.classes import PagedResult as CorePagedResult | ||||
from swh.indexer.storage.model import ( | from swh.indexer.storage.model import ( | ||||
ContentCtagsRow, | ContentCtagsRow, | ||||
ContentLanguageRow, | ContentLanguageRow, | ||||
ContentLicenseRow, | ContentLicenseRow, | ||||
ContentMetadataRow, | ContentMetadataRow, | ||||
ContentMimetypeRow, | ContentMimetypeRow, | ||||
DirectoryIntrinsicMetadataRow, | |||||
OriginIntrinsicMetadataRow, | OriginIntrinsicMetadataRow, | ||||
RevisionIntrinsicMetadataRow, | |||||
) | ) | ||||
TResult = TypeVar("TResult") | TResult = TypeVar("TResult") | ||||
PagedResult = CorePagedResult[TResult, str] | PagedResult = CorePagedResult[TResult, str] | ||||
Sha1 = bytes | Sha1 = bytes | ||||
▲ Show 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | ) -> Dict[str, int]: | ||||
- **metadata**: arbitrary dict | - **metadata**: arbitrary dict | ||||
Returns: | Returns: | ||||
Dict summary of number of rows added | Dict summary of number of rows added | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("revision_intrinsic_metadata/missing") | @remote_api_endpoint("directory_intrinsic_metadata/missing") | ||||
def revision_intrinsic_metadata_missing( | def directory_intrinsic_metadata_missing( | ||||
self, metadata: Iterable[Dict] | self, metadata: Iterable[Dict] | ||||
) -> List[Tuple[Sha1, int]]: | ) -> List[Tuple[Sha1, int]]: | ||||
"""List metadata missing from storage. | """List metadata missing from storage. | ||||
Args: | Args: | ||||
metadata (iterable): dictionaries with keys: | metadata (iterable): dictionaries with keys: | ||||
- **id** (bytes): sha1_git revision identifier | - **id** (bytes): sha1_git directory identifier | ||||
- **indexer_configuration_id** (int): tool used to compute | - **indexer_configuration_id** (int): tool used to compute | ||||
the results | the results | ||||
Returns: | Returns: | ||||
missing ids | missing ids | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("revision_intrinsic_metadata") | @remote_api_endpoint("directory_intrinsic_metadata") | ||||
def revision_intrinsic_metadata_get( | def directory_intrinsic_metadata_get( | ||||
self, ids: Iterable[Sha1] | self, ids: Iterable[Sha1] | ||||
) -> List[RevisionIntrinsicMetadataRow]: | ) -> List[DirectoryIntrinsicMetadataRow]: | ||||
"""Retrieve revision metadata per id. | """Retrieve directory metadata per id. | ||||
Args: | Args: | ||||
ids (iterable): sha1 checksums | ids (iterable): sha1 checksums | ||||
Returns: | Returns: | ||||
ContentMetadataRow objects | ContentMetadataRow objects | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("revision_intrinsic_metadata/add") | @remote_api_endpoint("directory_intrinsic_metadata/add") | ||||
def revision_intrinsic_metadata_add( | def directory_intrinsic_metadata_add( | ||||
self, | self, | ||||
metadata: List[RevisionIntrinsicMetadataRow], | metadata: List[DirectoryIntrinsicMetadataRow], | ||||
) -> Dict[str, int]: | ) -> Dict[str, int]: | ||||
"""Add metadata not present in storage. | """Add metadata not present in storage. | ||||
Args: | Args: | ||||
metadata: ContentMetadataRow objects | metadata: ContentMetadataRow objects | ||||
Returns: | Returns: | ||||
Dict summary of number of rows added | Dict summary of number of rows added | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |