Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | def content_missing_per_sha1(self, contents, db=None, cur=None): | ||||
Raises: | Raises: | ||||
TODO: an exception when we get a hash collision. | TODO: an exception when we get a hash collision. | ||||
""" | """ | ||||
for obj in db.content_missing_per_sha1(contents, cur): | for obj in db.content_missing_per_sha1(contents, cur): | ||||
yield obj[0] | yield obj[0] | ||||
@db_transaction_generator() | @db_transaction_generator() | ||||
def skipped_content_missing(self, content, db=None, cur=None): | def skipped_content_missing(self, contents, db=None, cur=None): | ||||
"""List skipped_content missing from storage | """List skipped_content missing from storage | ||||
Args: | Args: | ||||
content: iterable of dictionaries containing the data for each | content: iterable of dictionaries containing the data for each | ||||
checksum algorithm. | checksum algorithm. | ||||
Returns: | Returns: | ||||
iterable: missing signatures | iterable: missing signatures | ||||
""" | """ | ||||
keys = db.content_hash_keys | keys = db.content_hash_keys | ||||
db.mktemp('skipped_content', cur) | db.mktemp('skipped_content', cur) | ||||
db.copy_to(content, 'tmp_skipped_content', | db.copy_to(contents, 'tmp_skipped_content', | ||||
keys + ['length', 'reason'], cur) | keys + ['length', 'reason'], cur) | ||||
yield from db.skipped_content_missing_from_temp(cur) | yield from db.skipped_content_missing_from_temp(cur) | ||||
@db_transaction() | @db_transaction() | ||||
def content_find(self, content, db=None, cur=None): | def content_find(self, content, db=None, cur=None): | ||||
"""Find a content hash in db. | """Find a content hash in db. | ||||
▲ Show 20 Lines • Show All 1,302 Lines • Show Last 20 Lines |