FederatedSnapshotSource class

Unions N local work SnapshotSources into ONE change-gated SnapshotSource — the fan-in that runs BEFORE StationJoinBridge (D-F1).

Scope note (docs/SCRATCH-grid-alignment.md §4 rescope, 2026-07-03): a remote substation is never a snapshot member (D-A2 — assignment- federation, not observation-federation); every member here is a LOCAL beads workspace this station reads directly. Bead ids are prefix-disjoint across stores (measured 2026-07-03: zero cross-prefix collisions), so member snapshots merge directly — no id-rewrite/namespacing needed.

Membership is MUTABLE (D-F1/D-Z1/D-Z2): addMember/removeMember attach or detach a member at runtime; the static --workspace <substation>=<path> flags grid_cli wires at boot are merely the FIRST membership source — a future zero-conf browser is the second, behind this same seam, with nothing here reshaped.

Contract (matches SnapshotSource exactly, so the bridge cannot tell a federated source from a single runtime): snapshots is change-gated (diff-non-empty), broadcast, non-replaying; current is the last computed union, or null before any member has published a baseline.

Implemented types

Constructors

FederatedSnapshotSource(Map<String, SnapshotSource> members, {Map<String, String> memberPrefixes = const {}, void onUnresolvedExternalDep(String message)?, Duration? readyStaleAge, DateTime now() = DateTime.now, Timer scheduleTimer(Duration, void ())?, void onFlare(String name, Map<String, String> data)?})
Builds a union over the initial members (substation NAME → its own local SnapshotSource) and starts following every one of them immediately.

Properties

current → GraphSnapshot?
The most recent snapshot, or null before the first baseline.
no setteroverride
freshness Map<String, MemberFreshness>
The per-member freshness vector (D-F3) — the union's own capturedAt (on the combined GraphSnapshot) is the MAX of these; staleness is judged per member, never averaged away.
no setter
hashCode int
The hash code for this object.
no setterinherited
members Set<String>
The member substation ids currently unioned (read-only view).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
snapshots Stream<GraphSnapshot>
The work graph as it changes — change-gated, broadcast, non-replaying.
no setteroverride

Methods

addMember(String substation, SnapshotSource source, {String? prefix}) → void
Attaches a NEW member at runtime (D-Z1/D-Z2 — mutable membership; a future zero-conf browser calls this behind the same seam a static boot-time list uses today). prefix is the member's bead-id prefix, defaulting to substation. A no-op if substation is already a member.
dispose() Future<void>
Cancels every member subscription and closes the union stream. Does not dispose the member SnapshotSources themselves — the caller that built them (buildControllers) owns their lifecycle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeMember(String substation) → void
Detaches a member — an operator un-registering a store, not a network blip (that's a stream error, handled by _attach's onError, which keeps the member and only marks it stale — absence ≠ deletion, D-Z3). A no-op if substation is not a member.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited