Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact


Moderators: larsivi kris

Posted: 03/14/07 18:00:49

I've been implementing a cross platform UUID type/generators according to RFC 4122. Is anyone doing something similar for a future release of tango?

PS. Sorry if it's the wrong NG for the question.

Author Message

Posted: 03/15/07 05:39:10

I don't know of one being written at this time; sounds like something useful

- Arrr! We'll all be walkin' the Plank! -

Posted: 03/15/07 11:28:25

The type with conversion functions and version 3-5 generators are done. I hope to come up with some code by the end of the week.

Posted: 01/29/08 08:29:55

Did you ever finish the implementation?

Posted: 01/29/08 09:45:30

Work in progress. There will be a notification when it's done.

Posted: 02/17/08 07:18:03

Yay \o/

Posted: 03/26/08 07:13:07

The implementation is almost complete. Works on Windows and linux and may work on FreeBSD and Mac OS

The time-based generator is pretty close to what I've expected. It is compliant with the standard and not much slower than linux's libuuid. I couldn't figure out (and don't care, honestly) how Windows time-based gen happens to be faster than the time itself. Their gen seems to generate more than 10 million UUIDs per second while the standard requires there is no more than 1 uuid per 100 ns. Anyway, imo, the time-based implementation is too heavy for the library because it relies on interprocess communication functionality in the ipc package. I think, the UUID structure itself, an interface to the gen provided by the platform, name-based gen and random gen will suffice. I propose for inclusion under a uuid package:

Uuid.d - the UUID struct with utility functions.

NativeUuidGen?.d - calls platform's UUID gen (requires additional libs - libuuid.a/rpcrt4.lib). Could be merged into Uuid.d

NameUuidGen?.d - for hashing arbitrary stuff into UUIDs. Uses SHA1 and MD5 packages.

RandomUuidGen?.d - fast and silly gen using a randomizer.

The Uuid part in gen names may be omitted because it's a sore. Give your comments please.

Posted: 03/26/08 15:32:11

I can imagine applications where people would want the UUID struct just to convert a UUID string to the structure and vice versa. It would be unfair to make them link in the additional libraries. Thus, the Uuid.d and NativeUuidGen?.d should be separate modules.