swh.alter.operations module#

exception swh.alter.operations.RemoverError[source]#

Bases: Exception

exception swh.alter.operations.MaskingRequestNotFound(masking_request_slug: str)[source]#

Bases: Exception

swh.alter.operations.format_duration(seconds: float) str[source]#
class swh.alter.operations.Removable(removable_swhids: List[ExtendedSWHID], referencing: List[ExtendedSWHID])[source]#

Bases: NamedTuple

Aggregates information returned by Remover.get_removable() to be then used with Remover.create_recovery_bundle().

Create new instance of Removable(removable_swhids, referencing)

removable_swhids: List[ExtendedSWHID]#

Alias for field number 0

referencing: List[ExtendedSWHID]#

Alias for field number 1

print_plan() None[source]#
class swh.alter.operations.Remover(storage: StorageInterface, graph_client: RemoteGraphClient | None = None, known_missing: Set[ExtendedSWHID] | None = None, restoration_storage: StorageInterface | None = None, removal_searches: Dict[str, SearchInterface] | None = None, removal_storages: Dict[str, ObjectDeletionInterface] | None = None, removal_objstorages: Dict[str, ObjStorageInterface] | None = None, removal_journals: Dict[str, KafkaJournalWriter] | None = None, masking_admin: MaskingAdmin | None = None, progressbar: ProgressBarInit | None = None)[source]#

Bases: object

Helper class used to perform a removal.

get_removable(swhids: List[ExtendedSWHID], *, output_inventory_subgraph: TextIO | None = None, output_removable_subgraph: TextIO | None = None, output_pruned_removable_subgraph: TextIO | None = None) Removable[source]#
register_object(obj: BaseModel) None[source]#
register_objects_from_bundle(recovery_bundle_path: str, object_secret_key: str) RecoveryBundle[source]#
create_recovery_bundle(secret_sharing: SecretSharing, requested: List[Origin | ExtendedSWHID], removable: Removable, recovery_bundle_path: str, removal_identifier: str, reason: str | None = None, expire: datetime | None = None, allow_empty_content_objects: bool = False) str[source]#
restore_recovery_bundle() None[source]#
remove(progressbar=None) None[source]#
remove_from_storage(name: str, removal_storage: ObjectDeletionInterface) None[source]#
remove_from_journal(name: str, journal_writer: KafkaJournalWriter) None[source]#
remove_from_objstorages()[source]#
remove_from_objstorage(name: str, objstorage: ObjStorageInterface) Set[FrozenSet[Tuple[str, str]]][source]#
have_new_references(removed_swhids: List[ExtendedSWHID]) bool[source]#

Find out if any removed objects now have a new references coming from an object outside the set of removed objects.

handle_removal_notification_with_removal(notification_removal_identifier: str, secret_sharing: SecretSharing, recovery_bundle_path: str, ignore_requested=typing.List[swh.model.model.Origin | swh.model.swhids.ExtendedSWHID], allow_empty_content_objects: bool = False, recompute_swhids_to_remove: bool = True) None[source]#
handle_removal_notification_by_changing_masked_status(notification_removal_identifier: str, masked_state: MaskedState)[source]#