merkle-db.key
Record keys are immutable byte sequences which uniquely identify a record within a table. Keys are stored in sorted order by comparing them lexicographically.
The first byte that differs between two keys determines their sort order, with the lower byte value ranking first. If the prefix of the longer key matches all the bytes in the shorter key, the shorter key ranks first.
create
(create data)
Construct a new key value containing the given byte data, which should either be a byte array or a sequence of byte values.
decode
(decode coder data)
(decode coder data offset len)
Decodes the given key byte data and returns a value.
Lexicoder
protocol
Simple codec for transforming values into keys that have specific ordering semantics.
members
decode*
(decode* coder data offset len)
Decode a key value from a section of a byte array.
encode*
(encode* coder value)
Encode the key value as a byte array.
lexicoder-config
(lexicoder-config coder)
Return a configuration value representing this lexicoder.
lexicoder
multimethod
Construct a lexicoder from a configuration data structure. The structure should be either a keyword or a vector with the first element a keyword providing the dispatch value.
reverse-lexicoder
(reverse-lexicoder coder)
Wraps the given lexicoder to reverse the ordering of keys encoded with it.
sequence-lexicoder
(sequence-lexicoder element-coder)
Constructs a lexicoder for homogeneous sequences of elements which will be coded with the given lexicoder.
string-lexicoder*
(string-lexicoder* charset)
Constructs a new string lexicoder with the given charset.
tuple-lexicoder
(tuple-lexicoder & coders)
Constructs a lexicoder for a fixed-size tuple of values which will be coded with the given lexicoders, in order.