Conversation
|
Review requested:
|
Renegade334
left a comment
There was a problem hiding this comment.
Thanks! A few initial comments.
|
A lot of effort went into optimizing the v4 version. We shall make sure to use the same primitives and setup without actually disrupting the v4 one. At the moment this proposal doesn't align with the options v4 has. |
I have updated the implementation to fully align with v4: Added disableEntropyCache option matching randomUUID() Same batching strategy (kBatchSize = 128, secureBuffer, randomFillSync) |
|
Please change the first commit message to |
Signed-off-by: nabeel378 <mohammadnabeeljameel@gmail.com>
- Make version/variant required params in serializeUUID - Share buffer pools (uuidData/uuidNotBuffered) between v4 and v7 Signed-off-by: nabeel378 <mohammadnabeeljameel@gmail.com>
Signed-off-by: nabeel378 <mohammadnabeeljameel@gmail.com>
This comment has been minimized.
This comment has been minimized.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62553 +/- ##
=======================================
Coverage 89.71% 89.71%
=======================================
Files 695 695
Lines 214154 214202 +48
Branches 41009 41020 +11
=======================================
+ Hits 192132 192181 +49
+ Misses 14075 14069 -6
- Partials 7947 7952 +5
🚀 New features to boost your workflow:
|
| return disableEntropyCache ? getUnbufferedUUID() : getBufferedUUID(); | ||
| } | ||
|
|
||
| function writeTimestamp(buf, offset) { |
There was a problem hiding this comment.
Maybe we could add a monotonic counter here to ensure sub-millisecond sort order
Ref: https://datatracker.ietf.org/doc/html/rfc9562#name-monotonicity-and-counters
There was a problem hiding this comment.
That can be a follow-up. It would reduce the UUID entropy so would probably need to be optional.
Adds
crypto.randomUUIDv7()which generates RFC 9562 version 7 UUIDs.UUIDv7 encodes a millisecond-precision Unix timestamp in the most
significant 48 bits, making these UUIDs time-sortable and suitable
for use as database primary keys.
Layout (128 bits):
Fixes: #62529
Refs: https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-7