Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit
769841a08c3e79985d9634f06c9ff4d62647dcda)
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Conflicts:
src/rgw/CMakeLists.txt
- Remove changes for 'rgw_schedulers' cmake target, not in Nautilus.
- Link 'radosgw_a' against 'spawn'; transitivity from 'rgw_schedulers'
(which is public) is lost, and 'rgw_a'/'rgw_libs' (which is private
to 'radosgw_a') isn't enough to build 'rgw_main.cc' ( error below.)
src/rgw/rgw_aio.cc
- This file doesn't exist in Nautilus; similar changes are done in
other files.
src/rgw/rgw_aio_throttle.h
- No changes required; the base for the changes (e.g., class, variables)
are not in Nautilus.
src/rgw/rgw_asio_frontend.cc
- Less changes required, similarly; commit
dd4350b not in Nautilus.
Build error:
In file included from /git/ceph/src/rgw/rgw_common.h:31:0,
from /git/ceph/src/rgw/rgw_main.cc:15:
/git/ceph/src/common/async/yield_context.h:31:10: fatal error: spawn/spawn.hpp: No such file or directory
#include <spawn/spawn.hpp>
^~~~~~~~~~~~~~~~~
compilation terminated.
src/rgw/CMakeFiles/radosgw.dir/build.make:62: recipe for target 'src/rgw/CMakeFiles/radosgw.dir/rgw_main.cc.o' failed
#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 SYSTEM PUBLIC "services")
target_include_directories(rgw_common PUBLIC "${CMAKE_SOURCE_DIR}/src/dmclock/support/src")
+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)
# used by rgw_asio_frontend.cc
target_link_libraries(radosgw_a PRIVATE OpenSSL::SSL)
endif()
+if(WITH_BOOST_CONTEXT)
+ target_link_libraries(radosgw_a PUBLIC spawn)
+endif()
add_executable(radosgw rgw_main.cc)
target_link_libraries(radosgw radosgw_a librados
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
#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"
#include "common/strtol.h"
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>();