|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.BTreeKeySerializer<K>
K - type of keypublic abstract class BTreeKeySerializer<K>
Custom serializer for BTreeMap keys which enables [Delta encoding](https://en.wikipedia.org/wiki/Delta_encoding). Keys in BTree Nodes are sorted, this enables number of tricks to save disk space. For example for numbers we may store only difference between subsequent numbers, for string we can only take suffix, etc...
| Nested Class Summary | |
|---|---|
static class |
BTreeKeySerializer.BasicKeySerializer
Basic Key Serializer which just writes data without applying any compression. |
static class |
BTreeKeySerializer.Tuple2KeySerializer<A,B>
Applies delta compression on array of tuple. |
static class |
BTreeKeySerializer.Tuple3KeySerializer<A,B,C>
Applies delta compression on array of tuple. |
static class |
BTreeKeySerializer.Tuple4KeySerializer<A,B,C,D>
Applies delta compression on array of tuple. |
static class |
BTreeKeySerializer.Tuple5KeySerializer<A,B,C,D,E>
Applies delta compression on array of tuple. |
static class |
BTreeKeySerializer.Tuple6KeySerializer<A,B,C,D,E,F>
Applies delta compression on array of tuple. |
| Field Summary | |
|---|---|
static BTreeKeySerializer |
BASIC
|
static BTreeKeySerializer<String> |
STRING
Applies delta packing on java.lang.String. |
static BTreeKeySerializer.Tuple2KeySerializer |
TUPLE2
Tuple2 Serializer which uses Default Serializer from DB and expect values to implement Comparable interface. |
static BTreeKeySerializer.Tuple3KeySerializer |
TUPLE3
Tuple3 Serializer which uses Default Serializer from DB and expect values to implement Comparable interface. |
static BTreeKeySerializer.Tuple4KeySerializer |
TUPLE4
Tuple4 Serializer which uses Default Serializer from DB and expect values to implement Comparable interface. |
static BTreeKeySerializer<Integer> |
ZERO_OR_POSITIVE_INT
Applies delta packing on java.lang.Integer. |
static BTreeKeySerializer<Long> |
ZERO_OR_POSITIVE_LONG
Applies delta packing on java.lang.Long. |
| Constructor Summary | |
|---|---|
BTreeKeySerializer()
|
|
| Method Summary | |
|---|---|
abstract Object[] |
deserialize(DataInput in,
int start,
int end,
int size)
Deserializes keys for single BTree Node. |
abstract Comparator<K> |
getComparator()
Some key serializers may only work with they own comparators. |
static byte[] |
leadingValuePackRead(DataInput in,
byte[] previous,
int ignoreLeadingCount)
Read previously written data from leadingValuePackWrite() method. |
static void |
leadingValuePackWrite(DataOutput out,
byte[] buf,
byte[] previous,
int ignoreLeadingCount)
This method is used for delta compression for keys. |
abstract void |
serialize(DataOutput out,
int start,
int end,
Object[] keys)
Serialize keys from single BTree Node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final BTreeKeySerializer BASIC
public static final BTreeKeySerializer<Long> ZERO_OR_POSITIVE_LONG
java.lang.Long. All keys must be non negative.
Difference between consequential numbers is also packed itself, so for small diffs it takes only single byte per
number.
public static final BTreeKeySerializer<Integer> ZERO_OR_POSITIVE_INT
java.lang.Integer. All keys must be non negative.
Difference between consequential numbers is also packed itself, so for small diffs it takes only single byte per
number.
public static final BTreeKeySerializer<String> STRING
java.lang.String. This serializer splits consequent strings
to two parts: shared prefix and different suffix. Only suffix is than stored.
public static final BTreeKeySerializer.Tuple2KeySerializer TUPLE2
Comparable interface.
public static final BTreeKeySerializer.Tuple3KeySerializer TUPLE3
Comparable interface.
public static final BTreeKeySerializer.Tuple4KeySerializer TUPLE4
Comparable interface.
| Constructor Detail |
|---|
public BTreeKeySerializer()
| Method Detail |
|---|
public abstract void serialize(DataOutput out,
int start,
int end,
Object[] keys)
throws IOException
out - output stream where to put atastart - where data start in array. Before this index all keys are nullend - where data ends in array (exclusive). From this index all keys are nullkeys - array of keys for single BTree Node
IOException
public abstract Object[] deserialize(DataInput in,
int start,
int end,
int size)
throws IOException
in - input stream to read data fromstart - where data start in array. Before this index all keys are nullend - where data ends in array (exclusive). From this index all keys are nullsize - size of array which should be returned
IOExceptionpublic abstract Comparator<K> getComparator()
public static byte[] leadingValuePackRead(DataInput in,
byte[] previous,
int ignoreLeadingCount)
throws IOException
leadingValuePackWrite() method.
author: Kevin Day
IOException
public static void leadingValuePackWrite(DataOutput out,
byte[] buf,
byte[] previous,
int ignoreLeadingCount)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||