Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 859 Lines • ▼ Show 20 Lines | def origin_visit_get_by(self, origin: str, visit: int) -> Optional[Dict[str, Any]]: | ||||
it does not exist | it does not exist | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("origin/visit/get_latest") | @remote_api_endpoint("origin/visit/get_latest") | ||||
def origin_visit_get_latest( | def origin_visit_get_latest( | ||||
self, | self, | ||||
origin: str, | origin: str, | ||||
vlorentz: What about `type: Optional[Iterable[str]] = None`? I don't see any immediate use for it, but… | |||||
Done Inline Actionswell, i'm unsure about this. I see what you mean but also i see yagni... (maybe) and i'd like also to land
Like Alice Cooper said, "nothing is free" (as in paid-service)! :D I'll have to rewrite stuff in all backends again and tests for it and those Oh and also right now i already need to rewrite to extract tests in another ardumont: well, i'm unsure about this.
I see what you mean but also i see yagni... (maybe) and i'd like… | |||||
type: Optional[str] = None, | |||||
allowed_statuses: Optional[List[str]] = None, | allowed_statuses: Optional[List[str]] = None, | ||||
require_snapshot: bool = False, | require_snapshot: bool = False, | ||||
) -> Optional[Dict[str, Any]]: | ) -> Optional[Dict[str, Any]]: | ||||
"""Get the latest origin visit for the given origin, optionally | """Get the latest origin visit for the given origin, optionally | ||||
looking only for those with one of the given allowed_statuses | looking only for those with one of the given allowed_statuses | ||||
or for those with a snapshot. | or for those with a snapshot. | ||||
Args: | Args: | ||||
origin: origin URL | origin: origin URL | ||||
type: Optional visit type to filter on (e.g git, tar, dsc, svn, | |||||
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. | ||||
Returns: | Returns: | ||||
dict: a dict with the following keys: | dict: a dict with the following keys: | ||||
- **origin**: the URL of the origin | - **origin**: the URL of the origin | ||||
- **visit**: origin visit id | - **visit**: origin visit id | ||||
- **type**: type of loader used for the visit | - **type**: type of loader used for the visit | ||||
- **date**: timestamp of such visit | - **date**: timestamp of such visit | ||||
- **status**: Visit's new status | - **status**: Visit's new status | ||||
- **metadata**: Data associated to the visit | - **metadata**: Data associated to the visit | ||||
- **snapshot** (Optional[sha1_git]): identifier of the snapshot | - **snapshot** (Optional[sha1_git]): identifier of the snapshot | ||||
associated to the visit | associated to the visit | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("origin/visit_status/get_latest") | @remote_api_endpoint("origin/visit_status/get_latest") | ||||
def origin_visit_status_get_latest( | def origin_visit_status_get_latest( | ||||
self, | self, | ||||
origin_url: str, | origin_url: str, | ||||
visit: int, | visit: int, | ||||
▲ Show 20 Lines • Show All 415 Lines • Show Last 20 Lines |
What about type: Optional[Iterable[str]] = None? I don't see any immediate use for it, but it's free and might save a small breaking API change later