Package io.permazen.kv.leveldb
Class LevelDBKVDatabase
java.lang.Object
io.permazen.kv.mvcc.SnapshotKVDatabase
io.permazen.kv.leveldb.LevelDBKVDatabase
- All Implemented Interfaces:
KVDatabase
KVDatabase
implementation based on a LevelDBAtomicKVStore
, providing concurrent transactions
and linearizable ACID semantics.
Key watches are supported.
-
Field Summary
Fields inherited from class io.permazen.kv.mvcc.SnapshotKVDatabase
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected LevelDBKVTransaction
createSnapshotKVTransaction
(MutableView view, long baseVersion) Instantiate a newSnapshotKVTransaction
instance.Create a new transaction.Get the underlyingLevelDBAtomicKVStore
used by this instance.void
setKVStore
(LevelDBAtomicKVStore kvstore) Configure the underlyingLevelDBAtomicKVStore
used by this instance.protected RuntimeException
Wrap aRuntimeException
as needed.Methods inherited from class io.permazen.kv.mvcc.SnapshotKVDatabase
closeTransactions, createTransaction, getCurrentVersion, logException, setKVStore, start, stop, toString
-
Constructor Details
-
LevelDBKVDatabase
public LevelDBKVDatabase()
-
-
Method Details
-
getKVStore
Get the underlyingLevelDBAtomicKVStore
used by this instance.- Overrides:
getKVStore
in classSnapshotKVDatabase
- Returns:
- underlying key/value store
-
setKVStore
Configure the underlyingLevelDBAtomicKVStore
used by this instance. Required property.- Parameters:
kvstore
- underlying key/value store- Throws:
IllegalStateException
- if this instance is alreadySnapshotKVDatabase.start()
ed
-
createTransaction
Description copied from class:SnapshotKVDatabase
Create a new transaction.- Specified by:
createTransaction
in interfaceKVDatabase
- Overrides:
createTransaction
in classSnapshotKVDatabase
- Returns:
- newly created transaction
-
createSnapshotKVTransaction
Description copied from class:SnapshotKVDatabase
Instantiate a newSnapshotKVTransaction
instance.The implementation in
SnapshotKVDatabase
just invokes theSnapshotKVTransaction
constructor usingthis
. Subclasses may want to override this method to create a more specific subclass.- Overrides:
createSnapshotKVTransaction
in classSnapshotKVDatabase
- Parameters:
view
- mutable view to be used for this transactionbaseVersion
- the database version associated withbase
- Returns:
- new transaction instance
-
wrapException
Description copied from class:SnapshotKVDatabase
Wrap aRuntimeException
as needed.The implementation in
SnapshotKVDatabase
just returnse
.- Overrides:
wrapException
in classSnapshotKVDatabase
- Parameters:
tx
- transaction in which the exception occurrede
- original exception- Returns:
- wrapped exception, or just
e
-