public class LevelDBAtomicKVStore extends ForwardingKVStore implements AtomicKVStore
AtomicKVStore view of a LevelDB database.
A database directory is the only required configuration property. Instances may be stopped and (re)started multiple times.
| Constructor and Description |
|---|
LevelDBAtomicKVStore()
Constructor.
|
LevelDBAtomicKVStore(org.iq80.leveldb.DBFactory factory)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected LevelDBKVStore |
delegate() |
protected void |
finalize()
Finalize this instance.
|
org.iq80.leveldb.DB |
getDB()
Get the underlying
DB associated with this instance. |
File |
getDirectory()
Get the filesystem directory containing the database.
|
org.iq80.leveldb.Options |
getOptions()
Get the
Options this instance will use when opening the database at startup. |
void |
mutate(Mutations mutations,
boolean sync) |
void |
setBlockRestartInterval(int blockRestartInterval)
Configure the number of keys between restart points for delta encoding of keys.
|
void |
setBlockSize(int blockSize)
Configure the block size.
|
void |
setCacheSize(long cacheSize)
Configure the cache size.
|
void |
setCompressionType(org.iq80.leveldb.CompressionType compressionType)
Configure the compression type.
|
void |
setCreateIfMissing(boolean createIfMissing)
Configure whether to create the database if missing.
|
void |
setDirectory(File directory)
Configure the filesystem directory containing the database.
|
void |
setErrorIfExists(boolean errorIfExists)
Configure whether to throw an error if the database already exists.
|
void |
setMaxOpenFiles(int maxOpenFiles)
Configure the maximum number of open files.
|
void |
setOptions(org.iq80.leveldb.Options options)
Set the
Options this instance will use when opening the database at startup. |
void |
setParanoidChecks(boolean paranoidChecks)
Configure whether paranoid checks are enabled.
|
void |
setVerifyChecksums(boolean verifyChecksums)
Configure whether to verify checksums.
|
void |
setWriteBufferSize(int writeBufferSize)
Configure the write buffer size.
|
SnapshotLevelDBKVStore |
snapshot() |
void |
start() |
void |
stop() |
String |
toString() |
adjustCounter, decodeCounter, encodeCounter, get, getAtLeast, getAtMost, getRange, put, remove, removeRangeclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitadjustCounter, decodeCounter, encodeCounter, get, getAtLeast, getAtMost, getRange, put, remove, removeRangepublic LevelDBAtomicKVStore()
Uses the default DBFactory provided by LevelDBUtil.getDefaultDBFactory().
public LevelDBAtomicKVStore(org.iq80.leveldb.DBFactory factory)
factory - factory for databaseIllegalArgumentException - if factory is nullpublic File getDirectory()
public void setDirectory(File directory)
directory - database directoryIllegalStateException - if this instance is already start()edpublic org.iq80.leveldb.DB getDB()
DB associated with this instance.DBIllegalStateException - if this instance is not start()edpublic org.iq80.leveldb.Options getOptions()
Options this instance will use when opening the database at startup.public void setOptions(org.iq80.leveldb.Options options)
Options this instance will use when opening the database at startup.
Overwrites any previous options configuration(s).options - database optionsIllegalArgumentException - if options is nullIllegalStateException - if this instance is already start()edpublic void setBlockRestartInterval(int blockRestartInterval)
blockRestartInterval - restart intervalIllegalStateException - if this instance is already start()edpublic void setBlockSize(int blockSize)
blockSize - block sizeIllegalStateException - if this instance is already start()edpublic void setCacheSize(long cacheSize)
cacheSize - cache sizeIllegalStateException - if this instance is already start()edpublic void setCompressionType(org.iq80.leveldb.CompressionType compressionType)
CompressionType.SNAPPY.compressionType - compression type.IllegalArgumentException - if compressionType is nullIllegalStateException - if this instance is already start()edpublic void setCreateIfMissing(boolean createIfMissing)
createIfMissing - true to create if missingIllegalStateException - if this instance is already start()edpublic void setErrorIfExists(boolean errorIfExists)
errorIfExists - true for error if database existsIllegalStateException - if this instance is already start()edpublic void setMaxOpenFiles(int maxOpenFiles)
maxOpenFiles - maximum number of open filesIllegalStateException - if this instance is already start()edpublic void setParanoidChecks(boolean paranoidChecks)
paranoidChecks - true to enableIllegalStateException - if this instance is already start()edpublic void setVerifyChecksums(boolean verifyChecksums)
verifyChecksums - true to enableIllegalStateException - if this instance is already start()edpublic void setWriteBufferSize(int writeBufferSize)
writeBufferSize - write buffer sizeIllegalStateException - if this instance is already start()ed@PostConstruct public void start()
start in interface AtomicKVStore@PreDestroy public void stop()
stop in interface AtomicKVStoreprotected LevelDBKVStore delegate()
delegate in class ForwardingKVStorepublic SnapshotLevelDBKVStore snapshot()
snapshot in interface AtomicKVStorepublic void mutate(Mutations mutations, boolean sync)
mutate in interface AtomicKVStoreprotected void finalize()
throws Throwable
stop() to close any unclosed iterators.Copyright © 2016. All rights reserved.