64-bits Unique ID generator for Node.js written in C++
64-bits unique ID generator for Node.js written in C++.
This is an experimental module. We strongly discourage you to use it production for the moment since we don't have tested it enough.
Despite, if you want to use and contribute to this module, your help is welcome!
This module requires OS X 10.7 (or later) and Xcode 4.5 (or later) to be built.
Linux support is plan to be added in a near future.
npm install flocon --save
var flocon = ;var id = flocon;
Returns a Snowflake-inspired 64-bit IDs String object constructed using:
|Time (milliseconds)||41 bits||Time elapsed since epoch, hardcoded to January 1st, 2013.|
|Process ID||10 bits||
Process ID that is generating the 64-bits ID.
Can handle up to 1024 different process ID.
Incremental value starting from 0 and re initialised every ms.
Can generate 8192 per process per ms.
npm test or check inside bench for more tests.
The MIT License (MIT)
Copyright (c) 2013 Yosee <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.