Skip to content

Conversation

@broofa
Copy link
Member

@broofa broofa commented Jul 18, 2024

Refactoring v1 code to align with the changes in #779.

Changes of note:

  • Decouple behavior of v1()-with-options from v1()-without-options
  • Encapsulate internal state handling and refactor to be more idiomatic
  • Removed the throw that limits UUID-generation rate, and instead reset the node.
  • Update RFC references in comments to link to RFC9562
  • Remove v1-rng.test and v1-random.test (no longer needed)

Note: While working on this new logic I realized the semantics of the clockseq field were unnecessarily complicated. (e.g. incrementing it on clock regression rather than randomizing). So (for UUIDs generated using internal state) the clockseq and node fields are treated as a single rand field (v7). They are initialized and updated at the same time - namely if there's a clock regression, or the generation rate exceeds the clock resolution. This significantly simplifies the state transition logic.

@broofa broofa marked this pull request as ready for review July 18, 2024 21:09
@broofa broofa requested review from ctavan and pmccarren July 18, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants