Template Function ros2_medkit_gateway::fan_out_collection

Function Documentation

template<class T>
inline FanOutResult<T> ros2_medkit_gateway::fan_out_collection(AggregationManager *agg, const httplib::Request &req)

Typed fan-out for collection endpoints. Replacement for merge_peer_items that returns parsed T items instead of mutating a raw JSON document.

Behavior parity with merge_peer_items:

  • null agg, X-Medkit-No-Fan-Out header, or zero healthy peers all short-circuit to an empty result (no fan-out attempted).

  • per-entity paths consult the routing/contributor tables to target only the peers that host the entity; global paths fan out to all healthy peers.

  • peer failures are surfaced via partial + failed_peers.

New behavior:

  • peer items are parsed via dto::JsonReader<T> rather than copied as raw JSON. Items that fail validation are dropped from items and recorded in dropped_items with the JsonReader error message plus a best-effort source_id. A WARN is logged for each drop.

  • the peer field on each DroppedItem is left empty in this commit because AggregationManager::fan_out_get coalesces all peer responses into one merged_items array without per-item provenance. Future work can thread per-peer attribution through if needed.