swh.vault.backend module

swh.vault.backend.batch_to_bytes(batch)[source]
class swh.vault.backend.VaultBackend(db, cache, scheduler, storage=None, **config)[source]

Bases: object

Backend for the Software Heritage vault.

get_db()[source]
put_db(db)[source]
task_info(obj_type, obj_id)[source]

Fetch information from a bundle

create_task(obj_type, obj_id, sticky=False)[source]

Create and send a cooking task

add_notif_email(obj_type, obj_id, email)[source]

Add an e-mail address to notify when a given bundle is ready

cook_request(obj_type, obj_id, *, sticky=False, email=None)[source]

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

batch_cook(batch)[source]

Cook a batch of bundles and returns the cooking id.

batch_info(batch_id)[source]

Fetch information from a batch of bundles

is_available(obj_type, obj_id)[source]

Check whether a bundle is available for retrieval

fetch(obj_type, obj_id)[source]

Retrieve a bundle from the cache

update_access_ts(obj_type, obj_id)[source]

Update the last access timestamp of a bundle

set_status(obj_type, obj_id, status)[source]

Set the cooking status of a bundle

set_progress(obj_type, obj_id, progress)[source]

Set the cooking progress of a bundle

send_all_notifications(obj_type, obj_id)[source]

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

send_notification(n_id, email, obj_type, obj_id, status, progress_msg=None)[source]

Send the notification of a bundle to a specific e-mail

cache_expire_oldest(n=1, by='last_access')[source]

Expire the n oldest bundles

cache_expire_until(date, by='last_access')[source]

Expire all the bundles until a certain date