Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/storage.py
Show All 28 Lines | from swh.model.model import ( | ||||
Origin, | Origin, | ||||
MetadataAuthority, | MetadataAuthority, | ||||
MetadataAuthorityType, | MetadataAuthorityType, | ||||
MetadataFetcher, | MetadataFetcher, | ||||
MetadataTargetType, | MetadataTargetType, | ||||
RawExtrinsicMetadata, | RawExtrinsicMetadata, | ||||
Sha1Git, | Sha1Git, | ||||
) | ) | ||||
from swh.storage.interface import ListOrder, PagedResult, VISIT_STATUSES | from swh.storage.interface import ListOrder, PagedResult, Sha1, VISIT_STATUSES | ||||
from swh.storage.objstorage import ObjStorage | from swh.storage.objstorage import ObjStorage | ||||
from swh.storage.writer import JournalWriter | from swh.storage.writer import JournalWriter | ||||
from swh.storage.utils import map_optional, now | from swh.storage.utils import map_optional, now | ||||
from ..exc import StorageArgumentException, HashCollision | from ..exc import StorageArgumentException, HashCollision | ||||
from .common import TOKEN_BEGIN, TOKEN_END | from .common import TOKEN_BEGIN, TOKEN_END | ||||
from . import converters | from . import converters | ||||
from .cql import CqlRunner | from .cql import CqlRunner | ||||
▲ Show 20 Lines • Show All 112 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( | def content_get_data(self, content: Sha1) -> Optional[bytes]: | ||||
self, contents: List[bytes] | # FIXME: Make this method support slicing the `data` | ||||
) -> Iterable[Optional[Dict[str, bytes]]]: | return self.objstorage.content_get(content) | ||||
# FIXME: Make this method support slicing the `data`. | |||||
vlorentz: keep the FIXME | |||||
if len(contents) > BULK_BLOCK_CONTENT_LEN_MAX: | |||||
raise StorageArgumentException( | |||||
f"Send at maximum {BULK_BLOCK_CONTENT_LEN_MAX} 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, | ||||
page_token: Optional[str] = None, | page_token: Optional[str] = None, | ||||
limit: int = 1000, | limit: int = 1000, | ||||
) -> PagedResult[Content]: | ) -> PagedResult[Content]: | ||||
▲ Show 20 Lines • Show All 1,091 Lines • Show Last 20 Lines |
keep the FIXME