I have the following problem. I assign to an开发者_Python百科y object in my database a UUID. When I get a UUID from any source, to obtain the object I need to know what type of object is, so I can query the correct table in the database. As far as I understand, UUID version 5 supports namespacing, but I am not sure I clearly understand its meaning.
Is it possible to associate to a UUID information about the namespace it belongs, so to recover it later ?
Is it possible to associate to a UUID information about the namespace it belongs,
Yes, see this document.
so to recover it later
Maybe. The problem is that two different namespaces may map to the same hash value. To avoid this, you should manually number your names (instead of hashing them). Then put the number into the octets 0-3. That gives you a deterministic mapping between UUIDs and names.
精彩评论