public class SkipTable
extends java.lang.Object
It begins with a pair of the initial key/value [VLQ, VLQ].
This is followed by a sequence of tiers, where each tier is: - the byte length of the tier [UVLQ] - one or more blocks
And each block is:
- one or more pairs of [UVLQ, VLQ], representing deltas for the key/value pair
- if the block is full, a "terminating" pair where the key is set to 0
Tiers are encoded in descending order. In all tiers but the last, each entry represents a block in the tier beneath it. The value of these entries represents the the byte offset of the terminating pair in the lower tier. In the lowest tier, the value of each entry represents the actual value associated with the key.
In other words, this is a flattened representation of an n-ary tree. The map {0 0, 1 1, 2 2, 3 3, 4 4}, would be
encoded as the bytes [0 0 2 4 3 4 2 3 0 7 8 1 1 0 2 1 1 0 4], which is interpreted as this tree:
[0, 0]
2: [4, 3]
└---------------┐
4: [2, 3] [0, 7]
└-------┐ └-------┐
8: [1, 1], [0, 2], [1, 1], [0, 4]
Note that the zeroed out key in each terminating pair doesn't matter, since we already have the key value from the
previous tier.
In practice, we use a 32-ary tree, but this can be configured on the write-side without any repercussions on the read-side.
| Modifier and Type | Class and Description |
|---|---|
static class |
SkipTable.Entry |
static class |
SkipTable.Writer |
| Modifier and Type | Field and Description |
|---|---|
DurableInput.Pool |
in |
int |
tiers |
| Constructor and Description |
|---|
SkipTable(DurableInput.Pool in,
int tiers) |
| Modifier and Type | Method and Description |
|---|---|
SkipTable.Entry |
floor(long key) |
public final DurableInput.Pool in
public final int tiers
public SkipTable(DurableInput.Pool in, int tiers)
public SkipTable.Entry floor(long key)