swh.alter.inventory module#

This module implements the inventory stage of the removal algorithm.

class swh.alter.inventory.InventorySubgraph(*args, **kwargs)[source]#

Bases: Subgraph

A subgraph holding an inventory of all candidates for removal

When all references from a given node have been accounted for, the complete attribute is set to True.

See Subgraph

default_vertex_attributes: Dict[str, Any] = {'complete': False}#

Vertex will get the following attributes on creation unless specified otherwise.

select_incomplete() List[Vertex][source]#

Return vertices known to be incomplete ordered by object type from origins to contents.

swh.alter.inventory.make_inventory(storage, graph_client, swhids: Collection[ExtendedSWHID]) InventorySubgraph[source]#

Inventory candidates for removal from the given set of SWHID.

By querying the given storage and graph_client, create a subgraph with all objects belonging to the given set of SWHIDs (typically origins). The result should then used to verify which candidate can safely be removed.