Sign inSign up

ecarpo/snowflake

By ecarpo

Updated about 6 years ago

Python based snowflake id generator.

Image
0

1.6K

ecarpo/snowflake repository overview

pysnowflake

https://github.com/koblas/pysnowflake

Concepts

Snowflake generates unique int64 ids that (unlike uuids) are loosely time sorted. Each id consists of:

BitsFieldNotes
41Timestamp in MS~70yrs
5Datacenter ID0~31, default 0
5Worker ID0~31, default 0
13Sequence IDsequence to disambiguate requests in the same ms

Run

docker run -d -p 9000:9000 ecarpo/snowflake

use DATACENTER_ID & WORKER_ID environment.

docker run -d -p 9000:9000 -e DATACENTER_ID=1 -e WORKER_ID=1 ecarpo/snowflake

API (aka URLs):

/id/<USERAGENT>    -- get a unique ID, <USERAGENT> is provided for metrics purposes
/timestamp/        -- get the current timestamp for this host
/datacenter/       -- get the data center identifier for this process
/worker/           -- get the data center identifier for this process

Tag summary

Content type

Image

Digest

Size

330.7 MB

Last updated

about 6 years ago

docker pull ecarpo/snowflake