swh.vault.api.client module

class swh.vault.api.client.RemoteVaultClient(url, api_exception=None, timeout=None, chunk_size=4096, reraise_exceptions=None, **kwargs)[source]

Bases: swh.core.api.RPCClient

Client to the Software Heritage vault cache.

backend_class

alias of swh.vault.interface.VaultInterface

reraise_exceptions: ClassVar[List[Type[Exception]]] = [<class 'swh.vault.exc.NotFoundExc'>]

On server errors, if any of the exception classes in this list has the same name as the error name, then the exception will be instantiated and raised instead of a generic RemoteException.

extra_type_decoders: Dict[str, Callable] = {'core_swhid': <bound method _BaseSWHID.from_string of <class 'swh.model.swhids.CoreSWHID'>>}

Value of extra_decoders passed to json_loads or msgpack_loads to be able to deserialize more object types.

extra_type_encoders: List[Tuple[type, str, Callable]] = [(<class 'swh.model.swhids.CoreSWHID'>, 'core_swhid', <class 'str'>)]

Value of extra_encoders passed to json_dumps or msgpack_dumps to be able to serialize more object types.

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

Cook a batch of bundles and returns the cooking id.

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

Fetch information from a batch of bundles

cook(bundle_type: str, swhid: swh.model.swhids.CoreSWHID, email: Optional[str] = None) Dict[str, Any]

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

fetch(bundle_type: str, swhid: swh.model.swhids.CoreSWHID) Optional[bytes]

Fetch information from a bundle

progress(bundle_type: str, swhid: swh.model.swhids.CoreSWHID)
put_bundle(bundle_type: str, swhid: swh.model.swhids.CoreSWHID, bundle)

Store bundle in vault cache

send_notif(bundle_type: str, swhid: swh.model.swhids.CoreSWHID)

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

set_progress(bundle_type: str, swhid: swh.model.swhids.CoreSWHID, progress: str) None

Set the cooking progress of a bundle

set_status(bundle_type: str, swhid: swh.model.swhids.CoreSWHID, status: str) bool

Set the cooking status of a bundle