Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | def skipped_content_add_prepare(self, content: SkippedContentRow): | ||||
) | ) | ||||
def skipped_content_get_from_pk( | def skipped_content_get_from_pk( | ||||
self, content_hashes: Dict[str, bytes] | self, content_hashes: Dict[str, bytes] | ||||
) -> Optional[SkippedContentRow]: | ) -> Optional[SkippedContentRow]: | ||||
primary_key = self._skipped_contents.primary_key_from_dict(content_hashes) | primary_key = self._skipped_contents.primary_key_from_dict(content_hashes) | ||||
return self._skipped_contents.get_from_primary_key(primary_key) | return self._skipped_contents.get_from_primary_key(primary_key) | ||||
def skipped_content_get_from_token(self, token: int) -> Iterable[SkippedContentRow]: | |||||
return self._skipped_contents.get_from_token(token) | |||||
########################## | ########################## | ||||
# 'skipped_content_by_*' tables | # 'skipped_content_by_*' tables | ||||
########################## | ########################## | ||||
def skipped_content_index_add_one( | def skipped_content_index_add_one( | ||||
self, algo: str, content: SkippedContent, token: int | self, algo: str, content: SkippedContent, token: int | ||||
) -> None: | ) -> None: | ||||
self._skipped_content_indexes[algo][content.get_hash(algo)].add(token) | self._skipped_content_indexes[algo][content.get_hash(algo)].add(token) | ||||
def skipped_content_get_tokens_from_single_hash( | |||||
self, algo: str, hash_: bytes | |||||
) -> Iterable[int]: | |||||
return self._skipped_content_indexes[algo][hash_] | |||||
########################## | ########################## | ||||
# 'directory' table | # 'directory' table | ||||
########################## | ########################## | ||||
def directory_missing(self, ids: List[bytes]) -> List[bytes]: | def directory_missing(self, ids: List[bytes]) -> List[bytes]: | ||||
missing = [] | missing = [] | ||||
for id_ in ids: | for id_ in ids: | ||||
if self._directories.get_from_primary_key((id_,)) is None: | if self._directories.get_from_primary_key((id_,)) is None: | ||||
▲ Show 20 Lines • Show All 350 Lines • Show Last 20 Lines |