|
|
@ -1106,12 +1106,12 @@ impl DB { |
|
|
|
self.cfs.get(name) |
|
|
|
self.cfs.get(name) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator<'a, 'b: 'a>(&'a self, mode: IteratorMode) -> DBIterator<'b> { |
|
|
|
pub fn iterator<'a: 'b, 'b>(&'a self, mode: IteratorMode) -> DBIterator<'b> { |
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
let readopts = ReadOptions::default(); |
|
|
|
self.iterator_opt(mode, &readopts) |
|
|
|
self.iterator_opt(mode, &readopts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_opt<'a, 'b: 'a>( |
|
|
|
pub fn iterator_opt<'a: 'b, 'b>( |
|
|
|
&'a self, |
|
|
|
&'a self, |
|
|
|
mode: IteratorMode, |
|
|
|
mode: IteratorMode, |
|
|
|
readopts: &ReadOptions, |
|
|
|
readopts: &ReadOptions, |
|
|
@ -1121,25 +1121,25 @@ impl DB { |
|
|
|
|
|
|
|
|
|
|
|
/// Opens an iterator using the provided ReadOptions.
|
|
|
|
/// Opens an iterator using the provided ReadOptions.
|
|
|
|
/// This is used when you want to iterate over a specific ColumnFamily with a modified ReadOptions
|
|
|
|
/// This is used when you want to iterate over a specific ColumnFamily with a modified ReadOptions
|
|
|
|
pub fn iterator_cf_opt( |
|
|
|
pub fn iterator_cf_opt<'a: 'b, 'b>( |
|
|
|
&self, |
|
|
|
&'a self, |
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
readopts: &ReadOptions, |
|
|
|
readopts: &ReadOptions, |
|
|
|
mode: IteratorMode, |
|
|
|
mode: IteratorMode, |
|
|
|
) -> DBIterator { |
|
|
|
) -> DBIterator<'b> { |
|
|
|
DBIterator::new_cf(self, cf_handle, &readopts, mode) |
|
|
|
DBIterator::new_cf(self, cf_handle, &readopts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Opens an iterator with `set_total_order_seek` enabled.
|
|
|
|
/// Opens an iterator with `set_total_order_seek` enabled.
|
|
|
|
/// This must be used to iterate across prefixes when `set_memtable_factory` has been called
|
|
|
|
/// This must be used to iterate across prefixes when `set_memtable_factory` has been called
|
|
|
|
/// with a Hash-based implementation.
|
|
|
|
/// with a Hash-based implementation.
|
|
|
|
pub fn full_iterator<'a, 'b: 'a>(&'a self, mode: IteratorMode) -> DBIterator<'b> { |
|
|
|
pub fn full_iterator<'a: 'b, 'b>(&'a self, mode: IteratorMode) -> DBIterator<'b> { |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
opts.set_total_order_seek(true); |
|
|
|
opts.set_total_order_seek(true); |
|
|
|
DBIterator::new(self, &opts, mode) |
|
|
|
DBIterator::new(self, &opts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn prefix_iterator<'a, 'b: 'a, P: AsRef<[u8]>>(&'a self, prefix: P) -> DBIterator<'b> { |
|
|
|
pub fn prefix_iterator<'a: 'b, 'b, P: AsRef<[u8]>>(&'a self, prefix: P) -> DBIterator<'b> { |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
opts.set_prefix_same_as_start(true); |
|
|
|
opts.set_prefix_same_as_start(true); |
|
|
|
DBIterator::new( |
|
|
|
DBIterator::new( |
|
|
@ -1149,22 +1149,30 @@ impl DB { |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn iterator_cf(&self, cf_handle: &ColumnFamily, mode: IteratorMode) -> DBIterator { |
|
|
|
pub fn iterator_cf<'a: 'b, 'b>( |
|
|
|
|
|
|
|
&'a self, |
|
|
|
|
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
|
|
|
|
mode: IteratorMode, |
|
|
|
|
|
|
|
) -> DBIterator<'b> { |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, mode) |
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn full_iterator_cf(&self, cf_handle: &ColumnFamily, mode: IteratorMode) -> DBIterator { |
|
|
|
pub fn full_iterator_cf<'a: 'b, 'b>( |
|
|
|
|
|
|
|
&'a self, |
|
|
|
|
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
|
|
|
|
mode: IteratorMode, |
|
|
|
|
|
|
|
) -> DBIterator<'b> { |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
opts.set_total_order_seek(true); |
|
|
|
opts.set_total_order_seek(true); |
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, mode) |
|
|
|
DBIterator::new_cf(self, cf_handle, &opts, mode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn prefix_iterator_cf<P: AsRef<[u8]>>( |
|
|
|
pub fn prefix_iterator_cf<'a: 'b, 'b, P: AsRef<[u8]>>( |
|
|
|
&self, |
|
|
|
&'a self, |
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
prefix: P, |
|
|
|
prefix: P, |
|
|
|
) -> DBIterator { |
|
|
|
) -> DBIterator<'b> { |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
let mut opts = ReadOptions::default(); |
|
|
|
opts.set_prefix_same_as_start(true); |
|
|
|
opts.set_prefix_same_as_start(true); |
|
|
|
DBIterator::new_cf( |
|
|
|
DBIterator::new_cf( |
|
|
@ -1176,28 +1184,28 @@ impl DB { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Opens a raw iterator over the database, using the default read options
|
|
|
|
/// Opens a raw iterator over the database, using the default read options
|
|
|
|
pub fn raw_iterator(&self) -> DBRawIterator { |
|
|
|
pub fn raw_iterator<'a: 'b, 'b>(&'a self) -> DBRawIterator<'b> { |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
DBRawIterator::new(self, &opts) |
|
|
|
DBRawIterator::new(self, &opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Opens a raw iterator over the given column family, using the default read options
|
|
|
|
/// Opens a raw iterator over the given column family, using the default read options
|
|
|
|
pub fn raw_iterator_cf(&self, cf_handle: &ColumnFamily) -> DBRawIterator { |
|
|
|
pub fn raw_iterator_cf<'a: 'b, 'b>(&'a self, cf_handle: &ColumnFamily) -> DBRawIterator<'b> { |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
let opts = ReadOptions::default(); |
|
|
|
DBRawIterator::new_cf(self, cf_handle, &opts) |
|
|
|
DBRawIterator::new_cf(self, cf_handle, &opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Opens a raw iterator over the database, using the given read options
|
|
|
|
/// Opens a raw iterator over the database, using the given read options
|
|
|
|
pub fn raw_iterator_opt(&self, readopts: &ReadOptions) -> DBRawIterator { |
|
|
|
pub fn raw_iterator_opt<'a: 'b, 'b>(&'a self, readopts: &ReadOptions) -> DBRawIterator<'b> { |
|
|
|
DBRawIterator::new(self, readopts) |
|
|
|
DBRawIterator::new(self, readopts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Opens a raw iterator over the given column family, using the given read options
|
|
|
|
/// Opens a raw iterator over the given column family, using the given read options
|
|
|
|
pub fn raw_iterator_cf_opt( |
|
|
|
pub fn raw_iterator_cf_opt<'a: 'b, 'b>( |
|
|
|
&self, |
|
|
|
&'a self, |
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
cf_handle: &ColumnFamily, |
|
|
|
readopts: &ReadOptions, |
|
|
|
readopts: &ReadOptions, |
|
|
|
) -> DBRawIterator { |
|
|
|
) -> DBRawIterator<'b> { |
|
|
|
DBRawIterator::new_cf(self, cf_handle, readopts) |
|
|
|
DBRawIterator::new_cf(self, cf_handle, readopts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|