distributed-id-generator v0.5.2
System wide singleton distributed ID generator.
The library contains the following module groups :
- Hashing algorithms ( Base32, node-fe1-fpe )
- Checksum generation and validation ( Modified )
- ID Generation and validation logic.
- Guardstore implementation - Redis backend to ensure consistent distributed ID generation
Currently two types of IDs are supported, strictly numeric or base32 alpha-numeric ones.
Usage guidelines
To avoid id format errors and ensure consistency between system services all external usage of the library should be through the definitions found here, after configuring the guardstore.
Example :
const path = ; const DistributedIdGenerator = ; const idGenerator = DistributedIdGenerator;
Defining Ids :
const IdDefinition = ; // name, length including checksum, prefix, algorith either numeric or base32 moduleexports = 'account' 8 'acc' 'base32';
Definition that is based on another :
const accountIdDefinition = ; // this will produce ids that are : cus-XXXXXXXX-XXXXXXXX moduleexports = accountIdDefinition;