#pragma once
-#include <boost/variant.hpp>
-#include <boost/blank.hpp>
+#include <variant>
#include "common/ceph_crypto.h"
#include "rgw_blake3_digest.h"
#include "rgw_crc_digest.h"
typedef TDigest<ceph::crypto::SHA512> SHA512;
typedef TDigest<rgw::digest::Crc64Nvme> Crc64Nvme;
- typedef boost::variant<boost::blank,
- Blake3,
- Crc32,
- Crc32c,
- XXH3,
- SHA1,
- SHA256,
- SHA512,
- Crc64Nvme> DigestVariant;
+ typedef std::variant<std::monostate,
+ Blake3,
+ Crc32,
+ Crc32c,
+ XXH3,
+ SHA1,
+ SHA256,
+ SHA512,
+ Crc64Nvme> DigestVariant;
- struct get_digest_ptr : public boost::static_visitor<Digest*>
+ struct get_digest_ptr
{
get_digest_ptr() {};
- Digest* operator()(const boost::blank& b) const { return nullptr; }
+ Digest* operator()(const std::monostate& b) const { return nullptr; }
Digest* operator()(Blake3& digest) const { return &digest; }
Digest* operator()(Crc32& digest) const { return &digest; }
Digest* operator()(Crc32c& digest) const { return &digest; }
static inline Digest* get_digest(DigestVariant& ev)
{
- return boost::apply_visitor(get_digest_ptr{}, ev);
+ return std::visit(get_digest_ptr{}, ev);
}
static inline DigestVariant digest_factory(const Type cksum_type)
case Type::none:
break;
};
- return boost::blank();
+ return std::monostate();
} /* digest_factory */
static inline Cksum finalize_digest(Digest* digest, Type type)
goto rele;
}
/* maybe clear state */
- d = get<directory>(&rgw_fh->variant_type);
+ d = std::get_if<directory>(&rgw_fh->variant_type);
if (d) {
struct timespec ev_ts = ev.ts;
lock_guard guard(rgw_fh->mtx);
std::ostream& operator<<(std::ostream &os,
RGWFileHandle::readdir_offset const &offset)
{
- using boost::get;
- if (unlikely(!! get<uint64_t*>(&offset))) {
+ if (unlikely(!!std::get_if<uint64_t*>(&offset))) {
uint64_t* ioff = get<uint64_t*>(offset);
os << *ioff;
}
<< object_name()
<< dendl;
- directory* d = get<directory>(&variant_type);
+ directory* d = std::get_if<directory>(&variant_type);
if (d) {
(void) clock_gettime(CLOCK_MONOTONIC_COARSE, &now); /* !LOCKED */
lock_guard guard(mtx);
bool initial_off;
char* mk{nullptr};
- if (likely(!! get<const char*>(&offset))) {
+ if (likely(!!std::get_if<const char*>(&offset))) {
mk = const_cast<char*>(get<const char*>(offset));
initial_off = !mk;
} else {
int rc = 0;
- file* f = get<file>(&variant_type);
+ file* f = std::get_if<file>(&variant_type);
if (! f)
return -EISDIR;
guard.lock();
}
- file* f = get<file>(&variant_type);
+ file* f = std::get_if<file>(&variant_type);
if (f && (f->write_req)) {
lsubdout(fs->get_context(), rgw, 10)
<< __func__
void RGWFileHandle::clear_state()
{
- directory* d = get<directory>(&variant_type);
+ directory* d = std::get_if<directory>(&variant_type);
if (d) {
state.nlink = 2;
d->last_marker = rgw_obj_key{};
}
bool RGWListBucketsRequest::eof() {
- using boost::get;
-
if (unlikely(cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15))) {
bool is_offset =
- unlikely(! get<const char*>(&offset)) ||
+ unlikely(!std::get_if<const char*>(&offset)) ||
!! get<const char*>(offset);
lsubdout(cct, rgw, 15) << "READDIR offset: " <<
((is_offset) ? offset : "(nil)")
}
bool RGWReaddirRequest::eof() {
- using boost::get;
-
if (unlikely(cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15))) {
bool is_offset =
- unlikely(! get<const char*>(&offset)) ||
+ unlikely(!std::get_if<const char*>(&offset)) ||
!! get<const char*>(offset);
lsubdout(cct, rgw, 15) << "READDIR offset: " <<
((is_offset) ? offset : "(nil)")
#include <boost/intrusive_ptr.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/container/flat_map.hpp>
-#include <boost/variant.hpp>
#include <boost/optional.hpp>
#include "xxhash.h"
#include "include/buffer.h"
return (lhs < rhs) || (lhs == rhs);
}
- using boost::variant;
using boost::container::flat_map;
typedef std::tuple<bool, bool> DecodeAttrsResult;
void clear_state();
void advance_mtime(uint32_t flags = FLAG_NONE);
- boost::variant<file, directory> variant_type;
+ std::variant<file, directory> variant_type;
uint16_t depth;
uint32_t flags;
}
directory* get_directory() {
- return boost::get<directory>(&variant_type);
+ return std::get_if<directory>(&variant_type);
}
size_t get_size() const { return state.size; }
void add_marker(uint64_t off, const rgw_obj_key& marker,
uint8_t obj_type) {
- using std::get;
- directory* d = get<directory>(&variant_type);
+ directory* d = std::get_if<directory>(&variant_type);
if (d) {
unique_lock guard(mtx);
d->last_marker = marker;
const rgw_obj_key* find_marker(uint64_t off) const {
using std::get;
if (off > 0) {
- const directory* d = get<directory>(&variant_type);
- if (d ) {
+ const directory* d = std::get_if<directory>(&variant_type);
+ if (d) {
return &d->last_marker;
}
}
return -EPERM;
}
- typedef boost::variant<uint64_t*, const char*> readdir_offset;
+ typedef std::variant<uint64_t*, const char*> readdir_offset;
int readdir(rgw_readdir_cb rcb, void *cb_arg, readdir_offset offset,
bool *eof, uint32_t flags);
cb_arg(_cb_arg), rcb(_rcb), ioff(nullptr), ix(0), d_count(0),
rcb_eof(false) {
- using boost::get;
-
- if (unlikely(!! get<uint64_t*>(&offset))) {
+ if (unlikely(!! std::get_if<uint64_t*>(&offset))) {
ioff = get<uint64_t*>(offset);
const auto& mk = rgw_fh->find_marker(*ioff);
if (mk) {
cb_arg(_cb_arg), rcb(_rcb), ioff(nullptr), ix(0), d_count(0),
rcb_eof(false) {
- using boost::get;
-
- if (unlikely(!! get<uint64_t*>(&offset))) {
+ if (unlikely(!! std::get_if<uint64_t*>(&offset))) {
ioff = get<uint64_t*>(offset);
const auto& mk = rgw_fh->find_marker(*ioff);
if (mk) {
}; /* LCOpRule */
using WorkItem =
- boost::variant<void*,
- /* out-of-line delete */
- std::tuple<LCOpRule, rgw_bucket_dir_entry>,
- /* uncompleted MPU expiration */
- std::tuple<lc_op, rgw_bucket_dir_entry>,
- rgw_bucket_dir_entry>;
+ std::variant<void*,
+ /* out-of-line delete */
+ std::tuple<LCOpRule, rgw_bucket_dir_entry>,
+ /* uncompleted MPU expiration */
+ std::tuple<lc_op, rgw_bucket_dir_entry>,
+ rgw_bucket_dir_entry>;
class WorkQ : public Thread
{
public:
using unique_lock = std::unique_lock<std::mutex>;
using work_f = std::function<void(RGWLC::LCWorker*, WorkQ*, WorkItem&)>;
- using dequeue_result = boost::variant<void*, WorkItem>;
+ using dequeue_result = std::variant<void*, WorkItem>;
static constexpr uint32_t FLAG_NONE = 0x0000;
static constexpr uint32_t FLAG_EWAIT_SYNC = 0x0001;
void* entry() override {
while (!wk->get_lc()->going_down()) {
auto item = dequeue();
- if (item.which() == 0) {
+ if (item.index() == 0) {
/* going down */
break;
}
- f(wk, this, boost::get<WorkItem>(item));
+ f(wk, this, std::get<WorkItem>(item));
}
return nullptr;
}
auto pf = [&](RGWLC::LCWorker *wk, WorkQ *wq, WorkItem &wi) {
int ret{0};
- auto wt = boost::get<std::tuple<lc_op, rgw_bucket_dir_entry>>(wi);
+ auto wt = std::get<std::tuple<lc_op, rgw_bucket_dir_entry>>(wi);
auto& [rule, obj] = wt;
if (obj_has_expired(this, cct, obj.meta.mtime, rule.mp_expiration)) {
auto pf = [&bucket_name](RGWLC::LCWorker* wk, WorkQ* wq, WorkItem& wi) {
auto wt =
- boost::get<std::tuple<LCOpRule, rgw_bucket_dir_entry>>(wi);
+ std::get<std::tuple<LCOpRule, rgw_bucket_dir_entry>>(wi);
auto& [op_rule, o] = wt;
ldpp_dout(wk->get_lc(), 20)