Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show All 23 Lines | |||||
from swh.model.identifiers import ExtendedSWHID | from swh.model.identifiers import ExtendedSWHID | ||||
from swh.model.model import Content, Sha1Git, SkippedContent | from swh.model.model import Content, Sha1Git, SkippedContent | ||||
from swh.storage.cassandra import CassandraStorage | from swh.storage.cassandra import CassandraStorage | ||||
from swh.storage.cassandra.model import ( | from swh.storage.cassandra.model import ( | ||||
BaseRow, | BaseRow, | ||||
ContentRow, | ContentRow, | ||||
DirectoryEntryRow, | DirectoryEntryRow, | ||||
DirectoryRow, | DirectoryRow, | ||||
ExtIDByTargetRow, | |||||
ExtIDRow, | ExtIDRow, | ||||
MetadataAuthorityRow, | MetadataAuthorityRow, | ||||
MetadataFetcherRow, | MetadataFetcherRow, | ||||
ObjectCountRow, | ObjectCountRow, | ||||
OriginRow, | OriginRow, | ||||
OriginVisitRow, | OriginVisitRow, | ||||
OriginVisitStatusRow, | OriginVisitStatusRow, | ||||
RawExtrinsicMetadataRow, | RawExtrinsicMetadataRow, | ||||
▲ Show 20 Lines • Show All 593 Lines • ▼ Show 20 Lines | class InMemoryCqlRunner: | ||||
def _extid_add_finalize(self, extid: ExtIDRow) -> None: | def _extid_add_finalize(self, extid: ExtIDRow) -> None: | ||||
self._extid.insert(extid) | self._extid.insert(extid) | ||||
self.increment_counter("extid", 1) | self.increment_counter("extid", 1) | ||||
def extid_add_prepare(self, extid: ExtIDRow): | def extid_add_prepare(self, extid: ExtIDRow): | ||||
finalizer = functools.partial(self._extid_add_finalize, extid) | finalizer = functools.partial(self._extid_add_finalize, extid) | ||||
return (self._extid.token(self._extid.partition_key(extid)), finalizer) | return (self._extid.token(self._extid.partition_key(extid)), finalizer) | ||||
def extid_index_add_one(self, extid: ExtIDRow, token: int) -> None: | def extid_index_add_one(self, row: ExtIDByTargetRow) -> None: | ||||
pass | pass | ||||
def extid_get_from_pk( | def extid_get_from_pk( | ||||
self, extid_type: str, extid: bytes, target: ExtendedSWHID, | self, extid_type: str, extid: bytes, target: ExtendedSWHID, | ||||
) -> Optional[ExtIDRow]: | ) -> Optional[ExtIDRow]: | ||||
primary_key = self._extid.primary_key_from_dict( | primary_key = self._extid.primary_key_from_dict( | ||||
dict( | dict( | ||||
extid_type=extid_type, | extid_type=extid_type, | ||||
Show All 37 Lines |