Skip to content

Commit 812ee5e

Browse files
committed
A little more doc.
1 parent 7a21b1c commit 812ee5e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@ The other options is to truncate 2 bytes off of the seconds, storing 6 bytes of
2020

2121
The current implementation chose option #2, as it is less work to generate a UUID if math is not involved.
2222

23+
The byte structure of the CSUUID is:
24+
2325
```
2426
+-------------+-----------------+------------+
2527
| nanoseconds | seconds | identifier |
2628
| 0..3 | 4..10 | 11..15 |
2729
+-------------+-----------------+------------+
2830
```
2931

32+
The representational structure of the CSUUID, however, is itself sortable, as are the objects themselves.
33+
34+
```plain
35+
.00.0e.d9.eb.-.7e.05.-.08.ae.-.f2.9c.-.df.18.10.1c.4a.dc.
36+
^ seconds ^ nanoseconds ^identifier/entropy^
37+
```
38+
39+
3040
## Installation
3141

3242
1. Add the dependency to your `shard.yml`:

src/csuuid.cr

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ require "crystal/spin_lock"
4646
# +-------------+-----------------+------------+
4747
# ```
4848
#
49+
# The representational structure of the CSUUID, however, is itself sortable, as are the objects themselves.
50+
#
51+
# ```plain
52+
# .00.0e.d9.eb.-.7e.05.-.08.ae.-.f2.9c.-.df.18.10.1c.4a.dc.
53+
# ^ seconds ^ nanoseconds ^identifier/entropy^
54+
# ```
55+
#
4956
struct CSUUID
5057
# CSUUID will work with any source of entropy that inherits from Random.
5158
# It defaults to `Random::ISAAC`.

0 commit comments

Comments
 (0)