ReactiveDag.Node.KeyRule (reactive_dag v0.17.0-rc.2)

Copy Markdown View Source

A GENERIC ReactiveDag.KeyRule for graphs declared with ReactiveDag.Node. Node records each node's key_rule (:identity | :all) in cell.meta; this reads it:

  • :all — any input change escalates to a whole-cell recompute (the drain turns this into "*"). For aggregate / cross-range (reduce) cells.
  • :identity — a changed input key maps to the same output key (pass through). For key-local (map) cells. The default.

This is the uniform per-cell rule (cascade's shape). A host needing per-op, per-input-leg rules (the portal's product/relation escalation) still writes its own KeyRule; this generic one covers the :identity | :all case.

Summary

Functions

rule/3 with the SNAPSHOTS the changed keys were marked with — the child rows as they were, which ReactiveDag.Frontier captured at mark time.

Functions

rule(parent, child, changed, priors)

@spec rule(ReactiveDag.Cell.t(), ReactiveDag.Cell.id(), [String.t()], %{
  required(String.t()) => map()
}) ::
  ReactiveDag.KeyRule.result()

rule/3 with the SNAPSHOTS the changed keys were marked with — the child rows as they were, which ReactiveDag.Frontier captured at mark time.

A snapshot survives its row, so a :group claim stays precise in the two cases a live lookup cannot handle:

  • the row was deleted — nothing to read, but the snapshot still names the unit it belonged to;
  • the row moved between units — the live row names where it landed, the snapshot names where it came from, and BOTH need repricing.

Keys with no snapshot (a source-fed leaf has no Ash row behind it) fall back to rule/3 exactly as before, so the two paths coexist.