-
Notifications
You must be signed in to change notification settings - Fork 4
Options while opening a database
Zohaib Sibte Hassan edited this page Mar 11, 2016
·
1 revision
LevelDBWinRT Options
object let's you configure your database while you are opening a database. Again sticking to leveldb::Options
object you can do stuff like creating database if missing or panic if missing etc. Here is prototype of Options object for LevelDBWinRT
class Options {
bool CreateIfMissing;
bool ErrorIfExists;
bool ParanoidChecks;
uint32 WriteBufferSize;
int MaximumOpenFiles;
uint32 BlockCacheSize;
uint32 BlockSize;
int BlockRestartInterval;
FilterType Filter;
CompressorType Compressor;
IKeyComparator Comparator;
};
Where, following options are directly mapped to leveldb::Options
:
-
CreateIfMissing
(false by default) creates database if missing; directly maps to create_if_missing option ofleveldb::Options
-
ErrorIfExists
(false by default) fails open if database already exists; directly maps to fail_if_exists ofleveldb::Options
-
ParanoidChecks
(false by default) corresponds toparanoid_checks
inleveldb::Options
; see [official documentation] 1 for more details. -
WriteBufferSize
(4MB by default) corresponds towrite_buffer_size
inleveldb::Options
; see [official documentation] 1 for more details. -
MaximumOpenFiles
(1K by default) corresponds to `maximum_open_filesin
leveldb::Options``; see [official documentation] 1 for more details. -
BlockSize
(4K by default) corresponds to `block_sizein
leveldb::Options``; see [official documentation] 1 for more details. -
BlockRestartInterval
(16 by default) corresponds to `block_restart_intervalin
leveldb::Options``; see [official documentation] 1 for more details.
In addition to above options, following options add some more goodness:
-
BlockCacheSize
(8MB by default) the in-memory cache size of LRU cache. This cache is same as leveldb::NewLRUCache -
Filter
(default value is None) defines the type of filter to be used, right now there is only one filter supportedBloomFilter
. WithBloomFilter
you should passBloomFilterParams
specifyingBitsPerKey
. Using filters can greatly improve your read speed, for more information read Bloom filters and LevelDB official documentation. -
Compressor
(default value is None) right now only two options are supportedNone
andSnappy
. Snappy is a compression algorithm by Google well integrated into LevelDB. Future might include more options. -
Comparator
(default is null) a custom comparator implementingIKeyComparator
interface. Note, comparators are experimental yet; so use them with extreme care.