Merge pull request #300 from Standard-Cognition/raw_iterator_cf_opt

Add raw_iterator_cf_opt to the DB API
master
Oleksandr Anyshchenko 5 years ago committed by GitHub
commit e5a7b55daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      src/db.rs

@ -593,21 +593,25 @@ impl<'a> Snapshot<'a> {
DBIterator::new_cf(self.db, cf_handle, &readopts, mode) DBIterator::new_cf(self.db, cf_handle, &readopts, mode)
} }
/// Opens a raw iterator over the data in this snapshot, using the default read options.
pub fn raw_iterator(&self) -> DBRawIterator { pub fn raw_iterator(&self) -> DBRawIterator {
let readopts = ReadOptions::default(); let readopts = ReadOptions::default();
self.raw_iterator_opt(readopts) self.raw_iterator_opt(readopts)
} }
/// Opens a raw iterator over the data in this snapshot under the given column family, using the default read options.
pub fn raw_iterator_cf(&self, cf_handle: ColumnFamily) -> Result<DBRawIterator, Error> { pub fn raw_iterator_cf(&self, cf_handle: ColumnFamily) -> Result<DBRawIterator, Error> {
let readopts = ReadOptions::default(); let readopts = ReadOptions::default();
self.raw_iterator_cf_opt(cf_handle, readopts) self.raw_iterator_cf_opt(cf_handle, readopts)
} }
/// Opens a raw iterator over the data in this snapshot, using the given read options.
pub fn raw_iterator_opt(&self, mut readopts: ReadOptions) -> DBRawIterator { 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)
} }
/// Opens a raw iterator over the data in this snapshot under the given column family, using the given read options.
pub fn raw_iterator_cf_opt( pub fn raw_iterator_cf_opt(
&self, &self,
cf_handle: ColumnFamily, cf_handle: ColumnFamily,
@ -1175,16 +1179,32 @@ impl DB {
) )
} }
/// Opens a raw iterator over the database, using the default read options
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)
} }
/// Opens a raw iterator over the given column family, using the default read options
pub fn raw_iterator_cf(&self, cf_handle: ColumnFamily) -> Result<DBRawIterator, Error> { pub fn raw_iterator_cf(&self, cf_handle: ColumnFamily) -> Result<DBRawIterator, Error> {
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
pub fn raw_iterator_opt(&self, readopts: &ReadOptions) -> DBRawIterator {
DBRawIterator::new(self, readopts)
}
/// Opens a raw iterator over the given column family, using the given read options
pub fn raw_iterator_cf_opt(
&self,
cf_handle: ColumnFamily,
readopts: &ReadOptions,
) -> Result<DBRawIterator, Error> {
DBRawIterator::new_cf(self, cf_handle, readopts)
}
pub fn snapshot(&self) -> Snapshot { pub fn snapshot(&self) -> Snapshot {
Snapshot::new(self) Snapshot::new(self)
} }

Loading…
Cancel
Save