Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/interface.py
# Copyright (C) 2015-2021 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 | ||||
from typing import Any, Dict, Iterable, List, Optional | from typing import Any, Dict, Iterable, List, Optional, Tuple | ||||
from uuid import UUID | from uuid import UUID | ||||
from typing_extensions import Protocol, runtime_checkable | 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.scheduler.model import ( | from swh.scheduler.model import ( | ||||
ListedOrigin, | ListedOrigin, | ||||
ListedOriginPageToken, | ListedOriginPageToken, | ||||
▲ Show 20 Lines • Show All 316 Lines • ▼ Show 20 Lines | def origin_visit_stats_upsert( | ||||
self, origin_visit_stats: Iterable[OriginVisitStats] | self, origin_visit_stats: Iterable[OriginVisitStats] | ||||
) -> None: | ) -> None: | ||||
"""Create a new origin visit stats | """Create a new origin visit stats | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("visit_stats/get") | @remote_api_endpoint("visit_stats/get") | ||||
def origin_visit_stats_get( | def origin_visit_stats_get( | ||||
self, url: str, visit_type: str | self, ids: Iterable[Tuple[str, str]] | ||||
) -> Optional[OriginVisitStats]: | ) -> Dict[Tuple[str, str], OriginVisitStats]: | ||||
"""Retrieve the stats for an origin with a given visit type""" | """Retrieve the stats for an origin with a given visit type""" | ||||
... | ... |