Skip to main content

discover_event_subscribers

Function discover_event_subscribers 

Source
pub fn discover_event_subscribers(
    unit_tables: &HashMap<String, UnitTable>,
    unit_consumes: &HashMap<String, Vec<String>>,
) -> BTreeMap<(String, String), Vec<(String, String)>>
Expand description

Events track, slice 0 (spine #936): project-wide “who subscribes to what” — for every service ... from Events(E) { on event ... } anywhere in the project, resolve E to its owning context (the one whose events table actually declares it — bare-name resolution, since TypeRef has no dotted form) and group subscribers under (owning_context, event_type_name). No prior art to reuse: cross-context wiring elsewhere is driven by an explicit author-written consumes clause, resolved eagerly in phase_resolve_consumes; this is the first wiring driven by an implicit relationship (a bare event-type name shared between a publisher’s event declaration and a subscriber’s from Events(E) header) — the same ownership resolution build_cross_context_info’s own consumed_event_names performs above, for the same reason (#936, events track slice 0).