]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/osd/PGTransaction.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / osd / PGTransaction.h
index e3a7b8e1e8206e6b7cf561b9587f33000065f581..51657c706ca4b2c73d85e85d125922b601a536f5 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <map>
 #include <memory>
-#include <boost/optional.hpp>
+#include <optional>
 
 #include "common/hobject.h"
 #include "osd/osd_types.h"
@@ -127,24 +127,24 @@ public:
      * remember the lowest truncate and the final object size
      * (the last truncate).  We also adjust the buffers map
      * to account for truncates overriding previous writes */
-    boost::optional<pair<uint64_t, uint64_t> > truncate = boost::none;
+    std::optional<pair<uint64_t, uint64_t> > truncate = std::nullopt;
 
-    std::map<string, boost::optional<bufferlist> > attr_updates;
+    std::map<string, std::optional<bufferlist> > attr_updates;
 
-    enum class OmapUpdateType {Remove, Insert};
+    enum class OmapUpdateType {Remove, Insert, RemoveRange};
     std::vector<std::pair<OmapUpdateType, bufferlist> > omap_updates;
 
-    boost::optional<bufferlist> omap_header;
+    std::optional<bufferlist> omap_header;
 
     /// (old, new) -- only valid with no truncate or buffer updates
-    boost::optional<pair<set<snapid_t>, set<snapid_t> > > updated_snaps;
+    std::optional<pair<set<snapid_t>, set<snapid_t> > > updated_snaps;
 
     struct alloc_hint_t {
       uint64_t expected_object_size;
       uint64_t expected_write_size;
       uint32_t flags;
     };
-    boost::optional<alloc_hint_t> alloc_hint;
+    std::optional<alloc_hint_t> alloc_hint;
 
     struct BufferUpdate {
       struct Write {
@@ -338,7 +338,7 @@ public:
     auto &op = get_object_op_for_modify(hoid);
     op.clear_omap = true;
     op.omap_updates.clear();
-    op.omap_header = boost::none;
+    op.omap_header = std::nullopt;
   }
   void truncate(
     const hobject_t &hoid,         ///< [in] object
@@ -383,7 +383,7 @@ public:
     const string &attrname         ///< [in] attr to remove
     ) {
     auto &op = get_object_op_for_modify(hoid);
-    op.attr_updates[attrname] = boost::none;
+    op.attr_updates[attrname] = std::nullopt;
   }
 
   /// set alloc hint
@@ -479,6 +479,26 @@ public:
     encode(keys, bl);
     omap_rmkeys(hoid, bl);
   }
+  void omap_rmkeyrange(
+    const hobject_t &hoid,         ///< [in] object to write
+    bufferlist &range_bl           ///< [in] encode string[2]
+    ) {
+    auto &op = get_object_op_for_modify(hoid);
+    op.omap_updates.emplace_back(
+      make_pair(
+       ObjectOperation::OmapUpdateType::RemoveRange,
+       range_bl));
+  }
+  void omap_rmkeyrange(
+    const hobject_t &hoid,         ///< [in] object to write
+    std::string& key_begin,        ///< [in] first key in range
+    std::string& key_end           ///< [in] first key past range, range is [first,last)
+    ) {
+    bufferlist bl;
+    ::encode(key_begin, bl);
+    ::encode(key_end, bl);
+    omap_rmkeyrange(hoid, bl);
+  }
   void omap_setheader(
     const hobject_t &hoid,         ///< [in] object to write
     bufferlist &header             ///< [in] header