However, if you want completely lossless (and therefore reversible) conversion, then this is at least one possible solution. Convert 12-digit hexadecimal MAC address for VTAM / NCP definitions that connects Ethernet and Token Ring networks using MAC address converter online. Of course, the semantics are somewhat altered if you place those last 3 bits in UUID's time field, so this may not be desirable in all circumstances. So there's actually 7 (least significant) bits free in the timestamp, so the remaining 3 bits can be placed there. MongoDB's timestamp only has a resolution of a second, where as UUID v1 has a resolution of 100 nanoseconds. We still have 7 most significant bits of the node field, so we can place 7 bits there. We need to find space for 10 additional bits in our UUID, we've just consumed 1 additional bit above (Multicast bit). It's only omitted as a result of the chosen implementation. There's room to insert an additional 4 bits of the timestamp without any black magic, fits right in the field. However, that does assume that the driver is simply incrementing this number, if it's not you may run into issues sooner. Most implementations simply increment, so in that case you'd need to have inserted more than 16,384 MongoDB documents in a second to run into a collision. This depends on how your MongoDB driver is using the "counter" field within MongoDB. The RFC indicates that when node is not a MAC address, that the multicast bit must be set Issue 3 In practice this isn't going to be problem unless you're creating objects with a computer that has its system clock set to greater than 2491 AD, so I think it's reasonable enough to ignore that for now.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |