|
|
@ -533,41 +533,70 @@ impl<'a> Snapshot<'a> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator(&self, mode: IteratorMode) -> DBIterator { |
|
|
|
pub fn iterator(&self, mode: IteratorMode) -> DBIterator { |
|
|
|
let mut readopts = ReadOptions::default(); |
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
self.iterator_opt(mode, readopts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_cf( |
|
|
|
|
|
|
|
&self, |
|
|
|
|
|
|
|
cf_handle: ColumnFamily, |
|
|
|
|
|
|
|
mode: IteratorMode, |
|
|
|
|
|
|
|
) -> Result<DBIterator, Error> { |
|
|
|
|
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
self.iterator_cf_opt(cf_handle, readopts, mode) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_opt(&self, mode: IteratorMode, mut readopts: ReadOptions) -> DBIterator { |
|
|
|
readopts.set_snapshot(self); |
|
|
|
readopts.set_snapshot(self); |
|
|
|
DBIterator::new(self.db, &readopts, mode) |
|
|
|
DBIterator::new(self.db, &readopts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_cf( |
|
|
|
pub fn iterator_cf_opt( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
cf_handle: ColumnFamily, |
|
|
|
cf_handle: ColumnFamily, |
|
|
|
|
|
|
|
mut readopts: ReadOptions, |
|
|
|
mode: IteratorMode, |
|
|
|
mode: IteratorMode, |
|
|
|
) -> Result<DBIterator, Error> { |
|
|
|
) -> Result<DBIterator, Error> { |
|
|
|
let mut readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
readopts.set_snapshot(self); |
|
|
|
readopts.set_snapshot(self); |
|
|
|
DBIterator::new_cf(self.db, cf_handle, &readopts, mode) |
|
|
|
DBIterator::new_cf(self.db, cf_handle, &readopts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn raw_iterator(&self) -> DBRawIterator { |
|
|
|
pub fn raw_iterator(&self) -> DBRawIterator { |
|
|
|
let mut readopts = ReadOptions::default(); |
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
self.raw_iterator_opt(readopts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn raw_iterator_cf(&self, cf_handle: ColumnFamily) -> Result<DBRawIterator, Error> { |
|
|
|
|
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
self.raw_iterator_cf_opt(cf_handle, readopts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn raw_iterator_opt(&self, mut readopts: ReadOptions) -> DBRawIterator { |
|
|
|
readopts.set_snapshot(self); |
|
|
|
readopts.set_snapshot(self); |
|
|
|
DBRawIterator::new(self.db, &readopts) |
|
|
|
DBRawIterator::new(self.db, &readopts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn raw_iterator_cf(&self, cf_handle: ColumnFamily) -> Result<DBRawIterator, Error> { |
|
|
|
pub fn raw_iterator_cf_opt(&self, cf_handle: ColumnFamily, mut readopts: ReadOptions) -> Result<DBRawIterator, Error> { |
|
|
|
let mut readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
readopts.set_snapshot(self); |
|
|
|
readopts.set_snapshot(self); |
|
|
|
DBRawIterator::new_cf(self.db, cf_handle, &readopts) |
|
|
|
DBRawIterator::new_cf(self.db, cf_handle, &readopts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn get(&self, key: &[u8]) -> Result<Option<DBVector>, Error> { |
|
|
|
pub fn get(&self, key: &[u8]) -> Result<Option<DBVector>, Error> { |
|
|
|
let mut readopts = ReadOptions::default(); |
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
self.get_opt(key, readopts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_cf(&self, cf: ColumnFamily, key: &[u8]) -> Result<Option<DBVector>, Error> { |
|
|
|
|
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
self.get_cf_opt(cf, key, readopts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn get_opt(&self, key: &[u8], mut readopts: ReadOptions) -> Result<Option<DBVector>, Error> { |
|
|
|
readopts.set_snapshot(self); |
|
|
|
readopts.set_snapshot(self); |
|
|
|
self.db.get_opt(key, &readopts) |
|
|
|
self.db.get_opt(key, &readopts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn get_cf(&self, cf: ColumnFamily, key: &[u8]) -> Result<Option<DBVector>, Error> { |
|
|
|
pub fn get_cf_opt(&self, cf: ColumnFamily, key: &[u8], mut readopts: ReadOptions) -> Result<Option<DBVector>, Error> { |
|
|
|
let mut readopts = ReadOptions::default(); |
|
|
|
|
|
|
|
readopts.set_snapshot(self); |
|
|
|
readopts.set_snapshot(self); |
|
|
|
self.db.get_cf_opt(cf, key, &readopts) |
|
|
|
self.db.get_cf_opt(cf, key, &readopts) |
|
|
|
} |
|
|
|
} |
|
|
@ -914,8 +943,12 @@ impl DB { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator(&self, mode: IteratorMode) -> DBIterator { |
|
|
|
pub fn iterator(&self, mode: IteratorMode) -> DBIterator { |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
DBIterator::new(self, &opts, mode) |
|
|
|
self.iterator_opt(mode, &readopts) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_opt(&self, mode: IteratorMode, readopts: &ReadOptions) -> DBIterator { |
|
|
|
|
|
|
|
DBIterator::new(self, &readopts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Opens an interator with `set_total_order_seek` enabled.
|
|
|
|
/// Opens an interator with `set_total_order_seek` enabled.
|
|
|
|