Commit 30463dab authored by zhangjinpeng1987's avatar zhangjinpeng1987

address comments

parent 02604f2f
......@@ -205,7 +205,7 @@ mod tests {
db.put_opt(b"k2-0", b"c", &writeopts).unwrap();
let mut readopts = ReadOptions::new();
readopts.set_iterate_upper_bound("k2");
readopts.set_iterate_upper_bound(b"k2");
let mut iter = db.iter_opt(readopts);
iter.seek(SeekKey::Start);
let mut count = 0;
......
......@@ -42,7 +42,7 @@ pub struct WriteBatch {
pub struct ReadOptions {
inner: rocksdb_ffi::DBReadOptions,
upper_bound: String,
upper_bound: Vec<u8>,
}
/// The UnsafeSnap must be destroyed by db, it maybe be leaked
......@@ -1062,7 +1062,7 @@ impl Drop for ReadOptions {
impl Default for ReadOptions {
fn default() -> ReadOptions {
unsafe {
ReadOptions { inner: rocksdb_ffi::rocksdb_readoptions_create(), upper_bound: String::new() }
ReadOptions { inner: rocksdb_ffi::rocksdb_readoptions_create(), upper_bound: vec![] }
}
}
}
......@@ -1086,8 +1086,8 @@ impl ReadOptions {
snapshot.inner);
}
pub fn set_iterate_upper_bound(&mut self, key: &str) {
self.upper_bound = String::from(key);
pub fn set_iterate_upper_bound(&mut self, key: &[u8]) {
self.upper_bound = Vec::from(key);
unsafe {
rocksdb_ffi::rocksdb_readoptions_set_iterate_upper_bound(self.inner,
self.upper_bound.as_ptr(),
......
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