Skip to main content

new_generation

Function new_generation 

Source
fn new_generation() -> String
Expand description

A per-write identifier stamped onto all three fields by a single write_split_tokens call, so read_split_tokens can detect a torn write ACROSS a process crash — not the concurrent-read-in-one-process case muxbus_load_impl’s lock already covers, but a kill signal landing mid-write, between one field’s write_chunked_field call completing and the next one starting (reagent P2: each field is individually self-consistent, per write_chunked_field’s own chunk+rollback atomicity, but with no lock surviving the process there’s nothing to stop the OLD stale value for the not-yet-reached field from still being present when the other two ARE the fresh ones — silently reconstructing a token set that pairs pieces from two different login sessions). High-resolution wall-clock nanos is unique enough for this purpose in practice; a formal UUID would work too but adds a dependency for no real benefit here.