Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/interface.py
Show First 20 Lines • Show All 689 Lines • ▼ Show 20 Lines | def snapshot_get_by_origin_visit(self, origin, visit): | ||||
whose keys are the branches' names. | whose keys are the branches' names. | ||||
* **next_branch**: the name of the first branch not returned | * **next_branch**: the name of the first branch not returned | ||||
or :const:`None` if the snapshot has less than 1000 | or :const:`None` if the snapshot has less than 1000 | ||||
branches. | branches. | ||||
""" | """ | ||||
... | ... | ||||
@remote_api_endpoint("snapshot/latest") | |||||
def snapshot_get_latest(self, origin, allowed_statuses=None): | |||||
"""Get the content, possibly partial, of the latest snapshot for the | |||||
given origin, optionally only from visits that have one of the given | |||||
allowed_statuses | |||||
The branches of the snapshot are iterated in the lexicographical | |||||
order of their names. | |||||
.. warning:: At most 1000 branches contained in the snapshot will be | |||||
returned for performance reasons. In order to browse the whole | |||||
set of branches, the method :meth:`snapshot_get_branches` | |||||
should be used instead. | |||||
Args: | |||||
origin (str): the origin's URL | |||||
allowed_statuses (list of str): list of visit statuses considered | |||||
to find the latest snapshot for the visit. For instance, | |||||
``allowed_statuses=['full']`` will only consider visits that | |||||
have successfully run to completion. | |||||
Returns: | |||||
dict: a dict with three keys: | |||||
* **id**: identifier of the snapshot | |||||
* **branches**: a dict of branches contained in the snapshot | |||||
whose keys are the branches' names. | |||||
* **next_branch**: the name of the first branch not returned | |||||
or :const:`None` if the snapshot has less than 1000 | |||||
branches. | |||||
""" | |||||
... | |||||
@remote_api_endpoint("snapshot/count_branches") | @remote_api_endpoint("snapshot/count_branches") | ||||
def snapshot_count_branches(self, snapshot_id): | def snapshot_count_branches(self, snapshot_id): | ||||
"""Count the number of branches in the snapshot with the given id | """Count the number of branches in the snapshot with the given id | ||||
Args: | Args: | ||||
snapshot_id (bytes): identifier of the snapshot | snapshot_id (bytes): identifier of the snapshot | ||||
Returns: | Returns: | ||||
▲ Show 20 Lines • Show All 586 Lines • Show Last 20 Lines |