Module compact
Expand description
The compact form a history entry takes in a change message.
An entry is a tree of JSON values; written as JSON text it repeats every key name, quotes every string and spells ids and times out in decimal and hex. Here every value is a one-byte tag and its body:
| tag | value |
|---|---|
n f t | null, false, true |
u n / i n | the integer n / −1 − n |
d len text | any other number, as its JSON text |
s len bytes | a string, UTF-8 |
k n | the nth of [WORDS] (keys and values every entry uses) |
r n | the nth string written with s, U or H before it |
U 22 digits | a lowercase hyphenated UUID |
H 22 digits | 32 lowercase hex digits (a gesture) |
[ n | an array of n values |
{ n | an object of n keys (string values) each followed by its value |
Numbers n and lengths are written six bits a byte, low bits first: a
byte below 0x40 ends the number, 0x40 + bits continues it. A digit is
'0' + bits (six bits). Every byte but those inside strings is below
0x80, so the whole is UTF-8 and travels as a change message does. Keys
keep their order; a value decodes to exactly the tree it was written
from.
[WORDS] only grows: a word’s index is part of every stored entry.