public class Options extends Object
| Constructor and Description |
|---|
Options() |
| Modifier and Type | Method and Description |
|---|---|
int |
blockRestartInterval() |
Options |
blockRestartInterval(int blockRestartInterval)
Number of keys between restart points for delta encoding of keys.
|
int |
blockSize() |
Options |
blockSize(int blockSize)
Approximate size of user data packed per block.
|
long |
cacheSize() |
Options |
cacheSize(long cacheSize)
If
cacheSize is zero, no block cache will be used-
If non-zero, use the specified cache size for blocks. |
DBComparator |
comparator() |
Options |
comparator(DBComparator comparator)
Parameters that affect behavior
|
CompressionType |
compressionType() |
Options |
compressionType(CompressionType compressionType)
Compress blocks using the specified compression algorithm.
|
boolean |
createIfMissing()
If true, the database will be created if it is missing.
|
Options |
createIfMissing(boolean createIfMissing) |
boolean |
errorIfExists() |
Options |
errorIfExists(boolean errorIfExists)
If true, an error is raised if the database already exists.
|
XFilterPolicy |
filterPolicy() |
Options |
filterPolicy(XFilterPolicy filterPolicy)
If non-null, use the specified filter policy to reduce disk reads.
|
static Options |
fromOptions(Options options)
Clone, create a copy of the provided instance of
Options |
Logger |
logger() |
Options |
logger(Logger logger)
Any internal progress/error information generated by the db will
be written to
logger if it is non-null, or to a file stored
in the same directory as the DB contents if info_log is null. |
int |
maxFileSize() |
Options |
maxFileSize(int maxFileSize)
Leveldb will write up to this amount of bytes to a file before
switching to a new one.
|
int |
maxOpenFiles() |
Options |
maxOpenFiles(int maxOpenFiles)
Number of open files that can be used by the DB.
|
static Options |
newDefaultOptions()
Create an Options object with default values for all fields.
|
boolean |
paranoidChecks() |
Options |
paranoidChecks(boolean paranoidChecks)
If true, the implementation will do aggressive checking of the
data it is processing and will stop early if it detects any
errors.
|
boolean |
reuseLogs() |
Options |
reuseLogs(boolean reuseLogs)
If true, append to existing MANIFEST and log files
when a database is opened.
|
int |
writeBufferSize() |
Options |
writeBufferSize(int writeBufferSize)
Parameters that affect performance
|
public static Options fromOptions(Options options)
Optionspublic static Options newDefaultOptions()
public boolean createIfMissing()
public Options createIfMissing(boolean createIfMissing)
public boolean errorIfExists()
public Options errorIfExists(boolean errorIfExists)
public int writeBufferSize()
public Options writeBufferSize(int writeBufferSize)
Amount of data to build up in memory (backed by an unsorted log on disk) before converting to a sorted on-disk file.
Larger values increase performance, especially during bulk loads. Up to two write buffers may be held in memory at the same time, so you may wish to adjust this parameter to control memory usage. Also, a larger write buffer will result in a longer recovery time the next time the database is opened.
public int maxOpenFiles()
public Options maxOpenFiles(int maxOpenFiles)
public int blockRestartInterval()
public Options blockRestartInterval(int blockRestartInterval)
public int maxFileSize()
public Options maxFileSize(int maxFileSize)
Default: 2MB
maxFileSize - max file size int bytespublic int blockSize()
public Options blockSize(int blockSize)
public CompressionType compressionType()
public Options compressionType(CompressionType compressionType)
Default: CompressionType.SNAPPY, which gives lightweight but fast
compression.
Typical speeds of CompressionType.SNAPPY on an Intel(R) Core(TM)2 2.4GHz:
~200-500MB/s compression
~400-800MB/s decompression
Note that these speeds are significantly faster than most
persistent storage speeds, and therefore it is typically never
worth switching to CompressionType.NONE. Even if the input data is
incompressible, the CompressionType.SNAPPY implementation will
efficiently detect that and will switch to uncompressed mode.
If Snappy compression is not available, CompressionType.NONE
will be used.
public long cacheSize()
public Options cacheSize(long cacheSize)
cacheSize is zero, no block cache will be used-
If non-zero, use the specified cache size for blocks.
By default leveldb will automatically create and use an 8MB internal cache.public DBComparator comparator()
public Options comparator(DBComparator comparator)
Comparator used to define the order of keys in the table. Default: a comparator that uses lexicographic byte-wise ordering
REQUIRES: The client must ensure that the comparator supplied here has the same name and orders keys *exactly* the same as the comparator provided to previous open calls on the same DB.
public Logger logger()
public Options logger(Logger logger)
logger if it is non-null, or to a file stored
in the same directory as the DB contents if info_log is null.public boolean paranoidChecks()
public Options paranoidChecks(boolean paranoidChecks)
public Options filterPolicy(XFilterPolicy filterPolicy)
filterPolicy - new filter policypublic XFilterPolicy filterPolicy()
public Options reuseLogs(boolean reuseLogs)
public boolean reuseLogs()
Copyright © 2011–2020. All rights reserved.