From 6cf5be4a61c361da5680ca3448683052d7e82dae Mon Sep 17 00:00:00 2001 From: Renar Narubin Date: Tue, 23 Apr 2019 14:08:31 -0700 Subject: [PATCH 1/2] Add raw_iterator_cf_opt to the DB API The underlying functionality already existed, but it wasn't exposed to the top-level API. --- src/db.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/db.rs b/src/db.rs index 4c1e233..d82a8f2 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1167,6 +1167,14 @@ impl DB { DBRawIterator::new_cf(self, cf_handle, &opts) } + pub fn raw_iterator_cf_opt( + &self, + cf_handle: ColumnFamily, + readopts: &ReadOptions, + ) -> Result { + DBRawIterator::new_cf(self, cf_handle, readopts) + } + pub fn snapshot(&self) -> Snapshot { Snapshot::new(self) } From 1159f3198780fe3dc548eccec7ed1d102a553aae Mon Sep 17 00:00:00 2001 From: Renar Narubin Date: Fri, 19 Jul 2019 12:34:53 -0700 Subject: [PATCH 2/2] Document the raw_iterator methods --- src/db.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/db.rs b/src/db.rs index d82a8f2..21b8c40 100644 --- a/src/db.rs +++ b/src/db.rs @@ -588,21 +588,25 @@ impl<'a> Snapshot<'a> { 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 { let readopts = ReadOptions::default(); 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 { let readopts = ReadOptions::default(); 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 { readopts.set_snapshot(self); 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( &self, cf_handle: ColumnFamily, @@ -1157,16 +1161,24 @@ impl DB { ) } + /// Opens a raw iterator over the database, using the default read options pub fn raw_iterator(&self) -> DBRawIterator { let opts = ReadOptions::default(); 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 { let opts = ReadOptions::default(); 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,