#include <map>
#include <memory>
-#include <boost/optional.hpp>
+#include <optional>
#include "common/hobject.h"
#include "osd/osd_types.h"
* 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 {
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
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
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