Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
# Copyright (C) 2015-2020 The Software Heritage developers | # Copyright (C) 2015-2021 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 | ||||
from enum import Enum | from enum import Enum | ||||
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar | from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, TypeVar | ||||
▲ Show 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | def revision_get(self, revision_ids: List[Sha1Git]) -> List[Optional[Revision]]: | ||||
Returns: | Returns: | ||||
list of revision object (if the revision exists or None otherwise) | list of revision object (if the revision exists or None otherwise) | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("extid/from_extid") | @remote_api_endpoint("extid/from_extid") | ||||
def extid_get_from_extid(self, id_type: str, ids: List[bytes]) -> List[ExtID]: | def extid_get_from_extid( | ||||
self, id_type: str, ids: List[bytes], version: Optional[int] = None | |||||
) -> List[ExtID]: | |||||
"""Get ExtID objects from external IDs | """Get ExtID objects from external IDs | ||||
Args: | Args: | ||||
id_type: type of the given external identifiers (e.g. 'mercurial') | id_type: type of the given external identifiers (e.g. 'mercurial') | ||||
ids: list of external IDs | ids: list of external IDs | ||||
version: (Optional) version to use as filter | |||||
Returns: | Returns: | ||||
list of ExtID objects | list of ExtID objects | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("extid/from_target") | @remote_api_endpoint("extid/from_target") | ||||
def extid_get_from_target( | def extid_get_from_target( | ||||
self, target_type: ObjectType, ids: List[Sha1Git] | self, | ||||
target_type: ObjectType, | |||||
ids: List[Sha1Git], | |||||
extid_type: Optional[str] = None, | |||||
extid_version: Optional[int] = None, | |||||
) -> List[ExtID]: | ) -> List[ExtID]: | ||||
"""Get ExtID objects from target IDs and target_type | """Get ExtID objects from target IDs and target_type | ||||
Args: | Args: | ||||
target_type: type the SWH object | target_type: type the SWH object | ||||
ids: list of target IDs | ids: list of target IDs | ||||
extid_type: (Optional) extid_type to use as filter. This cannot be empty if | |||||
extid_version is provided. | |||||
extid_version: (Optional) version to use as filter. This cannot be empty if | |||||
extid_type is provided. | |||||
Raises: | |||||
ValueError if extid_version is provided without extid_type and vice versa. | |||||
Returns: | Returns: | ||||
list of ExtID objects | list of ExtID objects | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("extid/add") | @remote_api_endpoint("extid/add") | ||||
▲ Show 20 Lines • Show All 744 Lines • Show Last 20 Lines |