Skip to content

Distributed ID generation *in Clojure* for the lazy

License

Notifications You must be signed in to change notification settings

curiosity/clj-simpleflake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clj-simpleflake

This is an implementation of Simpleflake[http://engineering.custommade.com/simpleflake-distributed-id-generation-for-the-lazy/], a Snowflake-compatible (time-ordered) 64-bit id generator written in Clojure. Simpleflakes provide 41 bits of milliseconds since Jan 1, 2010 UTC and 23 bits of randomness.

The reference Python implementation is located at https://github.com/SawdustSoftware/simpleflake.

Installation

Add [clj-simpleflake "0.1.0"] to your project.clj.

Usage

(require 'clj-simpleflake.core)
(clj-simpleflake.core/simpleflake)

You could use clj-simpleflake.core/extract-bits to grab the timestamp or the random bits, but no utility is provided (you have to convert the ms since Jan 1, 2010 timestamp to something else yourself). Pull requests welcome.

License

Copyright © 2015 Beacon Solutions Inc. info@curiosity.com

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. This is the same license as Clojure itself.

About

Distributed ID generation *in Clojure* for the lazy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published