Blame SOURCES/0006-os-KeyValueDB-make-compaction-interface-generic.patch

4b13ad
From 38e4b6a19202ed0afa7700e37faaaea2903199ca Mon Sep 17 00:00:00 2001
4b13ad
From: Sage Weil <sage@inktank.com>
4b13ad
Date: Mon, 31 Mar 2014 18:05:13 -0700
4b13ad
Subject: [PATCH] os/KeyValueDB: make compaction interface generic
4b13ad
4b13ad
Signed-off-by: Sage Weil <sage@inktank.com>
4b13ad
(cherry picked from commit 86a0b9dd9ad2f3b0996b3f72a79fd1b13726b4ad)
4b13ad
---
4b13ad
 src/os/KeyValueDB.h   | 12 ++++++++++++
4b13ad
 src/os/LevelDBStore.h | 13 ++++++++-----
4b13ad
 2 files changed, 20 insertions(+), 5 deletions(-)
4b13ad
4b13ad
diff --git a/src/os/KeyValueDB.h b/src/os/KeyValueDB.h
4b13ad
index f8e0b68..3929ed4 100644
4b13ad
--- a/src/os/KeyValueDB.h
4b13ad
+++ b/src/os/KeyValueDB.h
4b13ad
@@ -179,6 +179,18 @@ public:
4b13ad
 
4b13ad
   virtual ~KeyValueDB() {}
4b13ad
 
4b13ad
+  /// compact the underlying store
4b13ad
+  virtual void compact() {}
4b13ad
+
4b13ad
+  /// compact db for all keys with a given prefix
4b13ad
+  virtual void compact_prefix(const string& prefix) {}
4b13ad
+  /// compact db for all keys with a given prefix, async
4b13ad
+  virtual void compact_prefix_async(const string& prefix) {}
4b13ad
+  virtual void compact_range(const string& prefix,
4b13ad
+			     const string& start, const string& end) {}
4b13ad
+  virtual void compact_range_async(const string& prefix,
4b13ad
+				   const string& start, const string& end) {}
4b13ad
+
4b13ad
 protected:
4b13ad
   virtual WholeSpaceIterator _get_iterator() = 0;
4b13ad
   virtual WholeSpaceIterator _get_snapshot_iterator() = 0;
4b13ad
diff --git a/src/os/LevelDBStore.h b/src/os/LevelDBStore.h
4b13ad
index 1c072da..3dbc0f9 100644
4b13ad
--- a/src/os/LevelDBStore.h
4b13ad
+++ b/src/os/LevelDBStore.h
4b13ad
@@ -85,21 +85,24 @@ public:
4b13ad
   /// compact the underlying leveldb store
4b13ad
   void compact();
4b13ad
 
4b13ad
-  /// compact leveldb for all keys with a given prefix
4b13ad
+  /// compact db for all keys with a given prefix
4b13ad
   void compact_prefix(const string& prefix) {
4b13ad
     compact_range(prefix, past_prefix(prefix));
4b13ad
   }
4b13ad
   void compact_prefix_async(const string& prefix) {
4b13ad
     compact_range_async(prefix, past_prefix(prefix));
4b13ad
   }
4b13ad
-
4b13ad
-  void compact_range(const string& prefix, const string& start, const string& end) {
4b13ad
+  void compact_range(const string& prefix,
4b13ad
+		     const string& start, const string& end) {
4b13ad
     compact_range(combine_strings(prefix, start), combine_strings(prefix, end));
4b13ad
   }
4b13ad
-  void compact_range_async(const string& prefix, const string& start, const string& end) {
4b13ad
-    compact_range_async(combine_strings(prefix, start), combine_strings(prefix, end));
4b13ad
+  void compact_range_async(const string& prefix,
4b13ad
+			   const string& start, const string& end) {
4b13ad
+    compact_range_async(combine_strings(prefix, start),
4b13ad
+			combine_strings(prefix, end));
4b13ad
   }
4b13ad
 
4b13ad
+
4b13ad
   /**
4b13ad
    * options_t: Holds options which are minimally interpreted
4b13ad
    * on initialization and then passed through to LevelDB.
4b13ad
-- 
4b13ad
1.9.3
4b13ad