]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
gcc11: Pull out exec from cls version
authorAdam Emerson <aemerson@redhat.com>
Tue, 19 Nov 2024 18:45:26 +0000 (13:45 -0500)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 1 Apr 2025 15:10:13 +0000 (11:10 -0400)
Signed-off-by: Adam Emerson <aemerson@redhat.com>
src/neorados/cls/version.h
src/test/cls_version/test_neocls_version.cc

index c5bc08bf66000ae028bb19f74ebf0636b07561ac..9eeff9b1011d25b28499fca58dd5e6e8b27ef681 100644 (file)
 /// `VersionCond`. The byte strings are incomparable. Two versions
 /// with different strings will always conflict.
 
-#include <coroutine>
-#include <string>
 #include <utility>
 
 #include <boost/asio/async_result.hpp>
+#include <boost/asio/use_awaitable.hpp>
 #include <boost/system/error_code.hpp>
 
 #include "include/neorados/RADOS.hpp"
@@ -166,6 +165,7 @@ namespace neorados::cls::version {
   }};
 }
 
+#if 0 // Disabled until we're off GCC11
 /// \brief Read the stored object version
 ///
 /// Execute an asynchronous operation that reads the stored version.
@@ -190,4 +190,29 @@ inline auto read(RADOS& r, Object o, IOContext ioc,
       return std::move(ret.objv);
     }, std::forward<CompletionToken>(token));
 }
+#endif
+
+/// \brief Read the stored object version
+///
+/// Execute an asynchronous operation that reads the stored version.
+///
+/// \param r RADOS handle
+/// \param o Object to query
+/// \param ioc IOContext determining the object location
+///
+/// \return The object version in a way appropriate to the completion
+/// token. See Boost.Asio documentation.
+template<typename E>
+inline boost::asio::awaitable<obj_version, E>
+read(RADOS& r, Object o, IOContext ioc,
+     // Hack to avoid changing most current uses
+     boost::asio::use_awaitable_t<E> = boost::asio::use_awaitable)
+{
+  ReadOp op;
+  obj_version objv;
+  op.exec(read(&objv));
+  co_await r.execute(std::move(o), std::move(ioc), std::move(op),
+                    nullptr, boost::asio::use_awaitable);
+  co_return objv;
+}
 } // namespace neorados::cls::version
index 2bfb66c231c37d400406d2f8c2b56f3b58c2f32a..23e7c940752f981c4fb7b7e6ffe5021ef211be65 100644 (file)
@@ -199,6 +199,7 @@ CORO_TEST_F(neocls_version, test_version_inc_check, NeoRadosTest)
     operation_canceled);
 }
 
+#if 0 // Disabled until we get rid of GCC11.
 TEST(neocls_version_bare, lambdata)
 {
   asio::io_context c;
@@ -234,3 +235,4 @@ TEST(neocls_version_bare, lambdata)
   c.run();
   ASSERT_EQ(iver, ever);
 }
+#endif