java.lang.Object
org.apache.polaris.persistence.nosql.api.index.IndexKey
All Implemented Interfaces:
Comparable<IndexKey>

public final class IndexKey extends Object implements Comparable<IndexKey>
Represents a key in an Index.

Index keys are always represented as a byte array. Convenience functions to use String and long as keys are provided this type.

The serialized representation of an IndexKey is its binary representation terminated by a 0x01 byte. 0x01 appearing in the value is escaped as 0x02 0x01, 0x02 appearing in the value is escaped as 0x02 0x02,

The implementation assumes that 0x00 byte values appear more often, for example, when serializing plain long keys, hence the choice to use 0x01/0x02.

The serialized representation of IndexKeys is safe to be "partially serialized", as done by index implementations, which does not serialize the common prefix of a key compared to the previously serialized key.

IndexKeys are comparable, the results reflect the outcome of the unsigned comparison of the respective byte representations.