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_timeshould be an instance ofdatetime.datetime.machine_idshould 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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sonyflake-py-1.3.0.tar.gz.
File metadata
- Download URL: sonyflake-py-1.3.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1445245f89fa18f25506ab1ff03c49835d9ec3eadb34adf1e5e2894e52202777
|
|
| MD5 |
ab77af5d8b8471a68752b4cf671b7019
|
|
| BLAKE2b-256 |
4c6dfe8202f8c3c9a1b3fe10d0b5b6bfaf809a71e5fc52af1c09e0c2e6995be5
|
File details
Details for the file sonyflake_py-1.3.0-py3.9.egg.
File metadata
- Download URL: sonyflake_py-1.3.0-py3.9.egg
- Upload date:
- Size: 4.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89a479385fa42b9f4234e2afc1e677c866aa7700b204b1ec85c0be35dc2a4ae6
|
|
| MD5 |
cb78f8713faaee7be363a98ec0789472
|
|
| BLAKE2b-256 |
f34285ddcdb32ef61822a0964c948b7306783cd066704c154ff5c16ffc86fa94
|
File details
Details for the file sonyflake_py-1.3.0-py3-none-any.whl.
File metadata
- Download URL: sonyflake_py-1.3.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5433acfcd8177effa79511246a52f30b37ec773d9e2cec1a4733c57a45a18820
|
|
| MD5 |
c1c58cabb0e8629b84413e1d15a7ff7d
|
|
| BLAKE2b-256 |
a98f2fa1e7c00a14f0b66bdd2403b7d902676a91f0ddc13e2e7f66ea55f725c3
|