|
|
@ -885,6 +885,12 @@ impl DB { |
|
|
|
DBIterator::new(self, &opts, mode) |
|
|
|
DBIterator::new(self, &opts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn prefix_iterator<'a>(&self, prefix: &'a [u8]) -> DBIterator { |
|
|
|
|
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
|
|
|
|
opts.set_prefix_same_as_start(true); |
|
|
|
|
|
|
|
DBIterator::new(self, &opts, IteratorMode::From(prefix, Direction::Forward)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_cf( |
|
|
|
pub fn iterator_cf( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
cf_handle: ColumnFamily, |
|
|
|
cf_handle: ColumnFamily, |
|
|
@ -894,6 +900,16 @@ impl DB { |
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, mode) |
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn prefix_iterator_cf<'a>( |
|
|
|
|
|
|
|
&self, |
|
|
|
|
|
|
|
cf_handle: ColumnFamily, |
|
|
|
|
|
|
|
prefix: &'a [u8] |
|
|
|
|
|
|
|
) -> Result<DBIterator, Error> { |
|
|
|
|
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
|
|
|
|
opts.set_prefix_same_as_start(true); |
|
|
|
|
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, IteratorMode::From(prefix, Direction::Forward)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn raw_iterator(&self) -> DBRawIterator { |
|
|
|
pub fn raw_iterator(&self) -> DBRawIterator { |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
DBRawIterator::new(self, &opts) |
|
|
|
DBRawIterator::new(self, &opts) |
|
|
@ -1215,6 +1231,12 @@ impl ReadOptions { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn set_prefix_same_as_start(&mut self, v: bool) { |
|
|
|
|
|
|
|
unsafe { |
|
|
|
|
|
|
|
ffi::rocksdb_readoptions_set_prefix_same_as_start(self.inner, v as c_uchar) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for ReadOptions { |
|
|
|
impl Default for ReadOptions { |
|
|
|