Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 1,077 Lines • ▼ Show 20 Lines | def stat_counters(self): | ||||
""" | """ | ||||
... | ... | ||||
def refresh_stat_counters(self): | def refresh_stat_counters(self): | ||||
"""Recomputes the statistics for `stat_counters`.""" | """Recomputes the statistics for `stat_counters`.""" | ||||
... | ... | ||||
@remote_api_endpoint("object_metadata/add") | @remote_api_endpoint("raw_extrinsic_metadata/add") | ||||
def object_metadata_add(self, metadata: Iterable[RawExtrinsicMetadata],) -> None: | def raw_extrinsic_metadata_add( | ||||
self, metadata: Iterable[RawExtrinsicMetadata], | |||||
) -> None: | |||||
"""Add extrinsic metadata on objects (contents, directories, ...). | """Add extrinsic metadata on objects (contents, directories, ...). | ||||
The authority and fetcher must be known to the storage before | The authority and fetcher must be known to the storage before | ||||
using this endpoint. | using this endpoint. | ||||
If there is already metadata for the same object, authority, | If there is already metadata for the same object, authority, | ||||
fetcher, and at the same date; the new one will be either dropped or | fetcher, and at the same date; the new one will be either dropped or | ||||
will replace the existing one | will replace the existing one | ||||
(it is unspecified which one of these two behaviors happens). | (it is unspecified which one of these two behaviors happens). | ||||
Args: | Args: | ||||
metadata: iterable of RawExtrinsicMetadata objects to be inserted. | metadata: iterable of RawExtrinsicMetadata objects to be inserted. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("object_metadata/get") | @remote_api_endpoint("raw_extrinsic_metadata/get") | ||||
def object_metadata_get( | def raw_extrinsic_metadata_get( | ||||
self, | self, | ||||
object_type: MetadataTargetType, | object_type: MetadataTargetType, | ||||
id: Union[str, SWHID], | id: Union[str, SWHID], | ||||
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, | ||||
) -> Dict[str, Union[Optional[bytes], List[RawExtrinsicMetadata]]]: | ) -> Dict[str, Union[Optional[bytes], List[RawExtrinsicMetadata]]]: | ||||
"""Retrieve list of all object_metadata entries for the id | """Retrieve list of all raw_extrinsic_metadata entries for the id | ||||
Args: | Args: | ||||
object_type: one of the values of swh.model.model.MetadataTargetType | object_type: one of the values of swh.model.model.MetadataTargetType | ||||
id: an URL if object_type is 'origin', else a core SWHID | id: an URL if object_type is 'origin', else a core SWHID | ||||
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 | ||||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |