diff --git a/README.md b/README.md index b71623d..f9d536c 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ The other options is to truncate 2 bytes off of the seconds, storing 6 bytes of The current implementation chose option #2, as it is less work to generate a UUID if math is not involved. +The byte structure of the CSUUID is: + ``` +-------------+-----------------+------------+ | nanoseconds | seconds | identifier | @@ -27,6 +29,14 @@ The current implementation chose option #2, as it is less work to generate a UUI +-------------+-----------------+------------+ ``` +The representational structure of the CSUUID, however, is itself sortable, as are the objects themselves. + +```plain +.00.0e.d9.eb.-.7e.05.-.08.ae.-.f2.9c.-.df.18.10.1c.4a.dc. +^ seconds ^ nanoseconds ^identifier/entropy^ +``` + + ## Installation 1. Add the dependency to your `shard.yml`: diff --git a/src/csuuid.cr b/src/csuuid.cr index 47eb846..ca5b14b 100644 --- a/src/csuuid.cr +++ b/src/csuuid.cr @@ -46,6 +46,13 @@ require "crystal/spin_lock" # +-------------+-----------------+------------+ # ``` # +# The representational structure of the CSUUID, however, is itself sortable, as are the objects themselves. +# +# ```plain +# .00.0e.d9.eb.-.7e.05.-.08.ae.-.f2.9c.-.df.18.10.1c.4a.dc. +# ^ seconds ^ nanoseconds ^identifier/entropy^ +# ``` +# struct CSUUID # CSUUID will work with any source of entropy that inherits from Random. # It defaults to `Random::ISAAC`.