public class ArrayKVStore extends AbstractKVStore
KVStore based on a sorted array of key/value pairs.
Instances query three ByteBuffers, one for the array index, one for the key data, and one for the value data.
Data for these ByteBuffers is created using ArrayKVWriter.
Instances are optimized for minimal memory overhead and queries using keys sharing a prefix with the previously queried key. Key data is prefix-compressed.
Key and value data must not exceed 2GB (each separately).
| Constructor and Description |
|---|
ArrayKVStore(ByteBuffer indx,
ByteBuffer keys,
ByteBuffer vals)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
get(byte[] key) |
KVPair |
getAtLeast(byte[] minKey) |
KVPair |
getAtMost(byte[] maxKey) |
Iterator<KVPair> |
getRange(byte[] minKey,
byte[] maxKey,
boolean reverse) |
void |
put(byte[] key,
byte[] value) |
void |
remove(byte[] key) |
void |
removeRange(byte[] minKey,
byte[] maxKey) |
adjustCounter, decodeCounter, encodeCounterpublic ArrayKVStore(ByteBuffer indx, ByteBuffer keys, ByteBuffer vals)
indx - buffer containing index data written by a ArrayKVWriterkeys - buffer containing key data written by a ArrayKVWritervals - buffer containing value data written by a ArrayKVWriterIllegalArgumentException - if any parameter is nullIllegalArgumentException - if indx size is not a correct multiplepublic byte[] get(byte[] key)
get in interface KVStoreget in class AbstractKVStorepublic KVPair getAtLeast(byte[] minKey)
getAtLeast in interface KVStoregetAtLeast in class AbstractKVStorepublic KVPair getAtMost(byte[] maxKey)
getAtMost in interface KVStoregetAtMost in class AbstractKVStorepublic void put(byte[] key,
byte[] value)
put in interface KVStoreput in class AbstractKVStorepublic void remove(byte[] key)
remove in interface KVStoreremove in class AbstractKVStorepublic void removeRange(byte[] minKey,
byte[] maxKey)
removeRange in interface KVStoreremoveRange in class AbstractKVStoreCopyright © 2016. All rights reserved.