Skip to content

DbIdMaker generates pseudo unique 63 bits ids. It can be used for generating database ids for entities as replace of auto increment keys. It useful in distributed environment, where it is hard to handle numeric sequence.

License

Notifications You must be signed in to change notification settings

rosolovskiy/dbidmaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbidmaker

DbIdMaker generates pseudo unique 63 bits ids. It can be used for generating database ids for entities as replace of auto increment keys. It useful in distributed environment, where it is hard to handle numeric sequence. Inspired by MongoDB ObjectID format and Twitter snowflake service.

63 bit Id consist of:

  1. timestemp in milliseconds, 41 bits
  2. machine id, 10 bits (by default: a part of last octects of machine mac address)
  3. sequence, 12bits (sequence number by modulo 2^12, allows given machine per each millisecond of time to have 4096 unique ids)

© Licensed under the Apache License, Version 2.0

About

DbIdMaker generates pseudo unique 63 bits ids. It can be used for generating database ids for entities as replace of auto increment keys. It useful in distributed environment, where it is hard to handle numeric sequence.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages