Packages

  • package root
    Definition Classes
    root
  • package wvlet
    Definition Classes
    root
  • package airframe
    Definition Classes
    wvlet
  • package ulid
    Definition Classes
    airframe
  • object ULID

    ULID generator implementation based on https://github.com/petitviolet/ulid4s

    ULID generator implementation based on https://github.com/petitviolet/ulid4s

    ULID has 128 bit value: |-- Unix timestamp milliseconds (48-bit) ---- | ----- random value (80 bits) ------ |

    The string representation of ULID uses 26 characters in Crockford Base 32 representation, each character of which represents 5-bit value (0-31).

    Definition Classes
    ulid
  • ULIDGenerator
c

wvlet.airframe.ulid.ULID

ULIDGenerator

class ULIDGenerator extends AnyRef

ULID generator.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ULIDGenerator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ULIDGenerator(random: () ⇒ Array[Byte])

    random

    a function that returns a 80-bit random values in Array[Byte] (size:10)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def newULID: ULID
  13. def newULIDFromMillis(unixTimeMillis: Long): String
  14. def newULIDString: String

    Generate a new ULID string.

    Generate a new ULID string.

    Tips for optimizing performance:

    1. Reduce the number of Random number generation. SecureRandom is quite slow, so within the same milliseconds, just incrementing the randomness part will provide better performance. 2. Generate random in Array[Byte] (10 bytes = 80 bits). Regular Random uses 48-bit seed, so calling Random.nextInt (32 bits) x 3 is faster, but SecureRandom has optimization for Array[Byte] generation, which is much faster than calling nextInt three times. 3. ULIDs are often used in the string value form (e.g., transaction IDs, object IDs which can be embedded to URLs, etc.). Generating ULID String from the beginning is ideal. 4. In base32 encoding/decoding, use bit-shift operators as much as possible to utilize CPU registers and memory cache.
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  18. def toString(): String
    Definition Classes
    AnyRef → Any
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped