Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | def content_get_metadata(self, contents: List[bytes]) -> Dict[bytes, List[Dict]]: | ||||
a dict with keys the content's sha1 and the associated value | a dict with keys the content's sha1 and the associated value | ||||
either the existing content's metadata or None if the content does | either the existing content's metadata or None if the content does | ||||
not exist. | not exist. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content/missing") | @remote_api_endpoint("content/missing") | ||||
def content_missing(self, content, key_hash="sha1"): | def content_missing( | ||||
self, contents: List[Dict[str, Any]], key_hash: str = "sha1" | |||||
) -> Iterable[bytes]: | |||||
"""List content missing from storage | """List content missing from storage | ||||
Args: | Args: | ||||
content ([dict]): iterable of dictionaries whose keys are | content: iterable of dictionaries whose keys are either 'length' or an item | ||||
either 'length' or an item of | of :data:`swh.model.hashutil.ALGORITHMS`; mapped to the | ||||
:data:`swh.model.hashutil.ALGORITHMS`; | corresponding checksum (or length). | ||||
mapped to the corresponding checksum | key_hash: name of the column to use as hash id result (default: 'sha1') | ||||
(or length). | |||||
key_hash (str): name of the column to use as hash id | |||||
result (default: 'sha1') | |||||
Returns: | |||||
iterable ([bytes]): missing content ids (as per the | |||||
key_hash column) | |||||
Raises: | Raises: | ||||
StorageArgumentException when key_hash is unknown. | |||||
TODO: an exception when we get a hash collision. | TODO: an exception when we get a hash collision. | ||||
Returns: | |||||
iterable of missing content ids (as per the `key_hash` column) | |||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content/missing/sha1") | @remote_api_endpoint("content/missing/sha1") | ||||
def content_missing_per_sha1(self, contents): | def content_missing_per_sha1(self, contents): | ||||
"""List content missing from storage based only on sha1. | """List content missing from storage based only on sha1. | ||||
Args: | Args: | ||||
▲ Show 20 Lines • Show All 1,022 Lines • Show Last 20 Lines |