5 ms·
What do you consider the purpose of a UUID?
by n42 2y ago
What do you consider the purpose of a UUID?
- sedatk 2y agoAsynchronous unique ID generation.
- HexDecOctBin 2y agoYou can have both asynchrony and sequence by encoding thread ID in the UUID too, and make the sequence a thread local state.
- maxbond 2y agoMongoDB uses a similar approach. https://www.mongodb.com/docs/manual/reference/method/ObjectId/ https://www.mongodb.com/docs/manual/reference/method/ObjectI...
- sedatk 2y agoThen, just use thread ID and integer sequence pairs instead of trying to stuff them into an arbitrary binary format.
- HexDecOctBin 2y agoThread IDs get repeated across reboots. Integer sequence may also repeat in a distributed scenario, unless you want a massive bottleneck. You do need other stuff (timestamps, random number, etc.).
- sedatk 2y agoYes, but that’s what parent proposed? :shrug: