Skip to main content

fold_node_states

Function fold_node_states 

Source
pub fn fold_node_states<'a, I>(events: I) -> HashMap<NodeId, String>
where I: IntoIterator<Item = &'a ChainEvent>,
Expand description

Fold a sequence of chain events into node_id → current state.

Rules:

  • causal.node.add seeds the node with optional state from payload, else leaves it unmapped until a state event arrives.
  • causal.node.state sets to (last write wins in event order).
  • causal.node.remove drops the node from the map.

Events of other kinds are ignored. Order is the fold order — pass chain order (ascending sequence).