The radix tree index is intended to be compact. Often, the keys in the index
exists in another file (or called "buffer"). Therefore storing full keys in
the index itself is a waste of space. We can store offsets instead.
This patch implements serialization for a byte array (either fixed 20-byte,
or has a variable length). So we can convert between byte arrays and
offsets.
For cases where we know the mapping already (ex. revlog has a node <->
revision number) mapping, we can "abuse" the serialize interface to return
revision numbers instead of actual buffer offsets and leave "write_to"
unimplemented.