Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show First 20 Lines • Show All 723 Lines • ▼ Show 20 Lines | class Storage(): | ||||
def release_get(self, releases, db=None, cur=None): | def release_get(self, releases, db=None, cur=None): | ||||
"""Given a list of sha1, return the releases's information | """Given a list of sha1, return the releases's information | ||||
Args: | Args: | ||||
releases: list of sha1s | releases: list of sha1s | ||||
Yields: | Yields: | ||||
dicts with the same keys as those given to `release_add` | dicts with the same keys as those given to `release_add` | ||||
(or ``None`` if a release does not exist) | |||||
Raises: | |||||
ValueError: if the keys does not match (url and type) nor id. | |||||
""" | """ | ||||
for release in db.release_get_from_list(releases, cur): | for release in db.release_get_from_list(releases, cur): | ||||
yield converters.db_to_release( | data = converters.db_to_release( | ||||
dict(zip(db.release_get_cols, release)) | dict(zip(db.release_get_cols, release)) | ||||
) | ) | ||||
yield data if data['target_type'] else None | |||||
@db_transaction() | @db_transaction() | ||||
def snapshot_add(self, origin, visit, snapshot, | def snapshot_add(self, origin, visit, snapshot, | ||||
db=None, cur=None): | db=None, cur=None): | ||||
"""Add a snapshot for the given origin/visit couple | """Add a snapshot for the given origin/visit couple | ||||
Args: | Args: | ||||
origin (int): id of the origin | origin (int): id of the origin | ||||
▲ Show 20 Lines • Show All 729 Lines • Show Last 20 Lines |