Commit f748faa5 authored by siddontang's avatar siddontang

rename len to data_size

parent 95300161
...@@ -892,11 +892,11 @@ impl WriteBatch { ...@@ -892,11 +892,11 @@ impl WriteBatch {
self.count() == 0 self.count() == 0
} }
pub fn len(&self) -> usize { pub fn data_size(&self) -> usize {
unsafe { unsafe {
let mut length: usize = 0; let mut data_size: usize = 0;
let _ = rocksdb_ffi::rocksdb_writebatch_data(self.inner, &mut length); let _ = rocksdb_ffi::rocksdb_writebatch_data(self.inner, &mut data_size);
return length; return data_size;
} }
} }
...@@ -1118,11 +1118,11 @@ mod test { ...@@ -1118,11 +1118,11 @@ mod test {
assert!(db.get(b"k1").unwrap().is_none()); assert!(db.get(b"k1").unwrap().is_none());
let batch = WriteBatch::new(); let batch = WriteBatch::new();
let prev_len = batch.len(); let prev_size = batch.data_size();
let _ = batch.delete(b"k1"); let _ = batch.delete(b"k1");
assert!(batch.len() > 0); assert!(batch.data_size() > prev_size);
batch.clear(); batch.clear();
assert_eq!(batch.len(), prev_len); assert_eq!(batch.data_size(), prev_size);
} }
#[test] #[test]
......
use rocksdb::{DB, Options, Range, Writable};use tempdir::TempDir; use rocksdb::{DB, Options, Range, Writable};
use tempdir::TempDir;
#[test] #[test]
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
use rocksdb::{Writable, DB, CompactionFilter, Options}; use rocksdb::{Writable, DB, CompactionFilter, Options};
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::sync::atomic::{AtomicBool, Ordering};use tempdir::TempDir; use std::sync::atomic::{AtomicBool, Ordering};
use tempdir::TempDir;
struct Filter { struct Filter {
drop_called: Arc<AtomicBool>, drop_called: Arc<AtomicBool>,
......
use rocksdb::{DB, Options};use tempdir::TempDir; use rocksdb::{DB, Options};
use tempdir::TempDir;
#[test] #[test]
...@@ -22,4 +23,3 @@ fn test_log_file_opt() { ...@@ -22,4 +23,3 @@ fn test_log_file_opt() {
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap(); let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
drop(db); drop(db);
} }
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