View Source Uniq.Generator (Uniq v0.5.2)

This module is used to interact with the global state needed to correctly generate version 1 and version 6 UUIDs.

This state consists of two atomic values: the last timestamp at which a UUID was generated; and the current clock sequence value.

On init, the clock sequence is seeded with a random value provided by interpreting bits from the cryptographic random number generator as an unsigned 14 bit integer.

On subsequent generations, the clock sequence is incremented by 1 if a UUID has already been generated with the same last timestamp. If the timestamp has changed, the clock sequence remains unchanged.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Generates the next initial state for UUID creation.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for GenServer.init/1.

Generates the next initial state for UUID creation.