SCRU64: Sortable, Clock-based, Realm-specifically Unique identifier
Project description
SCRU64: Sortable, Clock-based, Realm-specifically Unique identifier
SCRU64 ID offers compact, time-ordered unique identifiers generated by distributed nodes. SCRU64 has the following features:
- 63-bit non-negative integer storable as signed/unsigned 64-bit integer
- Sortable by generation time (as integer and as text)
- 12-digit case-insensitive textual representation (Base36)
- ~38-bit Unix epoch-based timestamp that ensures useful life until year 4261
- Variable-length node/machine ID and counter fields that share 24 bits
# pass node ID through environment variable
import os
os.environ["SCRU64_NODE_SPEC"] = "42/8"
import scru64
# generate a new identifier object
x = scru64.new_sync()
print(x) # e.g., "0u2r85hm2pt3"
print(int(x)) # as a 64-bit unsigned integer
# generate a textual representation directly
print(scru64.new_string_sync()) # e.g., "0u2r85hm2pt4"
See SCRU64 Specification for details.
SCRU64's uniqueness is realm-specific, i.e., dependent on the centralized assignment of node ID to each generator. If you need decentralized, globally unique time-ordered identifiers, consider SCRU128.
License
Licensed under the Apache License, Version 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scru64-1.0.1.tar.gz
(11.8 kB
view details)
Built Distribution
scru64-1.0.1-py3-none-any.whl
(12.3 kB
view details)
File details
Details for the file scru64-1.0.1.tar.gz
.
File metadata
- Download URL: scru64-1.0.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d073cdf6a3b9212f762aace5774395c57c6801bb69ea88b0070e0eef8eb3c474 |
|
MD5 | 87915ffec39dcb4dfe047ecd15c369db |
|
BLAKE2b-256 | 2d436d5813b7bb5c897d7ec844dee330964c79dc718481941405bd12f83d730d |
File details
Details for the file scru64-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: scru64-1.0.1-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7800cb2eebe4973d41412e6c2d7c1841f6496697ea80fd27877371edcfa55895 |
|
MD5 | 4d79d61ce23c957f0f34248dc5957b27 |
|
BLAKE2b-256 | 0b7b250d2324785d45ae042e2ef0432d61764d4e40df1b3fb01d77a2c72d55c8 |