A distributed unique ID generator inspired by Twitter's Snowflake.
Project description
sonyflake-py
Sonyflake is a distributed unique ID generator inspired by Twitter's Snowflake.
This is a python rewrite of the original sony/sonyflake project, written in Go.
A Sonyflake ID is composed of
39 bits for time in units of 10 msec
8 bits for a sequence number
16 bits for a machine id
Installation
pip install sonyflake-py
Quickstart
from sonyflake import SonyFlake
sf = SonyFlake()
next_id = sf.next_id()
print(next_id)
The generator can be configured with variety of options, such as
custom machine_id
, start_time
etc.
start_time
should be an instance ofdatetime.datetime
.machine_id
should be a callable which returns an integer value upto 16-bits.
License
The MIT License (MIT).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sonyflake-py-1.2.1.tar.gz
(4.2 kB
view hashes)
Built Distributions
sonyflake_py-1.2.1-py3.9.egg
(4.1 kB
view hashes)
Close
Hashes for sonyflake_py-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2110536cd1d20bbd60302d3d6f24bf22a16de6b481110a766ef725bda033f8 |
|
MD5 | 9d6ed388a4f62223a4d731415da6e291 |
|
BLAKE2b-256 | 9fd792222882270d4f799e605848b5b3785ba534a70e6b0bcb7e33f6d8c405ce |