public class RocksDBKVStore extends AbstractKVStore implements CloseableKVStore
| Constructor and Description |
|---|
RocksDBKVStore(org.rocksdb.RocksDB db)
Convenience constructor.
|
RocksDBKVStore(org.rocksdb.RocksDB db,
org.rocksdb.ReadOptions readOptions,
org.rocksdb.WriteBatch writeBatch)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
adjustCounter(byte[] key,
long amount) |
void |
close()
Close this instance.
|
long |
decodeCounter(byte[] value) |
byte[] |
encodeCounter(long value) |
protected void |
finalize()
Finalize this instance.
|
byte[] |
get(byte[] key) |
org.rocksdb.RocksDB |
getDB()
Get the
RocksDB underlying this instance. |
CloseableIterator<KVPair> |
getRange(byte[] minKey,
byte[] maxKey,
boolean reverse) |
void |
put(byte[] key,
byte[] value) |
void |
remove(byte[] key) |
String |
toString() |
getAtLeast, getAtMost, removeRangeclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitapply, getAtLeast, getAtMost, getRange, getRange, removeRange, removeRangepublic RocksDBKVStore(org.rocksdb.RocksDB db)
db - databasepublic RocksDBKVStore(org.rocksdb.RocksDB db,
org.rocksdb.ReadOptions readOptions,
org.rocksdb.WriteBatch writeBatch)
The caller is responsible for invoking close() on any supplied
readOptions and/or writeBatch, after this instance is close()'d of course.
db - databasereadOptions - read options, or null for the defaultwriteBatch - batch for write operations, or null for noneIllegalArgumentException - if db is nullpublic org.rocksdb.RocksDB getDB()
RocksDB underlying this instance.public byte[] get(byte[] key)
get in interface KVStoreget in class AbstractKVStorepublic CloseableIterator<KVPair> getRange(byte[] minKey, byte[] maxKey, boolean reverse)
public void put(byte[] key,
byte[] value)
put in interface KVStoreput in class AbstractKVStorepublic void remove(byte[] key)
remove in interface KVStoreremove in class AbstractKVStorepublic byte[] encodeCounter(long value)
encodeCounter in interface KVStoreencodeCounter in class AbstractKVStorepublic long decodeCounter(byte[] value)
decodeCounter in interface KVStoredecodeCounter in class AbstractKVStorepublic void adjustCounter(byte[] key,
long amount)
adjustCounter in interface KVStoreadjustCounter in class AbstractKVStoreprotected void finalize()
throws Throwable
close() to close any unclosed iterators.public void close()
This closes any unclosed iterators returned from getRange().
This does not close the underlying RocksDB or any associated WriteBatch.
close in interface CloseableKVStoreclose in interface Closeableclose in interface AutoCloseableCopyright © 2019. All rights reserved.