Commit 21516f6f authored by siddontang's avatar siddontang Committed by GitHub

format code (#74)

parent 65a06684
...@@ -155,7 +155,8 @@ extern "C" { ...@@ -155,7 +155,8 @@ extern "C" {
bufno: c_int); bufno: c_int);
pub fn crocksdb_options_set_level0_file_num_compaction_trigger(options: *mut DBOptions, pub fn crocksdb_options_set_level0_file_num_compaction_trigger(options: *mut DBOptions,
no: c_int); no: c_int);
pub fn crocksdb_options_set_level0_slowdown_writes_trigger(options: *mut DBOptions, no: c_int); pub fn crocksdb_options_set_level0_slowdown_writes_trigger(options: *mut DBOptions,
no: c_int);
pub fn crocksdb_options_set_level0_stop_writes_trigger(options: *mut DBOptions, no: c_int); pub fn crocksdb_options_set_level0_stop_writes_trigger(options: *mut DBOptions, no: c_int);
pub fn crocksdb_options_set_write_buffer_size(options: *mut DBOptions, bytes: u64); pub fn crocksdb_options_set_write_buffer_size(options: *mut DBOptions, bytes: u64);
pub fn crocksdb_options_set_target_file_size_base(options: *mut DBOptions, bytes: u64); pub fn crocksdb_options_set_target_file_size_base(options: *mut DBOptions, bytes: u64);
......
use libc::{c_void, c_char, c_int, size_t};
use crocksdb_ffi::{self, DBCompactionFilter}; use crocksdb_ffi::{self, DBCompactionFilter};
use libc::{c_void, c_char, c_int, size_t};
use std::ffi::CString; use std::ffi::CString;
use std::slice; use std::slice;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
extern crate rocksdb; extern crate rocksdb;
use rocksdb::{DB, MergeOperands, Options, Writable}; use rocksdb::{DB, MergeOperands, Options, Writable};
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
// limitations under the License. // limitations under the License.
// //
use libc::{self, c_int, c_void, size_t};
use crocksdb_ffi::{self, DBWriteBatch, DBCFHandle, DBInstance, DBBackupEngine}; use crocksdb_ffi::{self, DBWriteBatch, DBCFHandle, DBInstance, DBBackupEngine};
use libc::{self, c_int, c_void, size_t};
use rocksdb_options::{Options, ReadOptions, UnsafeSnap, WriteOptions, FlushOptions, RestoreOptions}; use rocksdb_options::{Options, ReadOptions, UnsafeSnap, WriteOptions, FlushOptions, RestoreOptions};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::collections::btree_map::Entry; use std::collections::btree_map::Entry;
...@@ -115,7 +113,9 @@ impl<'a> DBIterator<'a> { ...@@ -115,7 +113,9 @@ impl<'a> DBIterator<'a> {
SeekKey::Start => crocksdb_ffi::crocksdb_iter_seek_to_first(self.inner), SeekKey::Start => crocksdb_ffi::crocksdb_iter_seek_to_first(self.inner),
SeekKey::End => crocksdb_ffi::crocksdb_iter_seek_to_last(self.inner), SeekKey::End => crocksdb_ffi::crocksdb_iter_seek_to_last(self.inner),
SeekKey::Key(key) => { SeekKey::Key(key) => {
crocksdb_ffi::crocksdb_iter_seek_for_prev(self.inner, key.as_ptr(), key.len() as size_t) crocksdb_ffi::crocksdb_iter_seek_for_prev(self.inner,
key.as_ptr(),
key.len() as size_t)
} }
} }
} }
...@@ -791,7 +791,9 @@ impl DB { ...@@ -791,7 +791,9 @@ impl DB {
let value = match cf { let value = match cf {
None => crocksdb_ffi::crocksdb_property_value(self.inner, prop_name.as_ptr()), None => crocksdb_ffi::crocksdb_property_value(self.inner, prop_name.as_ptr()),
Some(cf) => { Some(cf) => {
crocksdb_ffi::crocksdb_property_value_cf(self.inner, cf.inner, prop_name.as_ptr()) crocksdb_ffi::crocksdb_property_value_cf(self.inner,
cf.inner,
prop_name.as_ptr())
} }
}; };
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
use compaction_filter::{CompactionFilter, new_compaction_filter, CompactionFilterHandle}; use compaction_filter::{CompactionFilter, new_compaction_filter, CompactionFilterHandle};
use comparator::{self, ComparatorCallback, compare_callback}; use comparator::{self, ComparatorCallback, compare_callback};
use libc::{self, c_int, size_t, c_void};
use merge_operator::{self, MergeOperatorCallback, full_merge_callback, partial_merge_callback};
use merge_operator::MergeFn;
use crocksdb_ffi::{self, DBOptions, DBWriteOptions, DBBlockBasedTableOptions, DBReadOptions, use crocksdb_ffi::{self, DBOptions, DBWriteOptions, DBBlockBasedTableOptions, DBReadOptions,
DBRestoreOptions, DBCompressionType, DBRecoveryMode, DBSnapshot, DBInstance, DBRestoreOptions, DBCompressionType, DBRecoveryMode, DBSnapshot, DBInstance,
DBFlushOptions}; DBFlushOptions};
use libc::{self, c_int, size_t, c_void};
use merge_operator::{self, MergeOperatorCallback, full_merge_callback, partial_merge_callback};
use merge_operator::MergeFn;
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
use std::mem; use std::mem;
...@@ -312,7 +312,8 @@ impl Options { ...@@ -312,7 +312,8 @@ impl Options {
}); });
unsafe { unsafe {
let mo = crocksdb_ffi::crocksdb_mergeoperator_create(mem::transmute(cb), let mo =
crocksdb_ffi::crocksdb_mergeoperator_create(mem::transmute(cb),
merge_operator::destructor_callback, merge_operator::destructor_callback,
full_merge_callback, full_merge_callback,
partial_merge_callback, partial_merge_callback,
...@@ -432,7 +433,8 @@ impl Options { ...@@ -432,7 +433,8 @@ impl Options {
pub fn set_min_write_buffer_number_to_merge(&mut self, to_merge: c_int) { pub fn set_min_write_buffer_number_to_merge(&mut self, to_merge: c_int) {
unsafe { unsafe {
crocksdb_ffi::crocksdb_options_set_min_write_buffer_number_to_merge(self.inner, to_merge); crocksdb_ffi::crocksdb_options_set_min_write_buffer_number_to_merge(self.inner,
to_merge);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment