Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | def content_missing_by_sha1_git(self, ids: List[bytes]) -> List[bytes]: | ||||
for id_ in ids: | for id_ in ids: | ||||
if id_ not in self._content_indexes["sha1_git"]: | if id_ not in self._content_indexes["sha1_git"]: | ||||
missing.append(id_) | missing.append(id_) | ||||
return missing | return missing | ||||
def content_index_add_one(self, algo: str, content: Content, token: int) -> None: | def content_index_add_one(self, algo: str, content: Content, token: int) -> None: | ||||
self._content_indexes[algo][content.get_hash(algo)].add(token) | self._content_indexes[algo][content.get_hash(algo)].add(token) | ||||
def content_get_tokens_from_single_hash( | def content_get_tokens_from_single_algo( | ||||
self, algo: str, hash_: bytes | self, algo: str, hashes: List[bytes] | ||||
) -> Iterable[int]: | ) -> Iterable[int]: | ||||
return self._content_indexes[algo][hash_] | for hash_ in hashes: | ||||
yield from self._content_indexes[algo][hash_] | |||||
########################## | ########################## | ||||
# 'skipped_content' table | # 'skipped_content' table | ||||
########################## | ########################## | ||||
def _skipped_content_add_finalize(self, content: SkippedContentRow) -> None: | def _skipped_content_add_finalize(self, content: SkippedContentRow) -> None: | ||||
self._skipped_contents.insert(content) | self._skipped_contents.insert(content) | ||||
self.increment_counter("skipped_content", 1) | self.increment_counter("skipped_content", 1) | ||||
▲ Show 20 Lines • Show All 488 Lines • Show Last 20 Lines |