-
Notifications
You must be signed in to change notification settings - Fork 191
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
refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 #611
Conversation
Just want to say from a lib maintainer's perspective, there's basically no good reason that such a widely used crate should need to get bumped to |
@robjtede - Thanks for the input. The shift to 2021 really wasn't much more than changing the value in the Cargo.toml. What about it hurts compatibility? |
The msrv for edition 2021 is 1.56.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @rrichardson! 🙇
We can't make breaking changes to UUID's API now that it's stable, so I think our best option with the timestamp is to either:
- Interpret the subseconds field as a counter in v1/v6 UUIDs and as extra precision in v7/v8
- Make the timestamp an enum that's either a v1/v6 or v7/v8 timestamp.
Neither of these are as ideal as your refactoring, but I think we need to work within the API we've got.
@KodrAus - Do you know any ways that we can work around the fact that 2 of the CI jobs fail when running the powerset of features (runs the container out of space) I'm not a Github Actions wizard. It seems 15 features pushes it over the failing point. |
@rrichardson I'll send a PR through that rejigs that part of CI a bit. The main thing we want to ensure is that each feature works independently, and that they all work together. I'll give you a ping when that's up. |
@KodrAus - Ok.. This should be compatible with the original API. Note, this API requires some silly hoop-jumping for any versions that use a timestamp but not a counter (e.g. v7 https://github.com/rrichardson/uuid/blob/six-seven-eight/src/v7.rs#L53-L61) |
13f785d
to
a2b1258
Compare
All checks have passed! 🎊 🍾 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome work! Thanks for putting it together, and for sticking through our current API constraints 🙇 I just had a few minor comments.
Co-authored-by: Aron Heinecke <[email protected]>
Co-authored-by: Aron Heinecke <[email protected]>
…cking the version to 1.1.3 for now
BTW: Arbitrary just bumped their patch version which added the use of array::from_fn which was just stabilized in Rust 1.63. So some of the CI jobs failed because of this. I've locked Arbitrary to the prior version (1.1.3) until we can bump all CI workers to 1.63 |
Thanks for working through this @rrichardson! This is an amazing effort 🙇 |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://github.com/uuid-rs/uuid) | dependencies | minor | `1.1.2` -> `1.2.1` | --- ### Release Notes <details> <summary>uuid-rs/uuid</summary> ### [`v1.2.1`](https://github.com/uuid-rs/uuid/releases/tag/1.2.1) [Compare Source](uuid-rs/uuid@1.2.0...1.2.1) #### What's Changed - Fix up lost re-export of v1 Timestamp by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#636 - Prepare for 1.2.1 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#637 **Full Changelog**: uuid-rs/uuid@1.2.0...1.2.1 ### [`v1.2.0`](https://github.com/uuid-rs/uuid/releases/tag/1.2.0) [Compare Source](uuid-rs/uuid@1.1.2...1.2.0) #### What's Changed - formatting changes by [@​pintariching](https://github.com/pintariching) in uuid-rs/uuid#610 - Remove outdated Travis CI reference by [@​atouchet](https://github.com/atouchet) in uuid-rs/uuid#616 - refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 by [@​rrichardson](https://github.com/rrichardson) in uuid-rs/uuid#611 - migrate from winapi to windows_sys in examples by [@​sn99](https://github.com/sn99) in uuid-rs/uuid#626 - Update windows-sys requirement from 0.36.1 to 0.42.0 by [@​dependabot](https://github.com/dependabot) in uuid-rs/uuid#628 - Some work on the new version features by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#625 - Implement now in wasm by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#630 - More work on docs by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#631 - hide draft versions behind the unstable cfg by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#633 - Prepare for 1.2.0 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#634 #### New Contributors - [@​pintariching](https://github.com/pintariching) made their first contribution in uuid-rs/uuid#610 - [@​atouchet](https://github.com/atouchet) made their first contribution in uuid-rs/uuid#616 - [@​sn99](https://github.com/sn99) made their first contribution in uuid-rs/uuid#626 **Full Changelog**: uuid-rs/uuid@1.1.2...1.2.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMjQuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIyNC4wIn0=--> Co-authored-by: cabr2-bot <[email protected]> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1578 Reviewed-by: crapStone <[email protected]> Co-authored-by: Calciumdibromid Bot <[email protected]> Co-committed-by: Calciumdibromid Bot <[email protected]>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [clap](https://github.com/clap-rs/clap) | dependencies | patch | `4.0.18` -> `4.0.27` | | [url](https://github.com/servo/rust-url) | dependencies | minor | `^2.2` -> `^2.3` | | [uuid](https://github.com/uuid-rs/uuid) | dependencies | minor | `^1.0` -> `^1.2` | --- ### Release Notes <details> <summary>clap-rs/clap</summary> ### [`v4.0.27`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4027---2022-11-24) [Compare Source](clap-rs/clap@v4.0.26...v4.0.27) ##### Features - Have `Arg::value_parser` accept `Vec<impl Into<PossibleValue>>` - Implement `Display` and `FromStr` for `ColorChoice` ##### Fixes - Remove soundness issue by switching from `atty` to `is-terminal` ### [`v4.0.26`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4026---2022-11-16) [Compare Source](clap-rs/clap@v4.0.25...v4.0.26) ##### Fixes - *(error)* Fix typos in `ContextKind::as_str` ### [`v4.0.25`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4025---2022-11-15) [Compare Source](clap-rs/clap@v4.0.24...v4.0.25) ##### Features - *(error)* Report available subcommands when required subcommand is missing ### [`v4.0.24`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4024---2022-11-14) [Compare Source](clap-rs/clap@v4.0.23...v4.0.24) ##### Fixes - Avoid panic when printing an argument that isn't built ### [`v4.0.23`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4023---2022-11-11) [Compare Source](clap-rs/clap@v4.0.22...v4.0.23) ##### Fixes - Don't panic on reporting invalid-long errors when followed by invalid UTF8 - *(help)* Clarified argument to `help` subcommand ### [`v4.0.22`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4022---2022-11-07) [Compare Source](clap-rs/clap@v4.0.21...v4.0.22) ##### Fixes - *(help)* Don't overflow into next-line-help early due to stale (pre-v4) padding calculations ### [`v4.0.21`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4021---2022-11-07) [Compare Source](clap-rs/clap@v4.0.20...v4.0.21) ##### Features - *(derive)* `long_about` and `long_help` attributes, without a value, force using doc comment (before it wouldn't be set if there wasn't anything different than the short help) ### [`v4.0.20`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4020---2022-11-07) [Compare Source](clap-rs/clap@v4.0.19...v4.0.20) ##### Fixes - *(derive)* Allow defaulted value parser for '()' fields ### [`v4.0.19`](https://github.com/clap-rs/clap/blob/HEAD/CHANGELOG.md#​4019---2022-11-04) [Compare Source](clap-rs/clap@v4.0.18...v4.0.19) ##### Features - `ColorChoice` now implements `ValueEnum` </details> <details> <summary>servo/rust-url</summary> ### [`v2.3.1`](servo/rust-url@v2.3.0...v2.3.1) [Compare Source](servo/rust-url@v2.3.0...v2.3.1) ### [`v2.3.0`](servo/rust-url@v2.2.2...v2.3.0) [Compare Source](servo/rust-url@v2.2.2...v2.3.0) ### [`v2.2.2`](servo/rust-url@v2.2.1...v2.2.2) [Compare Source](servo/rust-url@v2.2.1...v2.2.2) ### [`v2.2.1`](servo/rust-url@v2.2.0...v2.2.1) [Compare Source](servo/rust-url@v2.2.0...v2.2.1) </details> <details> <summary>uuid-rs/uuid</summary> ### [`v1.2.2`](https://github.com/uuid-rs/uuid/releases/tag/1.2.2) [Compare Source](uuid-rs/uuid@1.2.1...1.2.2) #### What's Changed - CI Cleanups by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#640 - Remove extern crate alloc by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#645 - Prepare for 1.2.2 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#646 **Full Changelog**: uuid-rs/uuid@1.2.1...1.2.2 ### [`v1.2.1`](https://github.com/uuid-rs/uuid/releases/tag/1.2.1) [Compare Source](uuid-rs/uuid@1.2.0...1.2.1) #### What's Changed - Fix up lost re-export of v1 Timestamp by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#636 - Prepare for 1.2.1 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#637 **Full Changelog**: uuid-rs/uuid@1.2.0...1.2.1 ### [`v1.2.0`](https://github.com/uuid-rs/uuid/releases/tag/1.2.0) [Compare Source](uuid-rs/uuid@1.1.2...1.2.0) #### What's Changed - formatting changes by [@​pintariching](https://github.com/pintariching) in uuid-rs/uuid#610 - Remove outdated Travis CI reference by [@​atouchet](https://github.com/atouchet) in uuid-rs/uuid#616 - refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 by [@​rrichardson](https://github.com/rrichardson) in uuid-rs/uuid#611 - migrate from winapi to windows_sys in examples by [@​sn99](https://github.com/sn99) in uuid-rs/uuid#626 - Update windows-sys requirement from 0.36.1 to 0.42.0 by [@​dependabot](https://github.com/dependabot) in uuid-rs/uuid#628 - Some work on the new version features by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#625 - Implement now in wasm by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#630 - More work on docs by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#631 - hide draft versions behind the unstable cfg by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#633 - Prepare for 1.2.0 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#634 #### New Contributors - [@​pintariching](https://github.com/pintariching) made their first contribution in uuid-rs/uuid#610 - [@​atouchet](https://github.com/atouchet) made their first contribution in uuid-rs/uuid#616 - [@​sn99](https://github.com/sn99) made their first contribution in uuid-rs/uuid#626 **Full Changelog**: uuid-rs/uuid@1.1.2...1.2.0 ### [`v1.1.2`](https://github.com/uuid-rs/uuid/releases/tag/1.1.2) [Compare Source](uuid-rs/uuid@1.1.1...1.1.2) #### What's Changed - Fix some doc links by [@​mbrobbel](https://github.com/mbrobbel) in uuid-rs/uuid#606 - Prepare for 1.1.2 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#607 #### New Contributors - [@​mbrobbel](https://github.com/mbrobbel) made their first contribution in uuid-rs/uuid#606 **Full Changelog**: uuid-rs/uuid@1.1.1...1.1.2 ### [`v1.1.1`](https://github.com/uuid-rs/uuid/releases/tag/1.1.1) [Compare Source](uuid-rs/uuid@1.1.0...1.1.1) #### What's Changed - Fix documentation typo by [@​nstinus](https://github.com/nstinus) in uuid-rs/uuid#603 - Prepare for 1.1.1 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#604 #### New Contributors - [@​nstinus](https://github.com/nstinus) made their first contribution in uuid-rs/uuid#603 **Full Changelog**: uuid-rs/uuid@1.1.0...1.1.1 ### [`v1.1.0`](https://github.com/uuid-rs/uuid/releases/tag/1.1.0) [Compare Source](uuid-rs/uuid@1.0.0...1.1.0) #### What's Changed - note that the Error display impl is public API by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#597 - Fixed documentation link by [@​Razican](https://github.com/Razican) in uuid-rs/uuid#600 - Add to_bytes_le method by [@​dfaust](https://github.com/dfaust) in uuid-rs/uuid#599 - Prepare for 1.1.0 release by [@​KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#602 #### New Contributors - [@​Razican](https://github.com/Razican) made their first contribution in uuid-rs/uuid#600 - [@​dfaust](https://github.com/dfaust) made their first contribution in uuid-rs/uuid#599 **Full Changelog**: uuid-rs/uuid@1.0.0...1.1.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yMy4xIiwidXBkYXRlZEluVmVyIjoiMzQuMjMuMSJ9--> Reviewed-on: https://git.front.kjuulh.io/kjuulh/octopush/pulls/39
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://togithub.com/uuid-rs/uuid) | dependencies | minor | `1.1.2` -> `1.2.2` | --- ### Release Notes <details> <summary>uuid-rs/uuid</summary> ### [`v1.2.2`](https://togithub.com/uuid-rs/uuid/releases/tag/1.2.2) [Compare Source](https://togithub.com/uuid-rs/uuid/compare/1.2.1...1.2.2) #### What's Changed - CI Cleanups by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/640](https://togithub.com/uuid-rs/uuid/pull/640) - Remove extern crate alloc by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/645](https://togithub.com/uuid-rs/uuid/pull/645) - Prepare for 1.2.2 release by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/646](https://togithub.com/uuid-rs/uuid/pull/646) **Full Changelog**: uuid-rs/uuid@1.2.1...1.2.2 ### [`v1.2.1`](https://togithub.com/uuid-rs/uuid/releases/tag/1.2.1) [Compare Source](https://togithub.com/uuid-rs/uuid/compare/1.2.0...1.2.1) #### What's Changed - Fix up lost re-export of v1 Timestamp by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/636](https://togithub.com/uuid-rs/uuid/pull/636) - Prepare for 1.2.1 release by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/637](https://togithub.com/uuid-rs/uuid/pull/637) **Full Changelog**: uuid-rs/uuid@1.2.0...1.2.1 ### [`v1.2.0`](https://togithub.com/uuid-rs/uuid/releases/tag/1.2.0) [Compare Source](https://togithub.com/uuid-rs/uuid/compare/1.1.2...1.2.0) #### What's Changed - formatting changes by [@​pintariching](https://togithub.com/pintariching) in [https://github.com/uuid-rs/uuid/pull/610](https://togithub.com/uuid-rs/uuid/pull/610) - Remove outdated Travis CI reference by [@​atouchet](https://togithub.com/atouchet) in [https://github.com/uuid-rs/uuid/pull/616](https://togithub.com/uuid-rs/uuid/pull/616) - refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 by [@​rrichardson](https://togithub.com/rrichardson) in [https://github.com/uuid-rs/uuid/pull/611](https://togithub.com/uuid-rs/uuid/pull/611) - migrate from winapi to windows_sys in examples by [@​sn99](https://togithub.com/sn99) in [https://github.com/uuid-rs/uuid/pull/626](https://togithub.com/uuid-rs/uuid/pull/626) - Update windows-sys requirement from 0.36.1 to 0.42.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/uuid-rs/uuid/pull/628](https://togithub.com/uuid-rs/uuid/pull/628) - Some work on the new version features by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/625](https://togithub.com/uuid-rs/uuid/pull/625) - Implement now in wasm by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/630](https://togithub.com/uuid-rs/uuid/pull/630) - More work on docs by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/631](https://togithub.com/uuid-rs/uuid/pull/631) - hide draft versions behind the unstable cfg by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/633](https://togithub.com/uuid-rs/uuid/pull/633) - Prepare for 1.2.0 release by [@​KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/634](https://togithub.com/uuid-rs/uuid/pull/634) #### New Contributors - [@​pintariching](https://togithub.com/pintariching) made their first contribution in [https://github.com/uuid-rs/uuid/pull/610](https://togithub.com/uuid-rs/uuid/pull/610) - [@​atouchet](https://togithub.com/atouchet) made their first contribution in [https://github.com/uuid-rs/uuid/pull/616](https://togithub.com/uuid-rs/uuid/pull/616) - [@​sn99](https://togithub.com/sn99) made their first contribution in [https://github.com/uuid-rs/uuid/pull/626](https://togithub.com/uuid-rs/uuid/pull/626) **Full Changelog**: uuid-rs/uuid@1.1.2...1.2.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5:00 and before 6:00 every weekday" in timezone Europe/Berlin, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/stackabletech/secret-operator). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yNDEuMyIsInVwZGF0ZWRJblZlciI6IjM0LjIzLjEifQ==-->
I'm submitting a feature
Description
This addresses all requested features in #523
Adds v6, v7 and v8 features and modules.
It also adds a Timestamp::now() which does what you might expect and uses std::time::SystemTime.
I added some basic tests for each, but they could certainly use more tests and more eyes.
Breaking changes
This refactors Timestamp to make it more generally applicable to all (time based) UUIDs.
It also breaks context/sequence out of Timestamp, since that only applies to v1 and v6.
This changes the API for v1 and v6, to require a Context to be supplied at creation.
Updates the crate to Edition 2021
Dependency Changes
Removes a dependency on atomic and instead uses std::sync::atomic since it now supports the necessary types.
Related Issue(s)
#523