public class SimpleKVTransaction extends AbstractKVStore implements KVTransaction
KVTransaction implementation for SimpleKVDatabase.
Locking note: all fields in this class are protected by the Java monitor of the associated SimpleKVDatabase,
not the Java monitor of this instance.
| Modifier | Constructor and Description |
|---|---|
protected |
SimpleKVTransaction(SimpleKVDatabase kvdb,
long waitTimeout)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
commit() |
protected void |
finalize()
Ensure transaction is eventually rolled back if leaked due to an application bug.
|
byte[] |
get(byte[] key) |
KVPair |
getAtLeast(byte[] key) |
KVPair |
getAtMost(byte[] key) |
SimpleKVDatabase |
getKVDatabase() |
Iterator<KVPair> |
getRange(byte[] minKey,
byte[] maxKey,
boolean reverse) |
CloseableKVStore |
mutableSnapshot() |
void |
put(byte[] key,
byte[] value) |
void |
remove(byte[] key) |
void |
removeRange(byte[] minKey,
byte[] maxKey) |
void |
rollback() |
void |
setTimeout(long timeout) |
ListenableFuture<Void> |
watchKey(byte[] key) |
adjustCounter, decodeCounter, encodeCounterclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadjustCounter, decodeCounter, encodeCounterprotected SimpleKVTransaction(SimpleKVDatabase kvdb, long waitTimeout)
kvdb - associated databasewaitTimeout - wait timeout for this transactionIllegalArgumentException - if kvdb is nullIllegalArgumentException - if waitTimeout is negativepublic SimpleKVDatabase getKVDatabase()
getKVDatabase in interface KVTransactionpublic void setTimeout(long timeout)
setTimeout in interface KVTransactionpublic ListenableFuture<Void> watchKey(byte[] key)
watchKey in interface KVTransactionpublic byte[] get(byte[] key)
get in interface KVStoreget in class AbstractKVStorepublic KVPair getAtLeast(byte[] key)
getAtLeast in interface KVStoregetAtLeast in class AbstractKVStorepublic KVPair getAtMost(byte[] key)
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 AbstractKVStorepublic void commit()
commit in interface KVTransactionpublic void rollback()
rollback in interface KVTransactionpublic CloseableKVStore mutableSnapshot()
mutableSnapshot in interface KVTransactionCopyright © 2016. All rights reserved.