Merge pull request #50 from ngaut/ngaut/tiny-clean-up

*: Tiny clean up.
master
Tyler Neely 9 years ago
commit 3048f8fdb2
  1. 24
      src/comparator.rs
  2. 2
      src/merge_operator.rs
  3. 3
      src/rocksdb.rs

@ -53,27 +53,3 @@ pub extern "C" fn compare_callback(raw_cb: *mut c_void,
(cb.f)(a, b)
}
}
fn test_reverse_compare(a: &[u8], b: &[u8]) -> c_int {
if a < b {
1
} else if a > b {
-1
} else {
0
}
}
// #[allow(dead_code)]
// #[test]
// fn compare_works() {
// let path = "_rust_rocksdb_comparetest";
// let mut opts = Options::new();
// opts.create_if_missing(true);
// opts.add_comparator("test comparator", test_reverse_compare);
// {
// let db = DB::open(&opts, path).unwrap();
// // TODO add interesting test
// }
// assert!(DB::destroy(&opts, path).is_ok());
// }

@ -152,6 +152,8 @@ impl<'a> Iterator for &'a mut MergeOperands {
}
}
#[allow(unused_variables)]
#[allow(dead_code)]
fn test_provided_merge(new_key: &[u8],
existing_val: Option<&[u8]>,
operands: &mut MergeOperands)

@ -818,6 +818,7 @@ impl ReadOptions {
// TODO add snapshot setting here
// TODO add snapshot wrapper structs with proper destructors;
// that struct needs an "iterator" impl too.
#[allow(dead_code)]
fn fill_cache(&mut self, v: bool) {
unsafe {
rocksdb_ffi::rocksdb_readoptions_set_fill_cache(self.inner, v);
@ -854,13 +855,11 @@ impl Drop for DBVector {
impl DBVector {
pub fn from_c(val: *mut u8, val_len: size_t) -> DBVector {
unsafe {
DBVector {
base: val,
len: val_len as usize,
}
}
}
pub fn to_utf8<'a>(&'a self) -> Option<&'a str> {
from_utf8(self.deref()).ok()

Loading…
Cancel
Save