Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show All 35 Lines | class ListOrder(Enum): | ||||
ASC = "asc" | ASC = "asc" | ||||
DESC = "desc" | DESC = "desc" | ||||
TResult = TypeVar("TResult") | TResult = TypeVar("TResult") | ||||
PagedResult = CorePagedResult[TResult, str] | PagedResult = CorePagedResult[TResult, str] | ||||
# TODO: Make it an enum (too much impact) | |||||
VISIT_STATUSES = ["created", "ongoing", "full", "partial"] | |||||
def deprecated(f): | def deprecated(f): | ||||
f.deprecated_endpoint = True | f.deprecated_endpoint = True | ||||
return f | return f | ||||
class StorageInterface: | class StorageInterface: | ||||
@remote_api_endpoint("check_config") | @remote_api_endpoint("check_config") | ||||
def check_config(self, *, check_write): | def check_config(self, *, check_write): | ||||
▲ Show 20 Lines • Show All 826 Lines • ▼ Show 20 Lines | ) -> Optional[OriginVisit]: | ||||
hg, npm, pypi, ...) | hg, npm, pypi, ...) | ||||
allowed_statuses: list of visit statuses considered | allowed_statuses: list of visit statuses considered | ||||
to find the latest visit. For instance, | to find the latest visit. For instance, | ||||
``allowed_statuses=['full']`` will only consider visits that | ``allowed_statuses=['full']`` will only consider visits that | ||||
have successfully run to completion. | have successfully run to completion. | ||||
require_snapshot: If True, only a visit with a snapshot | require_snapshot: If True, only a visit with a snapshot | ||||
will be returned. | will be returned. | ||||
Raises: | |||||
StorageArgumentException if values for the allowed_statuses parameters | |||||
are unknown | |||||
Returns: | Returns: | ||||
OriginVisit matching the criteria if found, None otherwise. Note that as | OriginVisit matching the criteria if found, None otherwise. Note that as | ||||
OriginVisit no longer held reference on the visit status or snapshot, you | OriginVisit no longer held reference on the visit status or snapshot, you | ||||
may want to use origin_visit_status_get_latest for those information. | may want to use origin_visit_status_get_latest for those information. | ||||
""" | """ | ||||
... | ... | ||||
Show All 38 Lines | ) -> Optional[OriginVisitStatus]: | ||||
allowed_statuses: list of visit statuses considered to find the latest | allowed_statuses: list of visit statuses considered to find the latest | ||||
visit. Possible values are {created, ongoing, partial, full}. For | visit. Possible values are {created, ongoing, partial, full}. For | ||||
instance, ``allowed_statuses=['full']`` will only consider visits that | instance, ``allowed_statuses=['full']`` will only consider visits that | ||||
have successfully run to completion. | have successfully run to completion. | ||||
require_snapshot: If True, only a visit with a snapshot | require_snapshot: If True, only a visit with a snapshot | ||||
will be returned. | will be returned. | ||||
Raises: | |||||
StorageArgumentException if values for the allowed_statuses parameters | |||||
are unknown | |||||
Returns: | Returns: | ||||
The OriginVisitStatus matching the criteria | The OriginVisitStatus matching the criteria | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("origin/visit_status/get_random") | @remote_api_endpoint("origin/visit_status/get_random") | ||||
def origin_visit_status_get_random( | def origin_visit_status_get_random( | ||||
▲ Show 20 Lines • Show All 349 Lines • Show Last 20 Lines |