Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 1,069 Lines • ▼ Show 20 Lines | def object_find_by_sha1_git(self, ids, db=None, cur=None): | ||||
ids: a generator of sha1_gits | ids: a generator of sha1_gits | ||||
Returns: | Returns: | ||||
dict: a mapping from id to the list of objects found. Each object | dict: a mapping from id to the list of objects found. Each object | ||||
found is itself a dict with keys: | found is itself a dict with keys: | ||||
- sha1_git: the input id | - sha1_git: the input id | ||||
- type: the type of object found | - type: the type of object found | ||||
- id: the id of the object found | |||||
- object_id: the numeric id of the object found. | |||||
""" | """ | ||||
ret = {} | ret = {} | ||||
for id_ in ids: | for id_ in ids: | ||||
objs = self._objects.get(id_, []) | objs = self._objects.get(id_, []) | ||||
ret[id_] = [{ | ret[id_] = [{ | ||||
'sha1_git': id_, | 'sha1_git': id_, | ||||
'type': obj[0], | 'type': obj[0], | ||||
'id': obj[1], | |||||
'object_id': id_, | |||||
} for obj in objs] | } for obj in objs] | ||||
return ret | return ret | ||||
def _convert_origin(self, t): | def _convert_origin(self, t): | ||||
if t is None: | if t is None: | ||||
return None | return None | ||||
return t.to_dict() | return t.to_dict() | ||||
▲ Show 20 Lines • Show All 754 Lines • Show Last 20 Lines |