pub fn update(
states: &mut HashMap<String, CredentialState>,
generations: &mut HashMap<String, u64>,
next_generation: &mut u64,
cmd: Command,
) -> Vec<Event>Expand description
states is the orchestrator’s whole coordination table; generations
tracks each id’s CURRENT registration epoch so a completion from a
superseded registration can be told apart from a current one (see
Event::RunFreshnessCheck’s doc comment); next_generation is a single
counter shared across ALL ids, strictly increasing, never reused —
deliberately NOT a per-id counter restarted at 0 on each Register,
because an unregister-then-re-register sequence would then hand the new
registration the SAME generation number the old one had, and a stale
completion from the old registration (still in flight when the
unregister/re-register raced in) would wrongly pass the staleness check
instead of being discarded (reagent re-review on #2275). One reducer
call per dispatched command, sub-millisecond, never awaits.