public class LevelDBKVDatabase extends SnapshotKVDatabase
KVDatabase
implementation based on a LevelDBAtomicKVStore
, providing concurrent transactions
and linearizable ACID semantics.
Key watches are supported.
log
Constructor and Description |
---|
LevelDBKVDatabase() |
Modifier and Type | Method and Description |
---|---|
protected LevelDBKVTransaction |
createSnapshotKVTransaction(MutableView view,
long baseVersion)
Instantiate a new
SnapshotKVTransaction instance. |
LevelDBKVTransaction |
createTransaction()
Create a new transaction.
|
LevelDBAtomicKVStore |
getKVStore()
Get the underlying
LevelDBAtomicKVStore used by this instance. |
void |
setKVStore(LevelDBAtomicKVStore kvstore)
Configure the underlying
LevelDBAtomicKVStore used by this instance. |
protected RuntimeException |
wrapException(SnapshotKVTransaction tx,
RuntimeException e)
Wrap a
RuntimeException as needed. |
closeTransactions, createTransaction, getCurrentVersion, logException, setKVStore, start, stop, toString
public LevelDBAtomicKVStore getKVStore()
LevelDBAtomicKVStore
used by this instance.getKVStore
in class SnapshotKVDatabase
public void setKVStore(LevelDBAtomicKVStore kvstore)
LevelDBAtomicKVStore
used by this instance. Required property.kvstore
- underlying key/value storeIllegalStateException
- if this instance is already SnapshotKVDatabase.start()
edpublic LevelDBKVTransaction createTransaction()
SnapshotKVDatabase
createTransaction
in interface KVDatabase
createTransaction
in class SnapshotKVDatabase
protected LevelDBKVTransaction createSnapshotKVTransaction(MutableView view, long baseVersion)
SnapshotKVDatabase
SnapshotKVTransaction
instance.
The implementation in SnapshotKVDatabase
just invokes the SnapshotKVTransaction
constructor using this
. Subclasses may want to override this method to create a more specific subclass.
createSnapshotKVTransaction
in class SnapshotKVDatabase
view
- mutable view to be used for this transactionbaseVersion
- the database version associated with base
protected RuntimeException wrapException(SnapshotKVTransaction tx, RuntimeException e)
SnapshotKVDatabase
RuntimeException
as needed.
The implementation in SnapshotKVDatabase
just returns e
.
wrapException
in class SnapshotKVDatabase
tx
- transaction in which the exception occurrede
- original exceptione
Copyright © 2022. All rights reserved.