Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | def content_find(self, content): | ||||
hash = content.get(algo) | hash = content.get(algo) | ||||
if hash and hash in self._content_indexes[algo]: | if hash and hash in self._content_indexes[algo]: | ||||
found.append(self._content_indexes[algo][hash]) | found.append(self._content_indexes[algo][hash]) | ||||
if not found: | if not found: | ||||
return | return | ||||
keys = list(set.intersection(*found)) | keys = list(set.intersection(*found)) | ||||
# FIXME: should really be a list of all the objects found | # FIXME: should really be a list of all the objects found | ||||
return copy.deepcopy(self._contents[keys[0]]) | list_to_return = [] | ||||
for i in range(len(keys)): | |||||
list_to_return.append(copy.deepcopy(self._contents[keys[i]])) | |||||
return list_to_return | |||||
def content_missing(self, contents, key_hash='sha1'): | def content_missing(self, contents, key_hash='sha1'): | ||||
"""List content missing from storage | """List content missing from storage | ||||
Args: | Args: | ||||
contents ([dict]): iterable of dictionaries whose keys are | contents ([dict]): iterable of dictionaries whose keys are | ||||
either 'length' or an item of | either 'length' or an item of | ||||
:data:`swh.model.hashutil.ALGORITHMS`; | :data:`swh.model.hashutil.ALGORITHMS`; | ||||
▲ Show 20 Lines • Show All 1,109 Lines • Show Last 20 Lines |