Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | ) -> Iterable[Optional[Dict[str, bytes]]]: | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content/partition") | @remote_api_endpoint("content/partition") | ||||
def content_get_partition( | def content_get_partition( | ||||
self, | self, | ||||
partition_id: int, | partition_id: int, | ||||
nb_partitions: int, | nb_partitions: int, | ||||
limit: int = 1000, | |||||
page_token: Optional[str] = None, | page_token: Optional[str] = None, | ||||
) -> Dict[str, Any]: | limit: int = 1000, | ||||
) -> PagedResult[Content]: | |||||
"""Splits contents into nb_partitions, and returns one of these based on | """Splits contents into nb_partitions, and returns one of these based on | ||||
partition_id (which must be in [0, nb_partitions-1]) | partition_id (which must be in [0, nb_partitions-1]) | ||||
There is no guarantee on how the partitioning is done, or the | There is no guarantee on how the partitioning is done, or the | ||||
result order. | result order. | ||||
Args: | Args: | ||||
partition_id (int): index of the partition to fetch | partition_id: index of the partition to fetch | ||||
nb_partitions (int): total number of partitions to split into | nb_partitions: total number of partitions to split into | ||||
limit (int): Limit result (default to 1000) | page_token: opaque token used for pagination. | ||||
page_token (Optional[str]): opaque token used for pagination. | limit: Limit result (default to 1000) | ||||
anlambert: We usually add a line break after `Returns:` in our docstrings. | |||||
Done Inline Actionsoh yeah, my editor, when M-q (to format) removes it and i forgot to fix it. ardumont: oh yeah, my editor, when `M-q` (to format) removes it and i forgot to fix it.
thanks. | |||||
Returns: | Returns: | ||||
a dict with keys: | PagedResult of Content model objects within the partition. If | ||||
- contents (List[dict]): iterable of contents in the partition. | next_page_token is None, there is no longer data to retrieve. | ||||
- **next_page_token** (Optional[str]): opaque token to be used as | |||||
`page_token` for retrieving the next page. if absent, there is | |||||
no more pages to gather. | |||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("content/metadata") | @remote_api_endpoint("content/metadata") | ||||
def content_get_metadata(self, contents: List[bytes]) -> Dict[bytes, List[Dict]]: | def content_get_metadata(self, contents: List[bytes]) -> Dict[bytes, List[Dict]]: | ||||
"""Retrieve content metadata in bulk | """Retrieve content metadata in bulk | ||||
Args: | Args: | ||||
▲ Show 20 Lines • Show All 1,083 Lines • Show Last 20 Lines |
We usually add a line break after Returns: in our docstrings.