Commit 306e2010 authored by Clément Renault's avatar Clément Renault Committed by dorianzheng

Allow to iterate on a specific column family with a snapshot (#259)

parent b2362ce7
...@@ -297,6 +297,13 @@ impl<D: Deref<Target = DB>> Snapshot<D> { ...@@ -297,6 +297,13 @@ impl<D: Deref<Target = DB>> Snapshot<D> {
DBIterator::new(&self.db, opt) DBIterator::new(&self.db, opt)
} }
pub fn iter_cf(&self, cf_handle: &CFHandle, mut opt: ReadOptions) -> DBIterator<&DB> {
unsafe {
opt.set_snapshot(&self.snap);
}
DBIterator::new_cf(&self.db, cf_handle, opt)
}
pub fn get(&self, key: &[u8]) -> Result<Option<DBVector>, String> { pub fn get(&self, key: &[u8]) -> Result<Option<DBVector>, String> {
let mut readopts = ReadOptions::new(); let mut readopts = ReadOptions::new();
unsafe { unsafe {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment