pub struct UnionFanIn {
pub fan_out: NodeId,
/* private fields */
}Expand description
UnionFanIn (union-fan-in.ts): N branch inputs, one output. fetch
k-way-merges the branch fetches with PK dedup (merge_node_streams).
push either accumulates (during a fan-out broadcast — the owned model) or
does a direct cross-branch dedup (a flipped child pushed while the fan-out is
idle). On drain it collapses the accumulation via push_accumulated_changes
and forwards the single result.
Fields§
§fan_out: NodeIdImplementations§
Source§impl UnionFanIn
impl UnionFanIn
pub fn new( fan_out: NodeId, inputs: Vec<NodeId>, branch_constraints: Vec<Constraint>, schema: Schema, ) -> UnionFanIn
Sourcepub fn fetch<'g>(
&'g self,
g: &'g Graph,
req: &FetchRequest,
) -> Box<dyn Iterator<Item = Node<'g>> + 'g>
pub fn fetch<'g>( &'g self, g: &'g Graph, req: &FetchRequest, ) -> Box<dyn Iterator<Item = Node<'g>> + 'g>
fetch (union-fan-in.ts:103): k-way merge of the branch fetches in
compare_rows order (reverse-aware), deduping consecutive PK-equal rows (a
row matched by two branches is yielded once). Drop-clean.
Each branch is fetched through fetch_branch, which merges
the branch’s build-time pushable constraint into the request — so an eq(pk)
branch seeks the shared source instead of full-scanning it (an OR-branch
constraint accumulation, not in the JS, which re-scans per branch).
Sourcepub fn push<'g>(&'g self, g: &'g Graph, change: Change<'g>)
pub fn push<'g>(&'g self, g: &'g Graph, change: Change<'g>)
push (union-fan-in.ts:116): accumulate during a broadcast (materialize to
owned before taking the borrow, so the reentrant relationship fetch in
materialize_change_preserving_node never runs while the accumulation is
borrowed), else a direct internal change.