#ifndef HAVE_BOOST_CONTEXT
-// hide the dependencies on boost::context and boost::coroutines
-namespace boost::asio {
+// hide the dependency on boost::context
+namespace spawn {
struct yield_context;
}
#else // HAVE_BOOST_CONTEXT
-#ifndef BOOST_COROUTINES_NO_DEPRECATION_WARNING
-#define BOOST_COROUTINES_NO_DEPRECATION_WARNING
-#endif
-#include <boost/asio/spawn.hpp>
+#include <spawn/spawn.hpp>
#endif // HAVE_BOOST_CONTEXT
-/// optional-like wrapper for a boost::asio::yield_context and its associated
+/// optional-like wrapper for a spawn::yield_context and its associated
/// boost::asio::io_context. operations that take an optional_yield argument
/// will, when passed a non-empty yield context, suspend this coroutine instead
/// of the blocking the thread of execution
class optional_yield {
boost::asio::io_context *c = nullptr;
- boost::asio::yield_context *y = nullptr;
+ spawn::yield_context *y = nullptr;
public:
/// construct with a valid io and yield_context
explicit optional_yield(boost::asio::io_context& c,
- boost::asio::yield_context& y) noexcept
+ spawn::yield_context& y) noexcept
: c(&c), y(&y) {}
/// type tag to construct an empty object
boost::asio::io_context& get_io_context() const noexcept { return *c; }
/// return a reference to the yield_context. only valid if non-empty
- boost::asio::yield_context& get_yield_context() const noexcept { return *y; }
+ spawn::yield_context& get_yield_context() const noexcept { return *y; }
};
// type tag object to construct an empty optional_yield
target_include_directories(rgw_common PUBLIC "${CMAKE_SOURCE_DIR}/src/dmclock/support/src")
target_include_directories(rgw_common PUBLIC "${CMAKE_SOURCE_DIR}/src/fmt/include")
+if(WITH_BOOST_CONTEXT)
+ target_link_libraries(rgw_common PUBLIC spawn)
+endif()
+
if(WITH_LTTNG)
# rgw/rgw_op.cc includes "tracing/rgw_op.h"
# rgw/rgw_rados.cc includes "tracing/rgw_rados.h"
endif()
if(WITH_BOOST_CONTEXT)
- target_link_libraries(rgw_a PRIVATE spawn)
+ target_link_libraries(rgw_a PUBLIC spawn)
endif()
set(rgw_libs rgw_a)
rgw_dmclock_async_scheduler.cc)
endif()
+add_library(rgw_schedulers STATIC ${rgw_schedulers_srcs})
+target_link_libraries(rgw_schedulers
+ PUBLIC dmclock::dmclock)
+
add_library(radosgw SHARED ${radosgw_srcs} ${rgw_a_srcs} rgw_main.cc
$<TARGET_OBJECTS:civetweb_common_objs>)
PRIVATE ${rgw_libs} rgw_schedulers
PUBLIC dmclock::dmclock
)
-if(WITH_RADOSGW_BEAST_FRONTEND AND WITH_RADOSGW_BEAST_OPENSSL)
-target_link_libraries(radosgw
- # used by rgw_asio_frontend.cc
- PRIVATE OpenSSL::SSL)
+if(WITH_RADOSGW_BEAST_FRONTEND)
+ target_link_libraries(rgw_schedulers PUBLIC spawn)
+ if(WITH_RADOSGW_BEAST_OPENSSL)
+ # used by rgw_asio_frontend.cc
+ target_link_libraries(radosgw PRIVATE OpenSSL::SSL)
+ endif()
endif()
set_target_properties(radosgw PROPERTIES OUTPUT_NAME radosgw VERSION 2.0.0
SOVERSION 2)
install(TARGETS radosgw DESTINATION ${CMAKE_INSTALL_LIBDIR})
-add_library(rgw_schedulers STATIC ${rgw_schedulers_srcs})
-target_link_libraries(rgw_schedulers
- PUBLIC dmclock::dmclock)
-
add_executable(radosgwd radosgw.cc)
target_link_libraries(radosgwd radosgw librados
cls_rgw_client cls_otp_client cls_lock_client cls_refcount_client
if(WITH_RADOSGW_KAFKA_ENDPOINT)
target_link_libraries(rgw_admin_user PRIVATE RDKafka::RDKafka)
endif()
-if(WITH_BOOST_CONTEXT)
- target_link_libraries(rgw_admin_user PRIVATE Boost::coroutine Boost::context)
-endif()
if(WITH_TESTS)
add_executable(ceph_rgw_jsonparser
template <typename Op>
Aio::OpFunc aio_abstract(Op&& op, boost::asio::io_context& context,
- boost::asio::yield_context yield) {
+ spawn::yield_context yield) {
return [op = std::move(op), &context, yield] (Aio* aio, AioResult& r) mutable {
// arrange for the completion Handler to run on the yield_context's strand
// executor so it can safely call back into Aio without locking
using namespace boost::asio;
- async_completion<yield_context, void()> init(yield);
+ async_completion<spawn::yield_context, void()> init(yield);
auto ex = get_associated_executor(init.completion_handler);
auto& ref = r.obj.get_ref();
// functions must be called within the coroutine strand
class YieldingAioThrottle final : public Aio, private Throttle {
boost::asio::io_context& context;
- boost::asio::yield_context yield;
+ spawn::yield_context yield;
struct Handler;
// completion callback associated with the waiter
public:
YieldingAioThrottle(uint64_t window, boost::asio::io_context& context,
- boost::asio::yield_context yield)
+ spawn::yield_context yield)
: Throttle(window), context(context), yield(yield)
{}
#include <vector>
#include <boost/asio.hpp>
-#define BOOST_COROUTINES_NO_DEPRECATION_WARNING
-#include <boost/range/begin.hpp>
-#include <boost/range/end.hpp>
-#include <boost/asio/spawn.hpp>
#include <boost/intrusive/list.hpp>
+#include <spawn/spawn.hpp>
+
#include "common/async/shared_mutex.h"
#include "common/errno.h"
class StreamIO : public rgw::asio::ClientIO {
CephContext* const cct;
Stream& stream;
- boost::asio::yield_context yield;
+ spawn::yield_context yield;
parse_buffer& buffer;
public:
StreamIO(CephContext *cct, Stream& stream, rgw::asio::parser_type& parser,
- boost::asio::yield_context yield,
+ spawn::yield_context yield,
parse_buffer& buffer, bool is_ssl,
const tcp::endpoint& local_endpoint,
const tcp::endpoint& remote_endpoint)
SharedMutex& pause_mutex,
rgw::dmclock::Scheduler *scheduler,
boost::system::error_code& ec,
- boost::asio::yield_context yield)
+ spawn::yield_context yield)
{
// limit header to 4k, since we read it all into a single flat_buffer
static constexpr size_t header_limit = 4096;
// spawn a coroutine to handle the connection
#ifdef WITH_RADOSGW_BEAST_OPENSSL
if (l.use_ssl) {
- boost::asio::spawn(context,
- [this, s=std::move(socket)] (boost::asio::yield_context yield) mutable {
+ spawn::spawn(context,
+ [this, s=std::move(socket)] (spawn::yield_context yield) mutable {
Connection conn{s};
auto c = connections.add(conn);
// wrap the socket in an ssl stream
#else
{
#endif // WITH_RADOSGW_BEAST_OPENSSL
- boost::asio::spawn(context,
- [this, s=std::move(socket)] (boost::asio::yield_context yield) mutable {
+ spawn::spawn(context,
+ [this, s=std::move(socket)] (spawn::yield_context yield) mutable {
Connection conn{s};
auto c = connections.add(conn);
auto buffer = std::make_unique<parse_buffer>();