changeset 278:6561a8586c39

db_impl: Add snapshot functions.
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 22 Sep 2017 19:50:00 +0200
parents 3885788d76b8
children c2562c5e7777
files src/db_impl.rs
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/db_impl.rs	Thu Sep 21 18:25:33 2017 +0200
+++ b/src/db_impl.rs	Fri Sep 22 19:50:00 2017 +0200
@@ -84,6 +84,15 @@
         self.cstats[level].add(cs);
     }
 
+
+    pub fn get_snapshot(&mut self) -> Snapshot {
+        self.snaps.new_snapshot(self.vset.last_seq)
+    }
+
+    pub fn release_snapshot(&mut self, snapshot: Snapshot) {
+        self.snaps.delete(snapshot)
+    }
+
     /// make_room_for_write checks if the memtable has become too large, and triggers a compaction
     /// if it's the case.
     fn make_room_for_write(&mut self) -> Result<()> {