Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new IETF UUID formats #580

Open
dncnkrs opened this issue Aug 9, 2021 · 16 comments
Open

Support new IETF UUID formats #580

dncnkrs opened this issue Aug 9, 2021 · 16 comments
Labels
stale-exempt Exempts issue from being marked as stale

Comments

@dncnkrs
Copy link

dncnkrs commented Aug 9, 2021

A recently published draft RFC proposes three new time-based UUID formats. The UUIDv1 is also time-based, but the timestamp is formatted little-endian, whereas the new formats use a big-endian format. This means the UUID's will naturally sort in order of time, which has several engineering advantages.

Because the RFC is still a draft, I wouldn't yet expect that UUID libraries can generate the new formats. I'd like to know if this library intends to implement them, however.

I thought it would be useful to create this issue, so we can see if:

  • the new formats will be implemented in this library,
  • if so, the status of the implementation (assumed to be after the RFC is published).

https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-01

@broofa
Copy link
Member

broofa commented Aug 10, 2021

Good issue. I'm generally in favor of this, as the new versions have some much-needed improvements over the original spec. However, this spec appears to still be an early, unadopted draft (e.g. numerous typos, not yet assigned an RFC #).

Until this is more formally adopted by the IETF, I don't think it's appropriate for us to officially support it. (That's not to say we couldn't publish an "experimental" branch / release, but I don't see that as a high priority task.)

@fabiolimace
Copy link

The new UUID formats are being discussed in this github repo: https://github.com/uuid6/uuid6-ietf-draft

@broofa broofa changed the title Support for new UUID formats (v6, v7, v8) Support new IETF UUID formats Sep 8, 2021
@kripod
Copy link

kripod commented Sep 27, 2021

I've just created an isomorphic implementation for the current UUIDv7 draft: https://github.com/kripod/uuidv7 – I would appreciate some feedback about it.

@CMCDragonkai
Copy link

@kripod in your example how does one provide the node id in a distributed context?

Also I was wondering if we can provide a custom clock source. In case we wanted a monotonic clock.

@kripod
Copy link

kripod commented Sep 28, 2021

@CMCDragonkai providing a custom machine ID isn’t possible yet, but 62 random bits should be sufficient to avoid collisions. Does the spec draft mention how to use machine IDs within a UUIDv7?

Not sure if a custom clock source may ever be provided, as JS is single-threaded and thus, seq is guaranteed to be monotonic.

Please open new issues about these over here.

@CMCDragonkai
Copy link

Done:

@CMCDragonkai
Copy link

Based on @kripod work and some discussions in the upstream spec and the prototype code here https://github.com/uuid6/prototypes, we've developed js-id https://github.com/MatrixAI/js-id for use in our company's projects. The IdSortable (https://github.com/MatrixAI/js-id/blob/master/src/IdSortable.ts) there implements UUIDv7 millisecond resolution based on the latest revision of the spec and resolves my 2 issues that I posted above in https://github.com/kripod/uuidv7.

@github-actions
Copy link

Marking as stale due to 90 days with no activity.

@github-actions github-actions bot added the stale label Aug 13, 2022
@github-actions
Copy link

Closing issue due to 30 days since being marked as stale.

@broofa broofa mentioned this issue Nov 7, 2022
@broofa broofa reopened this Nov 7, 2022
@broofa
Copy link
Member

broofa commented Nov 7, 2022

Quick update: The new versions are being spec'ed out by the UUID revision Working Group based on the draft work mentioned previously.

There doesn't seem to be a lot of concern or contention so far, which has me thinking we could start add support for these new formats... maybe under an "experimental" release version of some sort without too much risk of major changes being needed.

@github-actions github-actions bot removed the stale label Nov 8, 2022
pmccarren added a commit to pmccarren/uuid that referenced this issue Jan 22, 2023
pmccarren added a commit to pmccarren/uuid that referenced this issue Jan 22, 2023
note, husky pre-commit hook was bypassed for this commit
@pmccarren pmccarren mentioned this issue Jan 22, 2023
2 tasks
@broofa
Copy link
Member

broofa commented Feb 4, 2023

Tracking support for RFC4122bis here: https://github.com/orgs/uuidjs/projects/1

csmith23 added a commit to csmith23/uuid that referenced this issue Feb 7, 2023
* feat: implement uuid7 (uuidjs#580)

* fix: add v7.js to .local (uuidjs#580)

note, husky pre-commit hook was bypassed for this commit

* fix: add v7 to uuid-bin

* chore: fix readme anchor

* chore: use generated readme, remove timestamp arg from uuid-bin v7

* fix: typo in uuid regex, add negative test cases

* fix: do not mutate provided rnds, add v7 unit tests

* fix: validation test should not pass version 0

* chore: update package.json description

* Update src/v7.js

Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>

* include uuid v6 and v8 in validation regex

* chore: add test:matching script to package.json

* fix: v7 monotonicity and lexicographical sorting

* refactor: v7 seq reinitialization

* chore: update v7 README

---------

Co-authored-by: Patrick McCarren <patrick@cumulative.io>
Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
@github-actions
Copy link

github-actions bot commented May 6, 2023

Marking as stale due to 90 days with no activity.

@github-actions github-actions bot added the stale label May 6, 2023
@broofa broofa added stale-exempt Exempts issue from being marked as stale and removed stale labels May 6, 2023
@DevBrent
Copy link

DevBrent commented Oct 2, 2023

I just came across this article, and I'd really like to start using UUIDv7.

It looks like the code in csmith23#1 was solid (please someone more qualified audit the generator, but the test coverage and updates to documentation looked great) but I don't see a PR into this repo.

Edit: I now found the discussion continued in: #681

@Crsk
Copy link

Crsk commented Oct 4, 2023

If I'm going to start a new project, is it a bad idea to use v1 only temporarily while waiting for v7 experimental or not? so that I structure my identifiers as Postgres uuid and have lexicographic sorting

@notramo
Copy link

notramo commented Dec 2, 2023

@Crsk I think, trying to hurry up the implementation doesn't add to the conversation.
You can already use UUID v7 in your project, as there are other JS implementations of UUID v7:
https://github.com/LiosK/uuidv7 (more features, slightly bigger bundle size)
https://github.com/kripod/uuidv7 (minimalistic, small bundle size)

Also, there are multiple Postgres add-ons:
https://github.com/craigpastro/pg_uuidv7 (Rust)
https://github.com/fboulnois/pg_uuidv7 (C)

@fabiolimace
Copy link

fabiolimace commented May 11, 2024

You all probably already know, but just in case, RFC 9562 was published a few days ago (May 7, 2024).

https://www.rfc-editor.org/rfc/rfc9562
https://datatracker.ietf.org/doc/rfc9562

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale-exempt Exempts issue from being marked as stale
Projects
None yet
Development

No branches or pull requests

8 participants