swh.vault.interface module#

class swh.vault.interface.VaultInterface(*args, **kwargs)[source]#

Bases: Protocol

Backend Interface for the Software Heritage vault.

fetch(bundle_type: str, swhid: CoreSWHID) bytes | None[source]#

Fetch information from a bundle

download_url(bundle_type: str, swhid: CoreSWHID, content_disposition: str | None = None, expiry: timedelta | None = None) str | None[source]#

Obtain bundle direct download link if the vault cache backend supports it.

cook(bundle_type: str, swhid: CoreSWHID, email: str | None = None) Dict[str, Any][source]#

Main entry point for cooking requests. This starts a cooking task if needed, and add the given e-mail to the notify list

progress(bundle_type: str, swhid: CoreSWHID)[source]#
set_progress(bundle_type: str, swhid: CoreSWHID, progress: str) None[source]#

Set the cooking progress of a bundle

set_status(bundle_type: str, swhid: CoreSWHID, status: str) bool[source]#

Set the cooking status of a bundle

put_bundle(bundle_type: str, swhid: CoreSWHID, bundle)[source]#

Store bundle in vault cache

send_notif(bundle_type: str, swhid: CoreSWHID)[source]#

Send all the e-mails in the notification list of a bundle

batch_cook(batch: List[Tuple[str, str]]) int[source]#

Cook a batch of bundles and returns the cooking id.

batch_progress(batch_id: int) Dict[str, Any][source]#

Fetch information from a batch of bundles