shard-uuid

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i shard-uuid

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nanom1t