swh.alter.removable module#
This module implements the marking stage of the removal algorithm.
- class swh.alter.removable.RemovableSubgraph(*args, **kwargs)[source]#
Bases:
SubgraphA class representing the subgraph of objects that can be safely removed from the archive
This subgraph should only be created from an
InventorySubgraphusingfrom_inventory_subgraph(). No new vertices or edges can be added at this point.Getting the list of SWHID that can be removed is done by using py:meth:removable_swhids.
After marking happened, this subgraph will contain all candidates until
delete_unremovable()is called.- classmethod from_inventory_subgraph(subgraph: InventorySubgraph)[source]#
- removable_swhids() List[ExtendedSWHID][source]#
Returns a list of SWHIDs that can safely be removed from the archive.
- referenced_swhids() List[ExtendedSWHID][source]#
Returns a list of SWHIDs that are referenced by objects that can be safely removed from the archive.
- swh.alter.removable.mark_removable(storage: StorageInterface, graph_client: RemoteGraphClient, inventory_subgraph: InventorySubgraph, known_missing: Set[ExtendedSWHID] | None = None, progressbar: ProgressBarInit | None = None) RemovableSubgraph[source]#
Find which candidates can be safely removed from the archive.
Using the previously populated
inventory_subgraph, query the givenstorageandgraph_clientto assess inbound references for each candidate and see which one can be safely removed from the archive.