ReactiveDag.Graph (reactive_dag v0.16.0)

Copy Markdown View Source

Pure DAG construction: a list of ReactiveDag.Cell → a ReactiveDag.Plan.

No live data — only the plan (cells, parent edges, depths). Validates that every referenced input exists and the graph is acyclic (raises ArgumentError on a dangling input or cycle; a host's DSL transformer should catch these at compile time, but the runtime builder re-checks so a hand-built plan can't wedge the drain).

Summary

Functions

The parents whose keys should be dirtied when child changed, applying the host's key_rule module (a ReactiveDag.KeyRule impl). The rule sees the parent, the specific child input, and the changed keys, and returns :all (whole-cell recompute, the "*" wildcard) or {:keys, mapped}.

Functions

build(cells)

@spec build([ReactiveDag.Cell.t()]) :: ReactiveDag.Plan.t()

dirty_parents(plan, child_id, keys, key_rule \\ ReactiveDag.KeyRule)

@spec dirty_parents(
  ReactiveDag.Plan.t(),
  ReactiveDag.Cell.id(),
  [String.t()],
  module()
) :: [
  {ReactiveDag.Cell.id(), [String.t()]}
]

The parents whose keys should be dirtied when child changed, applying the host's key_rule module (a ReactiveDag.KeyRule impl). The rule sees the parent, the specific child input, and the changed keys, and returns :all (whole-cell recompute, the "*" wildcard) or {:keys, mapped}.

Returns [{parent_id, [key]}]. key_rule defaults to identity mapping.