Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/filter.py
# Copyright (C) 2019 The Software Heritage developers | # Copyright (C) 2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from typing import Dict, Iterable, Set | from typing import Dict, Iterable, Optional, Set | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
Content, | Content, | ||||
SkippedContent, | SkippedContent, | ||||
Directory, | Directory, | ||||
Revision, | Revision, | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | def _filter_missing_ids(self, object_type: str, ids: Iterable[bytes]) -> Set[bytes]: | ||||
fn_by_object_type = { | fn_by_object_type = { | ||||
"revision": self.storage.revision_missing, | "revision": self.storage.revision_missing, | ||||
"directory": self.storage.directory_missing, | "directory": self.storage.directory_missing, | ||||
} | } | ||||
fn = fn_by_object_type[object_type] | fn = fn_by_object_type[object_type] | ||||
return set(fn(missing_ids)) | return set(fn(missing_ids)) | ||||
def flush(self, object_types: Optional[Iterable[str]] = None) -> Dict: | |||||
return self.storage.flush(object_types) |