]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kv: add a pair of informative getters to KeyValueDB::TransactionImpl
authorIgor Fedotov <igor.fedotov@croit.io>
Wed, 28 Aug 2024 12:13:22 +0000 (15:13 +0300)
committerIgor Fedotov <ifedotov@croit.io>
Tue, 24 Sep 2024 14:12:30 +0000 (17:12 +0300)
Signed-off-by: Igor Fedotov <igor.fedotov@croit.io>
src/kv/KeyValueDB.h
src/kv/RocksDBStore.h
src/test/ObjectMap/KeyValueDBMemory.h

index 9cfb4482706c967190e9539afc4369b30c184dfe..858742d511ecbc850bf8eebbab9a535d3002091f 100644 (file)
@@ -24,6 +24,12 @@ class KeyValueDB {
 public:
   class TransactionImpl {
   public:
+    // amount of ops included
+    virtual size_t get_count() const = 0;
+
+    // total encoded data size
+    virtual size_t get_size_bytes() const = 0;
+
     /// Set Keys
     void set(
       const std::string &prefix,                      ///< [in] Prefix for keys, or CF name
index a8468a25d4d4bc345cde3074864f9015589679e4..477b209854c6aa635f50ca5dab9f7f0661c7e518 100644 (file)
@@ -299,6 +299,12 @@ public:
       const std::string &k,
       const ceph::bufferlist &to_set_bl);
   public:
+    size_t get_count() const override {
+      return bat.Count();
+    }
+    size_t get_size_bytes() const override {
+      return bat.GetDataSize();
+    }
     void set(
       const std::string &prefix,
       const std::string &k,
index de84ede9049f878a31befbdd8d4c8c4f92cd0cf5..8f6381dd52b275c434b293058d34a0dcd39aff64 100644 (file)
@@ -69,7 +69,14 @@ public:
 
     explicit TransactionImpl_(KeyValueDBMemory *db) : db(db) {}
 
-
+    // dummy implementation
+    size_t get_count() const override {
+      return 0;
+    }
+    // dummy implementation
+    size_t get_size_bytes() const override {
+      return 0;
+    }
     struct SetOp : public Context {
       KeyValueDBMemory *db;
       std::pair<std::string,std::string> key;