Specifying Id Structure

An id occupies 64-bits and is composed of:

The number of bits devoted to each of the parameters and the epoch is defined by a Scheme. Various parts of the library require a scheme and it is convenient to define one implicitly.

import gr.jkl.uid.Scheme

val scheme = Scheme(
  timestampBits = 44, 
  nodeBits      = 12, 
  sequenceBits  = 8,
  epoch         = 1351728000000L)

scheme.maxTimestamp 
// res0: Long = 18943914044415

scheme.maxNode 
// res1: Long = 4095

scheme.maxSequence 
// res2: Long = 255
Fork me on GitHub