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

UUID should support to and from standard uuid formats. #680

Open
kelvinhammond opened this issue Mar 17, 2022 · 9 comments
Open

UUID should support to and from standard uuid formats. #680

kelvinhammond opened this issue Mar 17, 2022 · 9 comments
Assignees
Milestone

Comments

@kelvinhammond
Copy link
Contributor

kelvinhammond commented Mar 17, 2022

The UUID format should support converting to and from the standard display format(s).
See https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

https://github.com/openzim/libzim/blob/master/src/uuid.cpp

Currently there is not a good way to display the UUID to the user or application and then load that UUID back to a zim::UUID

@kelson42
Copy link
Contributor

I agree with this request, this one I made more than 10 years ago and I still think this would be handy... at least the one to get a printable string.

@mgautierfr
Copy link
Collaborator

Despite its name, zim's uuid is only a unique id stored in 128 bits, it is not a standard UUID (which is also a unique id stored in 128 bits, but with more constraints)
None of the zim's uuid generated by libzim are valid standard UUID.

But anyway, there is already a (two) way(s) to convert a uuid to "standard" formats 8-4-4-4-12 (https://github.com/openzim/libzim/blob/master/src/uuid.cpp#L86-L110)
The operator << to print a UUID into a stream and the string operator to convert a UUID to a string.

UUID can also be constructed from raw binary data (which is not a standard representation). We could indeed add a constructor from a textual representation 8-4-4-4-12 to help manipulation of the uuid.

@kelson42
Copy link
Contributor

@kelvinhammond Good enough?

@kelvinhammond
Copy link
Contributor Author

I'll bind this to nodejs as is and whatever library wants to use setUuid will have to figure out which chars to send. This should suffice.

@kelson42
Copy link
Contributor

@mgautierfr Would that be a good id that in the future we allow only proper uuids?

@mgautierfr
Copy link
Collaborator

I don't see the added value to this. We would need to depend on a uuid library to generate the uuid (or check it is a valid one) and it would be useless (old zim files would still have invalid uuid so we couldn't convert zim uuid to standard UUID)

@kelson42
Copy link
Contributor

kelson42 commented May 26, 2022

@mgautierfr The README.md states that we already depends of libuuid? Is that true? I don’t see any trace of a check in the Meson configuration file!

@mgautierfr
Copy link
Collaborator

It is false. We don't use libuuid.

@kelson42
Copy link
Contributor

@kelvinhammond It seems we have a way in the libzim to print the UUID. Does the answer of @mgautierfr is satisfying to you?

@kelson42 kelson42 modified the milestones: 8.2.0, 8.3.0 Mar 18, 2023
@kelson42 kelson42 modified the milestones: 9.0.0, 9.1.0 Sep 26, 2023
@kelson42 kelson42 modified the milestones: 9.1.0, 10.0.0 Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants