Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | class Storage: | ||||
def release_get(self, releases): | def release_get(self, releases): | ||||
"""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. | |||||
""" | """ | ||||
yield from map(self._releases.__getitem__, releases) | for rel_id in releases: | ||||
yield copy.deepcopy(self._releases.get(rel_id)) | |||||
def snapshot_add(self, origin, visit, snapshot): | def snapshot_add(self, origin, visit, snapshot): | ||||
"""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 | ||||
visit (int): id of the visit | visit (int): id of the visit | ||||
snapshot (dict): the snapshot to add to the visit, containing the | snapshot (dict): the snapshot to add to the visit, containing the | ||||
▲ Show 20 Lines • Show All 671 Lines • Show Last 20 Lines |