Skip to content

Compact 64-bit UUID generator for database logical shards.

License

Notifications You must be signed in to change notification settings

nanom1t/shard-uuid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShardUUID

Compact 64-bit UUID generator for database logical shards.

NPM Version Node.js Version NPM Downloads

Each UUID consists of:

  • 32 bits for time in seconds (gives 136 years of IDs from start of epoch 2017-01-01 00:00:00);
  • 22 bits that represent the logical shard ID;
  • 10 bits that represent an auto-incrementing sequence (modulus 1024).

Installation

$ npm install --save shard-uuid

Usage

const shardUUID = require('shard-uuid');

shardUUID.getUUID(65536, 1023, false).then((uuid) => {
    console.log(uuid);
}).catch((err) => {});

License: MIT

About

Compact 64-bit UUID generator for database logical shards.

Resources

License

Stars

Watchers

Forks

Packages

No packages published