Merge branch 'master' into memtable_bloom

master
Tyler Neely 6 years ago committed by GitHub
commit 6813437ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Cargo.toml
  2. 4
      librocksdb-sys/Cargo.toml
  3. 2
      librocksdb-sys/build.rs
  4. 2
      librocksdb-sys/rocksdb
  5. 2
      librocksdb-sys/rocksdb_lib_sources.txt
  6. 45
      src/db_options.rs

@ -19,4 +19,4 @@ valgrind = []
[dependencies]
libc = "0.2"
librocksdb-sys = { path = "librocksdb-sys", version = "5.11.3" }
librocksdb-sys = { path = "librocksdb-sys", version = "5.14.2" }

@ -1,6 +1,6 @@
[package]
name = "librocksdb-sys"
version = "5.11.3"
version = "5.14.2"
authors = ["Karl Hobley <karlhobley10@gmail.com>", "Arkadiy Paronyan <arkadiy@ethcore.io>"]
license = "MIT/Apache-2.0/BSD-3-Clause"
description = "Native bindings to librocksdb"
@ -24,4 +24,4 @@ const-cstr = "0.2"
[build-dependencies]
cc = { version = "^1.0", features = ["parallel"] }
make-cmd = "0.1"
bindgen = "0.29"
bindgen = "0.37"

@ -32,7 +32,7 @@ fn fail_on_empty_directory(name: &str) {
fn bindgen_rocksdb() {
let bindings = bindgen::Builder::default()
.header("rocksdb/include/rocksdb/c.h")
.hide_type("max_align_t") // https://github.com/rust-lang-nursery/rust-bindgen/issues/550
.blacklist_type("max_align_t") // https://github.com/rust-lang-nursery/rust-bindgen/issues/550
.ctypes_prefix("libc")
.generate()
.expect("unable to generate rocksdb bindings");

@ -1 +1 @@
Subproject commit dbd8fa09b823826dd2a30bc119dad7a6fa9a4c6d
Subproject commit 5089e121166c46956a8a21c8ef967f1896c239de

File diff suppressed because one or more lines are too long

@ -14,6 +14,7 @@
use std::ffi::{CStr, CString};
use std::mem;
use std::path::Path;
use libc::{self, c_int, c_uchar, c_uint, c_void, size_t, uint64_t};
@ -72,6 +73,12 @@ impl BlockBasedOptions {
}
}
pub fn disable_cache(&mut self) {
unsafe {
ffi::rocksdb_block_based_options_set_no_block_cache(self.inner, true as c_uchar);
}
}
pub fn set_bloom_filter(&mut self, bits_per_key: c_int, block_based: bool) {
unsafe {
let bloom = if block_based {
@ -221,6 +228,20 @@ impl Options {
}
}
/// If non-zero, we perform bigger reads when doing compaction. If you're
/// running RocksDB on spinning disks, you should set this to at least 2MB.
/// That way RocksDB's compaction is doing sequential instead of random reads.
///
/// When non-zero, we also force new_table_reader_for_compaction_inputs to
/// true.
///
/// Default: `0`
pub fn set_compaction_readahead_size(&mut self, compaction_readahead_size: usize) {
unsafe {
ffi::rocksdb_options_compaction_readahead_size(self.inner, compaction_readahead_size as usize);
}
}
pub fn set_merge_operator(&mut self, name: &str,
full_merge_fn: MergeFn,
partial_merge_fn: Option<MergeFn>) {
@ -986,10 +1007,6 @@ impl Options {
/// `write_buffer_size * memtable_prefix_bloom_ratio` (capped at 0.25).
///
/// Default: `0`
///
/// # Example
///
/// ```
/// use rocksdb::{Options, SliceTransform};
///
/// let mut opts = Options::default();
@ -1002,6 +1019,26 @@ impl Options {
ffi::rocksdb_options_set_memtable_prefix_bloom_size_ratio(self.inner, ratio);
}
}
/// Specifies the absolute path of the directory the
/// write-ahead log (WAL) should be written to.
///
/// Default: same directory as the database
///
/// # Example
///
/// ```
/// use rocksdb::Options;
///
/// let mut opts = Options::default();
/// opts.set_wal_dir("/path/to/dir");
/// ```
pub fn set_wal_dir<P: AsRef<Path>>(&mut self, path: P) {
let p = CString::new(path.as_ref().to_string_lossy().as_bytes()).unwrap();
unsafe {
ffi::rocksdb_options_set_wal_dir(self.inner, p.as_ptr());
}
}
}
impl Default for Options {

Loading…
Cancel
Save