Skip to content

Conversation

burner
Copy link
Member

@burner burner commented Aug 19, 2025

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @burner!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#10848"

@burner
Copy link
Member Author

burner commented Aug 19, 2025

related to #9881 (comment)

Comment on lines +200 to +202
nameBasedSHA1 = 5,
///Version 7 (milliseconds since unix epoch + random)
timestampRandom = 7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happened to version 6?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, the documentation https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-6 is here.

v7 is a big deal as it works very well with DB's and contains a reasonable timestamp.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I note that link also mentions a v8

Comment on lines +336 to +340
this.data[5] = cast(ubyte)(epoch & 0xFF);

// version and variant
this.data[6] = (this.data[6] & 0x0F) | 0x70;
this.data[8] = (this.data[8] & 0x3F) | 0x80;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

silly question, what about this.data[7]? is that a -?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data[7] is random data, the version [6] and variant [8] are not stored next to each other
https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7

uuid are strange data layout wise IMO

@burner burner force-pushed the uuidv7 branch 2 times, most recently from 6ed5c63 to 0a12b23 Compare August 19, 2025 14:43
@burner
Copy link
Member Author

burner commented Aug 19, 2025

@thewilsonator thank you

@thewilsonator
Copy link
Contributor

std/uuid.d(344:9)[warn]: A unittest should be annotated with at least @safe or @system
std/uuid.d(1385:6)[warn]: Public declaration 'timestampRandomUUID' has no documented example.
std/uuid.d(1790:11)[warn]: Public declaration 'generateV7RandomData' is undocumented.
std/uuid.d(1791:12)[warn]: Local imports should specify the symbols being imported to avoid hiding local symbols.
std/uuid.d(1864:1)[warn]: A unittest should be annotated with at least @safe or @system
std/uuid.d(1879:1)[warn]: A unittest should be annotated with at least @safe or @system
std/uuid.d(1892:1)[warn]: A unittest should be annotated with at least @safe or @system

@thewilsonator thewilsonator merged commit 0d9a534 into dlang:master Aug 20, 2025
9 of 10 checks passed
@burner
Copy link
Member Author

burner commented Aug 20, 2025

@thewilsonator passed already, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants