Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | def content_add_metadata(self, content: List[Content]) -> Dict: | ||||
Summary dict with the following key and associated values: | Summary dict with the following key and associated values: | ||||
content:add: New contents added | content:add: New contents added | ||||
skipped_content:add: New skipped contents (no data) added | skipped_content:add: New skipped contents (no data) added | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content/data") | @remote_api_endpoint("content/data") | ||||
def content_get(self, content): | def content_get( | ||||
self, contents: List[bytes] | |||||
) -> Iterable[Optional[Dict[str, bytes]]]: | |||||
"""Retrieve in bulk contents and their data. | """Retrieve in bulk contents and their data. | ||||
This generator yields exactly as many items than provided sha1 | This generator yields exactly as many items than provided sha1 | ||||
identifiers, but callers should not assume this will always be true. | identifiers, but callers should not assume this will always be true. | ||||
It may also yield `None` values in case an object was not found. | It may also yield `None` values in case an object was not found. | ||||
TODO: | |||||
ardumont: sneaky devil! | |||||
Rename to content_get_data | |||||
Args: | Args: | ||||
content: iterables of sha1 | contents: iterables of sha1 | ||||
Raises: | |||||
StorageArgumentException in case of too much contents are required. | |||||
(cf. BULK_BLOCK_CONTENT_LEN_MAX) | |||||
Yields: | Yields: | ||||
Dict[str, bytes]: Generates streams of contents as dict with their | Streams of contents as dict with their raw data: | ||||
Not Done Inline Actionss/Streams of// vlorentz: s/Streams of// | |||||
raw data: | |||||
- sha1 (bytes): content id | - sha1 (bytes): content id | ||||
- data (bytes): content's raw data | - data (bytes): content's raw data | ||||
Raises: | |||||
ValueError in case of too much contents are required. | |||||
cf. BULK_BLOCK_CONTENT_LEN_MAX | |||||
""" | """ | ||||
... | ... | ||||
@deprecated | @deprecated | ||||
@remote_api_endpoint("content/range") | @remote_api_endpoint("content/range") | ||||
def content_get_range(self, start, end, limit=1000): | def content_get_range(self, start, end, limit=1000): | ||||
"""Retrieve contents within range [start, end] bound by limit. | """Retrieve contents within range [start, end] bound by limit. | ||||
▲ Show 20 Lines • Show All 1,115 Lines • Show Last 20 Lines |
sneaky devil!