concept

Retention and deletion propagation

Compute transitive impact in a finite lineage graph; reject unknown dependency IDs.

Formal Syntax & Structure

artificial-intelligence syntaxartificial-intelligence
affected_nodes(parents, removed)

Working Example

Example Snippetartificial-intelligence
def affected_nodes(parents, removed):    # Map artifact ID to its direct parent IDs. Include the removed ID.    if removed not in parents or any(p not in parents for ps in parents.values() for p in ps):        raise ValueError("unknown lineage node")    affected = {removed}    while True:        expanded = affected | {node for node, ps in parents.items()                               if affected.intersection(ps)}        if expanded == affected:            return sorted(affected)        affected = expanded
parents = {"A":[], "B":[], "chunk-A":["A"], "chunk-B":["B"],           "index-A":["chunk-A"], "cache-AB":["index-A","chunk-B"]}print(affected_nodes(parents, "A"))