pub struct DBOptions { /* private fields */ }
Expand description
This structure represents options that can be used when constructing a LevelDB instance.
Implementations§
Source§impl DBOptions
impl DBOptions
Sourcepub fn new() -> Option<DBOptions>
pub fn new() -> Option<DBOptions>
Create and return a new DBOptions instance. Returns None
if the
underlying library call returns a null pointer.
Sourcepub fn set_comparator(&mut self, cmp: DBComparator) -> &mut DBOptions
pub fn set_comparator(&mut self, cmp: DBComparator) -> &mut DBOptions
Set the comparator to use for this database. By default, LevelDB uses a comparator does a lexicographic comparison. Note also that a comparator must be thread-safe.
Sourcepub fn set_create_if_missing(&mut self, val: bool) -> &mut DBOptions
pub fn set_create_if_missing(&mut self, val: bool) -> &mut DBOptions
Create the database if it’s missing when we try to open it.
Default: false
Sourcepub fn set_error_if_exists(&mut self, val: bool) -> &mut DBOptions
pub fn set_error_if_exists(&mut self, val: bool) -> &mut DBOptions
Return an error if the database already exists.
Default: false
Sourcepub fn set_paranoid_checks(&mut self, val: bool) -> &mut DBOptions
pub fn set_paranoid_checks(&mut self, val: bool) -> &mut DBOptions
If set to true, the library will do aggressive checking of all data that it is processing and will stop early if it detects any errors.
Default: false
Sourcepub fn set_write_buffer_size(&mut self, val: usize) -> &mut DBOptions
pub fn set_write_buffer_size(&mut self, val: usize) -> &mut DBOptions
Amount of data to build up in memory (backed by an unsorted log on-disk) before converting to a sorted on-disk file.
Default: 4MiB
Sourcepub fn set_max_open_files(&mut self, val: isize) -> &mut DBOptions
pub fn set_max_open_files(&mut self, val: isize) -> &mut DBOptions
Number of open files that can be used by the DB. This value should be approximately one open file per 2MB of working set.
Default: 1000
Sourcepub fn set_block_size(&mut self, val: usize) -> &mut DBOptions
pub fn set_block_size(&mut self, val: usize) -> &mut DBOptions
Approximate size of user data packed per block. Note that this corresponds to uncompressed data.
Default: 4KB
Sourcepub fn set_block_restart_interval(&mut self, val: isize) -> &mut DBOptions
pub fn set_block_restart_interval(&mut self, val: isize) -> &mut DBOptions
Number of keys between restart points for delta encoding of keys. Most clients should not change this parameter.
Default: 16