swh.alter.mirror_notification_watcher module#

class swh.alter.mirror_notification_watcher.MirrorNotificationWatcher(storage: StorageInterface, journal_client: JournalClient, masking_admin_dsn: str, emails_from: str, emails_recipients: List[str], smtp_host: str, smtp_port: int)[source]#

Bases: object

Watch the journal for notifications from the main archive.

For removal notifications, we mask the associated objects until a decision is made by the mirror operators.

Instantiate a MirrorNotificationWatcher

As notification will not be frequent, we only keep the configuration for MaskingAdmin instead of instantiating an object, as it would mean keeping a useless connection open to the database.

process_messages(messages: Dict[str, List[Dict[str, Any]]]) None[source]#
process_removal_notification(notification: RemovalNotification) None[source]#
watch() None[source]#
format_removal_email(notification) str[source]#
send_upstream_removal_email(notification: RemovalNotification) None[source]#