Changeset View
Changeset View
Standalone View
Standalone View
swh/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 | ||||
import datetime | import datetime | ||||
from typing import Any, Dict, Iterable, List, Optional, Union | from typing import Any, Dict, Iterable, List, Optional, Union | ||||
from swh.core.api import remote_api_endpoint | from swh.core.api import remote_api_endpoint | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
BaseModel, Content, Directory, Origin, OriginVisit, Revision, Release, | Content, Directory, Origin, OriginVisit, Revision, Release, | ||||
Snapshot, SkippedContent | Snapshot, SkippedContent | ||||
) | ) | ||||
def deprecated(f): | def deprecated(f): | ||||
f.deprecated_endpoint = True | f.deprecated_endpoint = True | ||||
return f | return f | ||||
▲ Show 20 Lines • Show All 746 Lines • ▼ Show 20 Lines | def snapshot_get_random(self): | ||||
a sha1_git | a sha1_git | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint('origin/visit/add') | @remote_api_endpoint('origin/visit/add') | ||||
def origin_visit_add( | def origin_visit_add( | ||||
self, origin: Origin, | self, origin: Origin, | ||||
date: Union[str, datetime.datetime], | date: Union[str, datetime.datetime], | ||||
type: str) -> Dict[str, BaseModel]: | type: str) -> OriginVisit: | ||||
"""Add an origin_visit for the origin at ts with status 'ongoing'. | """Add an origin_visit for the origin at ts with status 'ongoing'. | ||||
Args: | Args: | ||||
origin: visited origin's identifier or URL | origin: visited origin's identifier or URL | ||||
date: timestamp of such visit | date: timestamp of such visit | ||||
type: the type of loader used for the visit (hg, git, ...) | type: the type of loader used for the visit (hg, git, ...) | ||||
Raises: | Raises: | ||||
▲ Show 20 Lines • Show All 499 Lines • Show Last 20 Lines |