-
Notifications
You must be signed in to change notification settings - Fork 16
/
snowflake.identifier.txt
27 lines (20 loc) · 2.07 KB
/
snowflake.identifier.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
SNOWFLAKE
ALTERNATIVES ==> #See UUID
SNOWFLAKE ID ==> #Invented by Twitter. Used by Discord, Mastodon.
FORMAT ==> #64 bits:
# - sign bit: always 0
# - timestamp:
# - 41 bits
# - millisecs since epoch
# - i.e. IDs are sortable by time
# - instance:
# - 10 bits
# - machine ID
# - sequence:
# - 12 bits
# - increment when creating multiple IDs per millisec
#I.e. max ~4000 IDs/ms per machine
#Often serialized in base 10
MASTODON SNOWFLAKE ==> #Does not use sign nor instance field. Instead, 48 bits timestamp, 16 bits sequence.