Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/interface.py
# Copyright (C) 2015-2020 The Software Heritage developers | # Copyright (C) 2015-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 | ||||
from typing import Dict, Iterable, List, Optional, Tuple, TypeVar, Union | from typing import Dict, Iterable, List, Optional, Tuple, TypeVar, Union | ||||
from typing_extensions import Protocol, runtime_checkable | |||||
from swh.core.api import remote_api_endpoint | from swh.core.api import remote_api_endpoint | ||||
from swh.core.api.classes import PagedResult as CorePagedResult | from swh.core.api.classes import PagedResult as CorePagedResult | ||||
from swh.indexer.storage.model import ( | from swh.indexer.storage.model import ( | ||||
ContentCtagsRow, | ContentCtagsRow, | ||||
ContentLanguageRow, | ContentLanguageRow, | ||||
ContentLicenseRow, | ContentLicenseRow, | ||||
ContentMetadataRow, | ContentMetadataRow, | ||||
ContentMimetypeRow, | ContentMimetypeRow, | ||||
OriginIntrinsicMetadataRow, | OriginIntrinsicMetadataRow, | ||||
RevisionIntrinsicMetadataRow, | RevisionIntrinsicMetadataRow, | ||||
) | ) | ||||
TResult = TypeVar("TResult") | TResult = TypeVar("TResult") | ||||
PagedResult = CorePagedResult[TResult, str] | PagedResult = CorePagedResult[TResult, str] | ||||
Sha1 = bytes | Sha1 = bytes | ||||
class IndexerStorageInterface: | @runtime_checkable | ||||
class IndexerStorageInterface(Protocol): | |||||
@remote_api_endpoint("check_config") | @remote_api_endpoint("check_config") | ||||
def check_config(self, *, check_write): | def check_config(self, *, check_write): | ||||
"""Check that the storage is configured and ready to go.""" | """Check that the storage is configured and ready to go.""" | ||||
... | ... | ||||
@remote_api_endpoint("content_mimetype/missing") | @remote_api_endpoint("content_mimetype/missing") | ||||
def content_mimetype_missing( | def content_mimetype_missing( | ||||
self, mimetypes: Iterable[Dict] | self, mimetypes: Iterable[Dict] | ||||
▲ Show 20 Lines • Show All 534 Lines • Show Last 20 Lines |