Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | ) -> Iterable[bytes]: | ||||
keys = db.content_hash_keys | keys = db.content_hash_keys | ||||
key_hash_idx = keys.index(key_hash) | key_hash_idx = keys.index(key_hash) | ||||
for obj in db.content_missing_from_list(contents, cur): | for obj in db.content_missing_from_list(contents, cur): | ||||
yield obj[key_hash_idx] | yield obj[key_hash_idx] | ||||
@timed | @timed | ||||
@db_transaction_generator() | @db_transaction_generator() | ||||
def content_missing_per_sha1(self, contents, db=None, cur=None): | def content_missing_per_sha1( | ||||
self, contents: List[bytes], db=None, cur=None | |||||
) -> Iterable[bytes]: | |||||
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] | ||||
@timed | @timed | ||||
@db_transaction_generator() | @db_transaction_generator() | ||||
def content_missing_per_sha1_git(self, contents, db=None, cur=None): | def content_missing_per_sha1_git( | ||||
self, contents: List[bytes], db=None, cur=None | |||||
) -> Iterable[Sha1Git]: | |||||
for obj in db.content_missing_per_sha1_git(contents, cur): | for obj in db.content_missing_per_sha1_git(contents, cur): | ||||
yield obj[0] | yield obj[0] | ||||
@timed | @timed | ||||
@db_transaction() | @db_transaction() | ||||
def content_find(self, content: Dict[str, Any], db=None, cur=None) -> List[Content]: | def content_find(self, content: Dict[str, Any], db=None, cur=None) -> List[Content]: | ||||
if not set(content).intersection(DEFAULT_ALGORITHMS): | if not set(content).intersection(DEFAULT_ALGORITHMS): | ||||
raise StorageArgumentException( | raise StorageArgumentException( | ||||
▲ Show 20 Lines • Show All 1,046 Lines • Show Last 20 Lines |