#include "journal/Journaler.h"
#include <boost/scope_exit.hpp>
-#include <boost/variant.hpp>
#include "include/ceph_assert.h"
#include <shared_mutex> // for std::shared_lock
+#include <variant>
#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
return io_ctx.tmap_update(RBD_DIRECTORY, cmdbl);
}
- typedef boost::variant<std::string,uint64_t> image_option_value_t;
+ typedef std::variant<std::string, uint64_t> image_option_value_t;
typedef std::map<int,image_option_value_t> image_options_t;
typedef std::shared_ptr<image_options_t> image_options_ref;
return -ENOENT;
}
- *optval = boost::get<std::string>(j->second);
+ *optval = std::get<std::string>(j->second);
return 0;
}
return -ENOENT;
}
- *optval = boost::get<uint64_t>(j->second);
+ *optval = std::get<uint64_t>(j->second);
return 0;
}
#include "librbd/io/AioCompletion.h"
#include "librbd/io/Types.h"
#include "librbd/io/ReadResult.h"
-#include <boost/variant/variant.hpp>
#include <atomic>
+#include <variant>
namespace librbd {
}
};
- typedef boost::variant<Read,
- Discard,
- Write,
- WriteSame,
- CompareAndWrite,
- Flush,
- ListSnaps> Request;
+ typedef std::variant<Read,
+ Discard,
+ Write,
+ WriteSame,
+ CompareAndWrite,
+ Flush,
+ ListSnaps> Request;
C_Dispatcher dispatcher_ctx;
#include "librbd/io/RefreshImageDispatch.h"
#include "librbd/io/Utils.h"
#include "librbd/io/WriteBlockImageDispatch.h"
-#include <boost/variant.hpp>
#include <shared_mutex> // for std::shared_lock
}
}
- return boost::apply_visitor(
+ return std::visit(
SendVisitor{image_dispatch, image_dispatch_spec},
image_dispatch_spec->request);
}
template <typename I>
bool ImageDispatcher<I>::preprocess(
ImageDispatchSpec* image_dispatch_spec) {
- return boost::apply_visitor(
+ return std::visit(
PreprocessVisitor{this, image_dispatch_spec},
image_dispatch_spec->request);
}
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_))
.WillOnce(Invoke([this, offset,
length](io::ImageDispatchSpec* spec) {
- auto* read = boost::get<io::ImageDispatchSpec::Read>(
+ auto* read = std::get_if<io::ImageDispatchSpec::Read>(
&spec->request);
ASSERT_TRUE(read != nullptr);
void expect_image_write() {
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_))
.WillOnce(Invoke([this](io::ImageDispatchSpec* spec) {
- auto* write = boost::get<io::ImageDispatchSpec::Write>(
+ auto* write = std::get_if<io::ImageDispatchSpec::Write>(
&spec->request);
ASSERT_TRUE(write != nullptr);
void expect_image_flush(int r) {
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_)).WillOnce(
Invoke([r](io::ImageDispatchSpec* spec) {
- ASSERT_TRUE(boost::get<io::ImageDispatchSpec::Flush>(
+ ASSERT_TRUE(std::get_if<io::ImageDispatchSpec::Flush>(
&spec->request) != nullptr);
spec->dispatch_result = io::DISPATCH_RESULT_COMPLETE;
spec->aio_comp->set_request_count(1);
void expect_image_write() {
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_))
.WillOnce(Invoke([this](io::ImageDispatchSpec* spec) {
- auto* write = boost::get<io::ImageDispatchSpec::Write>(
+ auto* write = std::get_if<io::ImageDispatchSpec::Write>(
&spec->request);
ASSERT_TRUE(write != nullptr);
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_))
.WillOnce(Invoke([this, offset,
length](io::ImageDispatchSpec* spec) {
- auto* read = boost::get<io::ImageDispatchSpec::Read>(
+ auto* read = std::get_if<io::ImageDispatchSpec::Read>(
&spec->request);
ASSERT_TRUE(read != nullptr);
void expect_image_flush(int r) {
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_)).WillOnce(
Invoke([r](io::ImageDispatchSpec* spec) {
- ASSERT_TRUE(boost::get<io::ImageDispatchSpec::Flush>(
+ ASSERT_TRUE(std::get_if<io::ImageDispatchSpec::Flush>(
&spec->request) != nullptr);
spec->dispatch_result = io::DISPATCH_RESULT_COMPLETE;
spec->aio_comp->set_request_count(1);
void expect_image_flush(int r = 0) {
EXPECT_CALL(*mock_image_ctx->io_image_dispatcher, send(_)).WillOnce(
Invoke([r](io::ImageDispatchSpec* spec) {
- ASSERT_TRUE(boost::get<io::ImageDispatchSpec::Flush>(
+ ASSERT_TRUE(std::get_if<io::ImageDispatchSpec::Flush>(
&spec->request) != nullptr);
spec->dispatch_result = io::DISPATCH_RESULT_COMPLETE;
spec->aio_comp->set_request_count(1);
MATCHER(IsListSnaps, "") {
- auto req = boost::get<io::ImageDispatchSpec::ListSnaps>(&arg->request);
+ auto req = std::get_if<io::ImageDispatchSpec::ListSnaps>(&arg->request);
return (req != nullptr);
}
MATCHER_P2(IsRead, snap_id, image_interval, "") {
- auto req = boost::get<io::ImageDispatchSpec::Read>(&arg->request);
+ auto req = std::get_if<io::ImageDispatchSpec::Read>(&arg->request);
if (req == nullptr ||
arg->io_context->get_read_snap() != snap_id) {
return false;
void expect_flush_io(MockTestImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(*mock_image_ctx.io_image_dispatcher, send(_))
.WillOnce(Invoke([&mock_image_ctx, r](io::ImageDispatchSpec* spec) {
- ASSERT_TRUE(boost::get<io::ImageDispatchSpec::Flush>(
+ ASSERT_TRUE(std::get_if<io::ImageDispatchSpec::Flush>(
&spec->request) != nullptr);
spec->dispatch_result = io::DISPATCH_RESULT_COMPLETE;
auto aio_comp = spec->aio_comp;
void expect_image_flush(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(*mock_image_ctx.io_image_dispatcher, send(_))
.WillOnce(Invoke([r](io::ImageDispatchSpec* spec) {
- ASSERT_TRUE(boost::get<io::ImageDispatchSpec::Flush>(
+ ASSERT_TRUE(std::get_if<io::ImageDispatchSpec::Flush>(
&spec->request) != nullptr);
spec->dispatch_result = io::DISPATCH_RESULT_COMPLETE;
spec->aio_comp->set_request_count(1);
#include "librbd/io/CopyupRequest.cc"
MATCHER_P(IsRead, image_extents, "") {
- auto req = boost::get<librbd::io::ImageDispatchSpec::Read>(&arg->request);
+ auto req = std::get_if<librbd::io::ImageDispatchSpec::Read>(&arg->request);
return (req != nullptr && image_extents == arg->image_extents);
}
send(IsRead(image_extents)))
.WillOnce(Invoke(
[&mock_image_ctx, image_extents, data, r](io::ImageDispatchSpec* spec) {
- auto req = boost::get<librbd::io::ImageDispatchSpec::Read>(
+ auto req = std::get_if<librbd::io::ImageDispatchSpec::Read>(
&spec->request);
ASSERT_TRUE(req != nullptr);
void expect_flush_cache(MockImageCtx &mock_image_ctx, int r) {
EXPECT_CALL(*mock_image_ctx.io_image_dispatcher, send(_))
.WillOnce(Invoke([&mock_image_ctx, r](io::ImageDispatchSpec* spec) {
- ASSERT_TRUE(boost::get<io::ImageDispatchSpec::Flush>(
+ ASSERT_TRUE(std::get_if<io::ImageDispatchSpec::Flush>(
&spec->request) != nullptr);
spec->dispatch_result = io::DISPATCH_RESULT_COMPLETE;
auto aio_comp = spec->aio_comp;