Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 1,185 Lines • ▼ Show 20 Lines | |||||
def raw_extrinsic_metadata_get( | def raw_extrinsic_metadata_get( | ||||
self, | self, | ||||
target: ExtendedSWHID, | target: ExtendedSWHID, | ||||
authority: MetadataAuthority, | authority: MetadataAuthority, | ||||
after: Optional[datetime.datetime] = None, | after: Optional[datetime.datetime] = None, | ||||
page_token: Optional[bytes] = None, | page_token: Optional[bytes] = None, | ||||
limit: int = 1000, | limit: int = 1000, | ||||
) -> PagedResult[RawExtrinsicMetadata]: | ) -> PagedResult[RawExtrinsicMetadata]: | ||||
"""Retrieve list of all raw_extrinsic_metadata entries for the id | """Retrieve list of all raw_extrinsic_metadata entries targeting the id | ||||
Args: | Args: | ||||
target: the SWHID of the objects to find metadata on | target: the SWHID of the objects to find metadata on | ||||
authority: a dict containing keys `type` and `url`. | authority: a dict containing keys `type` and `url`. | ||||
after: minimum discovery_date for a result to be returned | after: minimum discovery_date for a result to be returned | ||||
page_token: opaque token, used to get the next page of results | page_token: opaque token, used to get the next page of results | ||||
limit: maximum number of results to be returned | limit: maximum number of results to be returned | ||||
Returns: | Returns: | ||||
PagedResult of RawExtrinsicMetadata | PagedResult of RawExtrinsicMetadata | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("raw_extrinsic_metadata/get_by_ids") | |||||
def raw_extrinsic_metadata_get_by_ids( | |||||
self, ids: List[Sha1Git] | |||||
) -> List[RawExtrinsicMetadata]: | |||||
"""Retrieve list of raw_extrinsic_metadata entries of the given id | |||||
(unlike raw_extrinsic_metadata_get, which returns metadata entries | |||||
**targeting** the id) | |||||
Args: | |||||
ids: list of hashes of RawExtrinsicMetadata objects | |||||
""" | |||||
... | |||||
@remote_api_endpoint("metadata_fetcher/add") | @remote_api_endpoint("metadata_fetcher/add") | ||||
def metadata_fetcher_add(self, fetchers: List[MetadataFetcher],) -> Dict[str, int]: | def metadata_fetcher_add(self, fetchers: List[MetadataFetcher],) -> Dict[str, int]: | ||||
"""Add new metadata fetchers to the storage. | """Add new metadata fetchers to the storage. | ||||
Their `name` and `version` together are unique identifiers of this | Their `name` and `version` together are unique identifiers of this | ||||
fetcher; and `metadata` is an arbitrary dict of JSONable data | fetcher; and `metadata` is an arbitrary dict of JSONable data | ||||
with information about this fetcher, which must not be `None` | with information about this fetcher, which must not be `None` | ||||
(but may be empty). | (but may be empty). | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |