Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/validate.py
# Copyright (C) 2020 The Software Heritage developers | # Copyright (C) 2020 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 | ||||
import datetime | import datetime | ||||
import contextlib | import contextlib | ||||
from typing import Dict, Iterable, List, Optional | from typing import Dict, Iterable, Optional, List | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
BaseModel, | BaseModel, | ||||
SkippedContent, | SkippedContent, | ||||
Content, | Content, | ||||
Directory, | Directory, | ||||
Revision, | Revision, | ||||
Release, | Release, | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | class ValidatingProxyStorage: | ||||
def origin_add_one(self, origin: Dict) -> int: | def origin_add_one(self, origin: Dict) -> int: | ||||
with convert_validation_exceptions(): | with convert_validation_exceptions(): | ||||
origin = Origin.from_dict(origin) | origin = Origin.from_dict(origin) | ||||
return self.storage.origin_add_one(origin) | return self.storage.origin_add_one(origin) | ||||
def clear_buffers(self, object_types: Optional[Iterable[str]] = None) -> None: | def clear_buffers(self, object_types: Optional[Iterable[str]] = None) -> None: | ||||
return self.storage.clear_buffers(object_types) | return self.storage.clear_buffers(object_types) | ||||
def flush(self, object_types: Optional[Iterable[str]] = None) -> Dict: | |||||
return self.storage.flush(object_types) |