package uid

uid is a library for the generation and handling of unique 64-bit Ids.

Each Id encodes a timestamp, a node and a sequence. Specific implementations are achieved by defining a Scheme. Id creation is handled by a Generator.

  1. // Define an implicit Scheme
    implicit val idScheme = Scheme(42, 12, 10 , 1351728000000L)
    // Construct a Generator for the node 0
    val idGenerator = Generator(0L)
    // Get a new unique Id
    val id = idGenerator.newId
Linear Supertypes
AnyRef, Any
  1. Alphabetic
  2. By inheritance
  1. uid
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
  1. Public
  2. All

Type Members

  1. trait Generator extends AnyRef

    Generates Ids based on a Scheme for a specific node.

  2. case class GeneratorException(message: String) extends RuntimeException with Product with Serializable

    Generator exception.

  3. final class Id extends AnyVal

    Value class of 64-bit Ids with underlying type of Long.

  4. final case class Scheme(timestampBits: Long, nodeBits: Long, sequenceBits: Long, epoch: Long) extends Product with Serializable

    Specification of an Id implementation.

Value Members

  1. object Generator

    Factory for Generator instances.

  2. object Id

    Factory methods, extractors and Orderings.

Inherited from AnyRef

Inherited from Any