gpt4 book ai didi

uuid - "clock sequence"是什么意思?

转载 作者:行者123 更新时间:2023-12-03 23:19:22 26 4
gpt4 key购买 nike

RFC 4122(通用唯一标识符 (UUID) URN 命名空间)使用术语“clock sequence”:

4.1.5. Clock Sequence

For UUID version 1, the clock sequence is used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes.

If the clock is set backwards, or might have been set backwards (e.g., while the system was powered off), and the UUID generator can not be sure that no UUIDs were generated with timestamps larger than the value to which the clock was set, then the clock sequence has to be changed. If the previous value of the clock sequence is known, it can just be incremented; otherwise it should be set to a random or high-quality pseudo-random value.

Similarly, if the node ID changes (e.g., because a network card has been moved between machines), setting the clock sequence to a random number minimizes the probability of a duplicate due to slight differences in the clock settings of the machines. If the value of clock sequence associated with the changed node ID were known, then the clock sequence could just be incremented, but that is unlikely.

The clock sequence MUST be originally (i.e., once in the lifetime of a system) initialized to a random number to minimize the correlation across systems. This provides maximum protection against node identifiers that may move or switch from system to system rapidly. The initial value MUST NOT be correlated to the node identifier.

For UUID version 3 or 5, the clock sequence is a 14-bit value constructed from a name as described in Section 4.3.

For UUID version 4, clock sequence is a randomly or pseudo-randomly generated 14-bit value as described in Section 4.4.



这个词是什么意思?

最佳答案

“时钟序列”似乎是一个非常具有误导性的名称。根据其定义,更好的名称可能是“uuid 的随机组件”。

uuid 的一大名声是,如果我们都生成一个 UUID 值,我们可以非常确信我们不会生成相同的 128 位值。这说明了碰撞的可能性。

如果我们有一个共同的协调者或一个预先商定的方案,我们也可以确信我们不会遇到冲突。

潜在方案:

1. Partition Int Space: I get numbers 1-999, you get 1000-1999.
2. Request Reservation: Request 10 numbers and increment a centrally stored max reserved numbers. You get numbers 1-10. The next reservation gets 11-20.

重要的 UUID 观察是,如果您有相当多的位(在本例中为 16),下一个请求者获得相同随机值的可能性很小。

彩票就是基于这个概念。

关于uuid - "clock sequence"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41475842/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com