Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/storage.py
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | ) -> Iterable[Optional[Dict[str, bytes]]]: | ||||
) | ) | ||||
yield from self.objstorage.content_get(contents) | yield from self.objstorage.content_get(contents) | ||||
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, | limit: int = 1000, | ||||
page_token: str = None, | page_token: Optional[str] = None, | ||||
): | ) -> Dict[str, Any]: | ||||
if limit is None: | if limit is None: | ||||
raise StorageArgumentException("limit should not be None") | raise StorageArgumentException("limit should not be None") | ||||
# Compute start and end of the range of tokens covered by the | # Compute start and end of the range of tokens covered by the | ||||
# requested partition | # requested partition | ||||
partition_size = (TOKEN_END - TOKEN_BEGIN) // nb_partitions | partition_size = (TOKEN_END - TOKEN_BEGIN) // nb_partitions | ||||
range_start = TOKEN_BEGIN + partition_id * partition_size | range_start = TOKEN_BEGIN + partition_id * partition_size | ||||
range_end = TOKEN_BEGIN + (partition_id + 1) * partition_size | range_end = TOKEN_BEGIN + (partition_id + 1) * partition_size | ||||
▲ Show 20 Lines • Show All 1,038 Lines • Show Last 20 Lines |