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

refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 #611

Merged
merged 22 commits into from Sep 1, 2022

Conversation

rrichardson
Copy link
Contributor

@rrichardson rrichardson commented Aug 17, 2022

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

@robjtede
Copy link

robjtede commented Aug 17, 2022

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 edition = 2021. It hurts compatibility for folks on earlier compilers/editions far more than it helps maintainability (compared to 2015->2018 shift).

@rrichardson
Copy link
Contributor Author

@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?

@mqudsi
Copy link

mqudsi commented Aug 17, 2022

The msrv for edition 2021 is 1.56.0; main is still targeting an msrv of 1.46.0.

Copy link
Member

@KodrAus KodrAus left a 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:

  1. Interpret the subseconds field as a counter in v1/v6 UUIDs and as extra precision in v7/v8
  2. 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.

src/v1.rs Outdated Show resolved Hide resolved
src/timestamp.rs Show resolved Hide resolved
@rrichardson
Copy link
Contributor Author

@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.

@KodrAus
Copy link
Member

KodrAus commented Aug 22, 2022

@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.

@rrichardson
Copy link
Contributor Author

@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)

@rrichardson
Copy link
Contributor Author

All checks have passed! 🎊 🍾

Copy link
Member

@KodrAus KodrAus left a 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.

src/builder.rs Outdated Show resolved Hide resolved
src/timestamp.rs Outdated Show resolved Hide resolved
src/v6.rs Outdated Show resolved Hide resolved
src/v7.rs Outdated Show resolved Hide resolved
rrichardson and others added 4 commits August 31, 2022 11:32
Co-authored-by: Aron Heinecke <Ox0p54r36@t-online.de>
Co-authored-by: Aron Heinecke <Ox0p54r36@t-online.de>
@rrichardson
Copy link
Contributor Author

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

@KodrAus
Copy link
Member

KodrAus commented Sep 1, 2022

Thanks for working through this @rrichardson! This is an amazing effort 🙇

@KodrAus KodrAus merged commit b6d892b into uuid-rs:main Sep 1, 2022
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Oct 13, 2022
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 [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#636
-   Prepare for 1.2.1 release by [@&#8203;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 [@&#8203;pintariching](https://github.com/pintariching) in uuid-rs/uuid#610
-   Remove outdated Travis CI reference by [@&#8203;atouchet](https://github.com/atouchet) in uuid-rs/uuid#616
-   refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 by [@&#8203;rrichardson](https://github.com/rrichardson) in uuid-rs/uuid#611
-   migrate from winapi to windows_sys in examples by [@&#8203;sn99](https://github.com/sn99) in uuid-rs/uuid#626
-   Update windows-sys requirement from 0.36.1 to 0.42.0 by [@&#8203;dependabot](https://github.com/dependabot) in uuid-rs/uuid#628
-   Some work on the new version features by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#625
-   Implement now in wasm by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#630
-   More work on docs by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#631
-   hide draft versions behind the unstable cfg by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#633
-   Prepare for 1.2.0 release by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#634

#### New Contributors

-   [@&#8203;pintariching](https://github.com/pintariching) made their first contribution in uuid-rs/uuid#610
-   [@&#8203;atouchet](https://github.com/atouchet) made their first contribution in uuid-rs/uuid#616
-   [@&#8203;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 <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1578
Reviewed-by: crapStone <crapstone@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
kjuulh added a commit to kjuulh/octopush that referenced this pull request Nov 27, 2022
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#&#8203;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#&#8203;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#&#8203;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#&#8203;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#&#8203;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#&#8203;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#&#8203;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#&#8203;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#&#8203;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 [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#640
-   Remove extern crate alloc by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#645
-   Prepare for 1.2.2 release by [@&#8203;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 [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#636
-   Prepare for 1.2.1 release by [@&#8203;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 [@&#8203;pintariching](https://github.com/pintariching) in uuid-rs/uuid#610
-   Remove outdated Travis CI reference by [@&#8203;atouchet](https://github.com/atouchet) in uuid-rs/uuid#616
-   refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 by [@&#8203;rrichardson](https://github.com/rrichardson) in uuid-rs/uuid#611
-   migrate from winapi to windows_sys in examples by [@&#8203;sn99](https://github.com/sn99) in uuid-rs/uuid#626
-   Update windows-sys requirement from 0.36.1 to 0.42.0 by [@&#8203;dependabot](https://github.com/dependabot) in uuid-rs/uuid#628
-   Some work on the new version features by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#625
-   Implement now in wasm by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#630
-   More work on docs by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#631
-   hide draft versions behind the unstable cfg by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#633
-   Prepare for 1.2.0 release by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#634

#### New Contributors

-   [@&#8203;pintariching](https://github.com/pintariching) made their first contribution in uuid-rs/uuid#610
-   [@&#8203;atouchet](https://github.com/atouchet) made their first contribution in uuid-rs/uuid#616
-   [@&#8203;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 [@&#8203;mbrobbel](https://github.com/mbrobbel) in uuid-rs/uuid#606
-   Prepare for 1.1.2 release by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#607

#### New Contributors

-   [@&#8203;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 [@&#8203;nstinus](https://github.com/nstinus) in uuid-rs/uuid#603
-   Prepare for 1.1.1 release by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#604

#### New Contributors

-   [@&#8203;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 [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#597
-   Fixed documentation link by [@&#8203;Razican](https://github.com/Razican) in uuid-rs/uuid#600
-   Add to_bytes_le method by [@&#8203;dfaust](https://github.com/dfaust) in uuid-rs/uuid#599
-   Prepare for 1.1.0 release by [@&#8203;KodrAus](https://github.com/KodrAus) in uuid-rs/uuid#602

#### New Contributors

-   [@&#8203;Razican](https://github.com/Razican) made their first contribution in uuid-rs/uuid#600
-   [@&#8203;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
bors bot pushed a commit to stackabletech/secret-operator that referenced this pull request Dec 5, 2022
[![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 [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#640
-   Remove extern crate alloc by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#645
-   Prepare for 1.2.2 release by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#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 [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#636
-   Prepare for 1.2.1 release by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#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 [@&#8203;pintariching](https://togithub.com/pintariching) in [uuid-rs/uuid#610
-   Remove outdated Travis CI reference by [@&#8203;atouchet](https://togithub.com/atouchet) in [uuid-rs/uuid#616
-   refactors Timestamp, Context and ClockSequence, and adds UUIDS v6, v7, v8 by [@&#8203;rrichardson](https://togithub.com/rrichardson) in [uuid-rs/uuid#611
-   migrate from winapi to windows_sys in examples by [@&#8203;sn99](https://togithub.com/sn99) in [uuid-rs/uuid#626
-   Update windows-sys requirement from 0.36.1 to 0.42.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in [uuid-rs/uuid#628
-   Some work on the new version features by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#625
-   Implement now in wasm by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#630
-   More work on docs by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#631
-   hide draft versions behind the unstable cfg by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#633
-   Prepare for 1.2.0 release by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [uuid-rs/uuid#634

#### New Contributors

-   [@&#8203;pintariching](https://togithub.com/pintariching) made their first contribution in [uuid-rs/uuid#610
-   [@&#8203;atouchet](https://togithub.com/atouchet) made their first contribution in [uuid-rs/uuid#616
-   [@&#8203;sn99](https://togithub.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 - "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==-->
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.

None yet

5 participants