I use the "@{TRANSACTION_VERSION}-{TRANSACTION_ORDER}"
and "@{TRANSACTION_VERSION}-{TRANSACTION_ORDER}#{USER_VERSION}"
representations for logging/display purpose, but I’m not really satisfied with it to be honest: I get a lot of "@123456789-1"
or @"123456789-1#1"
, for example, in my log files.
In hindsight, using ‘@’ and ‘#’ was not a good idea for URIs, but at least it makes it easier to visually compare the chronological ordering of multiple version stamps, and you can copy/paste the transaction version part into a transaction log which is sometimes useful.
I also sometimes use the underlying hexadecimal representation of the bytes, but this is not very human-friendly.
Your idea of having a string representation that keeps the ordering could be useful in some situations, and my current format does not allow that, though in practice transaction versions quickly become a very large number that starts with digit 1
or 2
so it kinda sorts almost chronologically after a while…
Maybe an hybrid approach? Most 12-bytes VS have 3 parts, the transaction version (8 bytes), order (2 bytes) and optional user version (2 bytes). Maybe encoding each part individually, and joining them would work better? Displaying multiple versionstamps aligned vertically would keep all 3 segments aligned which is nice.
Using hexadecimal, it would be something like '0123456789ABCDEF-0000'
or '0123456789ABCDEF-0000-0001'
which kinda looks like a uuid. Is there a standardized 80-bit or 96-bit uuid representation that we could borrow?