-
Notifications
You must be signed in to change notification settings - Fork 16
/
ulid.identifier.txt
24 lines (17 loc) · 2.09 KB
/
ulid.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
ULID
ALTERNATIVES ==> #See UUID
ULID ==> #Unique ID ("Universally Unique Lexicographically Sortable Identifier")
FORMAT ==> #base32 of concatenation of:
# - DATE: 10 chars
# - DATE_NUM epoch time, in ms
# - first char has only 2 bits, i.e. total 48 bits, not 50
# - RANDOM: 16 chars
#Case-insensitive
MONOTONIC ==> #Same except keep track of last DATE|RANDOM. If DATE:
# - < last DATE: use last DATE, i.e. only allow >=
# - == last DATE: increment last RANDOM by 1 bit (instead of generating new one)
# - failure if >1.2e24 IDs
# - > last DATE: generate new RANDOM
#I.e. no collision until 1.2e24 IDs in 1ms, within same process