Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/archive.py
Show First 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | ) -> PagedResult[OriginInfo]: | |||||||||
""" | """ | |||||||||
page = storage.origin_list(page_token=page_token, limit=limit) | page = storage.origin_list(page_token=page_token, limit=limit) | |||||||||
return PagedResult( | return PagedResult( | |||||||||
[converters.from_origin(o.to_dict()) for o in page.results], | [converters.from_origin(o.to_dict()) for o in page.results], | |||||||||
next_page_token=page.next_page_token, | next_page_token=page.next_page_token, | |||||||||
) | ) | |||||||||
def lookup_origin_snapshots(origin: OriginInfo) -> List[str]: | ||||||||||
vlorentzUnsubmitted Not Done Inline Actions
vlorentz: | ||||||||||
"""Return ids of the snapshots of an origin. | ||||||||||
Args: | ||||||||||
origin: origin's dict with 'url' key | ||||||||||
Returns: | ||||||||||
List of unique snapshot identifiers in hexadecimal format resulting | ||||||||||
from the visits of the origin. | ||||||||||
""" | ||||||||||
return [ | ||||||||||
snapshot.hex() for snapshot in storage.origin_snapshot_get_all(origin["url"]) | ||||||||||
] | ||||||||||
def search_origin( | def search_origin( | |||||||||
url_pattern: str, | url_pattern: str, | |||||||||
use_ql: bool = False, | use_ql: bool = False, | |||||||||
limit: int = 50, | limit: int = 50, | |||||||||
with_visit: bool = False, | with_visit: bool = False, | |||||||||
visit_types: Optional[List[str]] = None, | visit_types: Optional[List[str]] = None, | |||||||||
page_token: Optional[str] = None, | page_token: Optional[str] = None, | |||||||||
) -> Tuple[List[OriginInfo], Optional[str]]: | ) -> Tuple[List[OriginInfo], Optional[str]]: | |||||||||
▲ Show 20 Lines • Show All 1,100 Lines • Show Last 20 Lines |