swh.storage.algos.swhid module#
- swh.storage.algos.swhid.known_swhids(storage: StorageInterface, swhids: Iterable[T]) set[T][source]#
Query the storage to check if
swhidsexist.We group SWHIDs by type and then call the corresponding storage
_missingmethod (directory_missing, snapshot_missing, etc.) and switch the results as we want to know what exists, not what’s missing.As the storage does not use values from the qualifier (snapshot, etc.) we exclude
QualifiedSWHIDfrom this method becauseknown_swhids(storage, swh:1:cnt:1234567890;visit=swh:1:snp:098654321)could return that swh:1:cnt:1234567890 exists even if swh:1:snp:098654321 doesn’t.- Parameters:
storage – a
StorageInterfaceswhid – a list of SWHIDs
- Raises:
TypeError – received a
QualifiedSWHIDin theswhidslist- Returns:
A set of SWHIDs found in the storage
- swh.storage.algos.swhid.swhid_is_known(storage: StorageInterface, swhid: CoreSWHID | ExtendedSWHID) bool[source]#
Query the storage to check if
swhidexists.A wrapper for
known_swhids()but for a single SWHID.- Parameters:
storage – a
StorageInterfaceswhid – a SWHID
- Returns:
Trueifswhidexists in the storage