Skip to content

lazada/luigi

Repository files navigation

Luigi

Lazada unique identifier generator

Luigi

Algorithm:

  1. NodeID = ((HostID << PIDLengthInBits) | PID) << counterLengthInBits

  2. Timestamp = Now() - ToTimestamp(20.02.2016, 14:23:57)

  3. UniqueID = Timestamp | NodeID | Counter

Counter - increment atomic counter less than predefined defaultSequenceBits const

Luigi provides 3 basic methods for IDs generate:

  • Generate() - single value
  • GenerateSlice(n) - slice of UIDs with n values
  • FillChannelFillChannel(ch chan<- *big.Int) chan error - continuously fill ch channel with UIDs

Luigi can generate UIDs of 3 types: uint64(supports millisecond timestamp), string and BigInt(supports nanosecond timestamp)

Luigi loves you!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published