Order-preserving, reversible key codec for on-disk sorted maps/sets.
Unlike hash maps (which SHA-1-hash their keys), sorted collections store the
real key bytes so they can be recovered on read and compared by the engine's
unsigned lexicographic byte comparison (Arrays.compareUnsigned). The codec
must therefore be:
decode-key (encode-key k) == ksign(compareUnsigned (encode a) (encode b))
== sign(compare a b) for any two keys.Every encoding carries a leading 1-byte type tag. The tag both identifies the type on decode and establishes a total order across types, so heterogeneous keys never throw.
Supported key types: string, keyword, boolean, char, long, double, UUID,
Instant and Date. Strings encode as their UTF-8 bytes (already code-point
ordered); keywords use a flag + namespace + name layout so they sort like
Clojure's default comparator (see keyword->bytes); numeric/temporal/UUID
keys use order-preserving big-endian encodings.
Order-preserving, reversible key codec for on-disk sorted maps/sets.
Unlike hash maps (which SHA-1-hash their keys), sorted collections store the
real key bytes so they can be recovered on read and compared by the engine's
unsigned lexicographic byte comparison (`Arrays.compareUnsigned`). The codec
must therefore be:
1. reversible - `decode-key (encode-key k)` == k
2. order-preserving - `sign(compareUnsigned (encode a) (encode b))`
== `sign(compare a b)` for any two keys.
Every encoding carries a leading 1-byte type tag. The tag both identifies the
type on decode and establishes a total order across types, so heterogeneous
keys never throw.
Supported key types: string, keyword, boolean, char, long, double, UUID,
Instant and Date. Strings encode as their UTF-8 bytes (already code-point
ordered); keywords use a flag + namespace + name layout so they sort like
Clojure's default comparator (see `keyword->bytes`); numeric/temporal/UUID
keys use order-preserving big-endian encodings.Bridges the XITDBSorted* wrapper types to the Java Read/WriteSortedMap.
Keys are encoded/decoded through xitdb.util.sorted-key (order-preserving,
reversible) rather than hashed, so the real key is recoverable on read.
Bridges the XITDBSorted* wrapper types to the Java Read/WriteSortedMap. Keys are encoded/decoded through `xitdb.util.sorted-key` (order-preserving, reversible) rather than hashed, so the real key is recoverable on read.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |