Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/storage.py
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | class CassandraStorage: | ||||
) -> None: | ) -> None: | ||||
raise NotImplementedError( | raise NotImplementedError( | ||||
"content_update is not supported by the Cassandra backend" | "content_update is not supported by the Cassandra backend" | ||||
) | ) | ||||
def content_add_metadata(self, content: List[Content]) -> Dict: | def content_add_metadata(self, content: List[Content]) -> Dict: | ||||
return self._content_add(content, with_data=False) | return self._content_add(content, with_data=False) | ||||
def content_get(self, content): | def content_get( | ||||
if len(content) > BULK_BLOCK_CONTENT_LEN_MAX: | self, contents: List[bytes] | ||||
) -> Iterable[Optional[Dict[str, bytes]]]: | |||||
# FIXME: Make this method support slicing the `data`. | |||||
if len(contents) > BULK_BLOCK_CONTENT_LEN_MAX: | |||||
raise StorageArgumentException( | raise StorageArgumentException( | ||||
"Sending at most %s contents." % BULK_BLOCK_CONTENT_LEN_MAX | f"Send at maximum {BULK_BLOCK_CONTENT_LEN_MAX} contents." | ||||
) | ) | ||||
yield from self.objstorage.content_get(content) | 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: str = None, | ||||
): | ): | ||||
▲ Show 20 Lines • Show All 1,046 Lines • Show Last 20 Lines |