/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/fatal/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/service1.h" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/service1.tcc" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/module_metadata.h" #include std::unique_ptr apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::getProcessor() { return std::make_unique<::test_cpp2::cpp_reflection::service1AsyncProcessor>(this); } apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::CreateMethodMetadataResult apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::createMethodMetadata() { return ::apache::thrift::detail::ap::createMethodMetadataMap<::test_cpp2::cpp_reflection::service1AsyncProcessor>(getServiceRequestInfoMap().value().get()); } std::optional> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::getServiceRequestInfoMap() const { return __fbthrift_serviceInfoHolder.requestInfoMap(); } ::test_cpp2::cpp_reflection::service1ServiceInfoHolder apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::__fbthrift_serviceInfoHolder; void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::method1() { apache::thrift::detail::si::throw_app_exn_unimplemented("method1"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::sync_method1() { return method1(); } folly::SemiFuture apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::semifuture_method1() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_method1.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_method1(); return folly::makeSemiFuture(); } folly::Future apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::future_method1() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_method1.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_method1(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method1() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_method1.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method1(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_method1.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_method1(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::async_tm_method1(std::unique_ptr> callback) { // It's possible the coroutine versions will delegate to a future-based // version. If that happens, we need the RequestParams arguments to be // available to the future through the thread-local backchannel, so we create // a RAII object that sets up RequestParams and clears them on destruction. apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get()); #if FOLLY_HAS_COROUTINES determineInvocationType: #endif // FOLLY_HAS_COROUTINES auto invocationType = __fbthrift_invocation_method1.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_method1.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::CoroParam, std::memory_order_relaxed); apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method1(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_method1.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::Future: { auto fut = future_method1(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_method1(); apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut)); return; } #if FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::CoroParam: { apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method1(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_method1(); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { sync_method1(); callback->done(); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie() = std::move(ex).restoreArgs<>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::method2(::std::int32_t /*x*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*y*/, double /*z*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("method2"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::sync_method2(::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { return method2(p_x, std::move(p_y), p_z); } folly::SemiFuture apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::semifuture_method2(::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_method2.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_method2(p_x, std::move(p_y), p_z); return folly::makeSemiFuture(); } folly::Future apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::future_method2(::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_method2.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_method2(p_x, std::move(p_y), p_z), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method2(::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_method2.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<::std::int32_t /*x*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*y*/, double /*z*/>(p_x, std::move(p_y), p_z)); } folly::coro::Task apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method2(apache::thrift::RequestParams /* params */, ::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_method2.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_method2(p_x, std::move(p_y), p_z); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::async_tm_method2(std::unique_ptr> callback, ::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { // It's possible the coroutine versions will delegate to a future-based // version. If that happens, we need the RequestParams arguments to be // available to the future through the thread-local backchannel, so we create // a RAII object that sets up RequestParams and clears them on destruction. apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get()); #if FOLLY_HAS_COROUTINES determineInvocationType: #endif // FOLLY_HAS_COROUTINES auto invocationType = __fbthrift_invocation_method2.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_method2.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::CoroParam, std::memory_order_relaxed); apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method2(params, p_x, std::move(p_y), p_z); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_method2.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::Future: { auto fut = future_method2(p_x, std::move(p_y), p_z); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_method2(p_x, std::move(p_y), p_z); apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut)); return; } #if FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::CoroParam: { apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method2(params, p_x, std::move(p_y), p_z); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_method2(p_x, std::move(p_y), p_z); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { sync_method2(p_x, std::move(p_y), p_z); callback->done(); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie(p_x, p_y, p_z) = std::move(ex).restoreArgs<::std::int32_t /*x*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*y*/, double /*z*/>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } ::std::int32_t apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::method3() { apache::thrift::detail::si::throw_app_exn_unimplemented("method3"); } ::std::int32_t apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::sync_method3() { return method3(); } folly::SemiFuture<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::semifuture_method3() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_method3.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_method3(); } folly::Future<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::future_method3() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_method3.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_method3(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method3() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_method3.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method3(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_method3.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_method3(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::async_tm_method3(std::unique_ptr> callback) { // It's possible the coroutine versions will delegate to a future-based // version. If that happens, we need the RequestParams arguments to be // available to the future through the thread-local backchannel, so we create // a RAII object that sets up RequestParams and clears them on destruction. apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get()); #if FOLLY_HAS_COROUTINES determineInvocationType: #endif // FOLLY_HAS_COROUTINES auto invocationType = __fbthrift_invocation_method3.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_method3.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::CoroParam, std::memory_order_relaxed); apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method3(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_method3.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::Future: { auto fut = future_method3(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_method3(); apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut)); return; } #if FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::CoroParam: { apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method3(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_method3(); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { callback->result(sync_method3()); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie() = std::move(ex).restoreArgs<>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } ::std::int32_t apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::method4(::std::int32_t /*i*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*j*/, double /*k*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("method4"); } ::std::int32_t apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::sync_method4(::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { return method4(p_i, std::move(p_j), p_k); } folly::SemiFuture<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::semifuture_method4(::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_method4.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_method4(p_i, std::move(p_j), p_k); } folly::Future<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::future_method4(::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_method4.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_method4(p_i, std::move(p_j), p_k), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method4(::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_method4.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<::std::int32_t /*i*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*j*/, double /*k*/>(p_i, std::move(p_j), p_k)); } folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method4(apache::thrift::RequestParams /* params */, ::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_method4.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_method4(p_i, std::move(p_j), p_k); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::async_tm_method4(std::unique_ptr> callback, ::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { // It's possible the coroutine versions will delegate to a future-based // version. If that happens, we need the RequestParams arguments to be // available to the future through the thread-local backchannel, so we create // a RAII object that sets up RequestParams and clears them on destruction. apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get()); #if FOLLY_HAS_COROUTINES determineInvocationType: #endif // FOLLY_HAS_COROUTINES auto invocationType = __fbthrift_invocation_method4.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_method4.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::CoroParam, std::memory_order_relaxed); apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method4(params, p_i, std::move(p_j), p_k); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_method4.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::Future: { auto fut = future_method4(p_i, std::move(p_j), p_k); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_method4(p_i, std::move(p_j), p_k); apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut)); return; } #if FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::CoroParam: { apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method4(params, p_i, std::move(p_j), p_k); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_method4(p_i, std::move(p_j), p_k); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { callback->result(sync_method4(p_i, std::move(p_j), p_k)); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie(p_i, p_j, p_k) = std::move(ex).restoreArgs<::std::int32_t /*i*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*j*/, double /*k*/>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::method5(::test_cpp2::cpp_reflection::struct2& /*_return*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("method5"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::sync_method5(::test_cpp2::cpp_reflection::struct2& _return) { return method5(_return); } folly::SemiFuture> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::semifuture_method5() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_method5.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); auto ret = std::make_unique<::test_cpp2::cpp_reflection::struct2>(); sync_method5(*ret); return folly::makeSemiFuture(std::move(ret)); } folly::Future> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::future_method5() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_method5.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_method5(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method5() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_method5.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method5(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_method5.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_method5(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::async_tm_method5(std::unique_ptr>> callback) { // It's possible the coroutine versions will delegate to a future-based // version. If that happens, we need the RequestParams arguments to be // available to the future through the thread-local backchannel, so we create // a RAII object that sets up RequestParams and clears them on destruction. apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get()); #if FOLLY_HAS_COROUTINES determineInvocationType: #endif // FOLLY_HAS_COROUTINES auto invocationType = __fbthrift_invocation_method5.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_method5.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::CoroParam, std::memory_order_relaxed); apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method5(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_method5.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::Future: { auto fut = future_method5(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_method5(); apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut)); return; } #if FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::CoroParam: { apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method5(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_method5(); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { ::test_cpp2::cpp_reflection::struct2 _return; sync_method5(_return); callback->result(_return); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie() = std::move(ex).restoreArgs<>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::method6(::test_cpp2::cpp_reflection::struct2& /*_return*/, ::std::int32_t /*l*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*m*/, double /*n*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("method6"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::sync_method6(::test_cpp2::cpp_reflection::struct2& _return, ::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { return method6(_return, p_l, std::move(p_m), p_n); } folly::SemiFuture> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::semifuture_method6(::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_method6.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); auto ret = std::make_unique<::test_cpp2::cpp_reflection::struct2>(); sync_method6(*ret, p_l, std::move(p_m), p_n); return folly::makeSemiFuture(std::move(ret)); } folly::Future> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::future_method6(::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_method6.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_method6(p_l, std::move(p_m), p_n), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method6(::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_method6.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<::std::int32_t /*l*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*m*/, double /*n*/>(p_l, std::move(p_m), p_n)); } folly::coro::Task> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::co_method6(apache::thrift::RequestParams /* params */, ::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_method6.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_method6(p_l, std::move(p_m), p_n); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>::async_tm_method6(std::unique_ptr>> callback, ::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { // It's possible the coroutine versions will delegate to a future-based // version. If that happens, we need the RequestParams arguments to be // available to the future through the thread-local backchannel, so we create // a RAII object that sets up RequestParams and clears them on destruction. apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get()); #if FOLLY_HAS_COROUTINES determineInvocationType: #endif // FOLLY_HAS_COROUTINES auto invocationType = __fbthrift_invocation_method6.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_method6.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::CoroParam, std::memory_order_relaxed); apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method6(params, p_l, std::move(p_m), p_n); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_method6.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::Future: { auto fut = future_method6(p_l, std::move(p_m), p_n); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_method6(p_l, std::move(p_m), p_n); apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut)); return; } #if FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::CoroParam: { apache::thrift::RequestParams params{callback->getRequestContext(), callback->getThreadManager_deprecated(), callback->getEventBase(), callback->getHandlerExecutor()}; auto task = co_method6(params, p_l, std::move(p_m), p_n); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_method6(p_l, std::move(p_m), p_n); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { ::test_cpp2::cpp_reflection::struct2 _return; sync_method6(_return, p_l, std::move(p_m), p_n); callback->result(_return); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie(p_l, p_m, p_n) = std::move(ex).restoreArgs<::std::int32_t /*l*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*m*/, double /*n*/>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } namespace test_cpp2::cpp_reflection { void service1SvNull::method1() { return; } void service1SvNull::method2(::std::int32_t /*x*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*y*/, double /*z*/) { return; } ::std::int32_t service1SvNull::method3() { return 0; } ::std::int32_t service1SvNull::method4(::std::int32_t /*i*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*j*/, double /*k*/) { return 0; } void service1SvNull::method5(::test_cpp2::cpp_reflection::struct2& /*_return*/) { } void service1SvNull::method6(::test_cpp2::cpp_reflection::struct2& /*_return*/, ::std::int32_t /*l*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*m*/, double /*n*/) { } const char* service1AsyncProcessor::getServiceName() { return "service1"; } void service1AsyncProcessor::getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) { ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service1>>::gen(response); } void service1AsyncProcessor::processSerializedCompressedRequestWithMetadata(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, const apache::thrift::AsyncProcessorFactory::MethodMetadata& methodMetadata, apache::thrift::protocol::PROTOCOL_TYPES protType, apache::thrift::Cpp2RequestContext* context, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) { apache::thrift::detail::ap::process(this, iface_, std::move(req), std::move(serializedRequest), methodMetadata, protType, context, eb, tm); } void service1AsyncProcessor::executeRequest(apache::thrift::ServerRequest&& request, const apache::thrift::AsyncProcessorFactory::MethodMetadata& methodMetadata) { apache::thrift::detail::ap::execute(this, std::move(request), apache::thrift::detail::ServerRequestHelper::protocol(request), methodMetadata); } const service1AsyncProcessor::ProcessMap& service1AsyncProcessor::getOwnProcessMap() { return kOwnProcessMap_; } const service1AsyncProcessor::ProcessMap service1AsyncProcessor::kOwnProcessMap_ { {"method1", {&service1AsyncProcessor::setUpAndProcess_method1, &service1AsyncProcessor::setUpAndProcess_method1, &service1AsyncProcessor::executeRequest_method1, &service1AsyncProcessor::executeRequest_method1}}, {"method2", {&service1AsyncProcessor::setUpAndProcess_method2, &service1AsyncProcessor::setUpAndProcess_method2, &service1AsyncProcessor::executeRequest_method2, &service1AsyncProcessor::executeRequest_method2}}, {"method3", {&service1AsyncProcessor::setUpAndProcess_method3, &service1AsyncProcessor::setUpAndProcess_method3, &service1AsyncProcessor::executeRequest_method3, &service1AsyncProcessor::executeRequest_method3}}, {"method4", {&service1AsyncProcessor::setUpAndProcess_method4, &service1AsyncProcessor::setUpAndProcess_method4, &service1AsyncProcessor::executeRequest_method4, &service1AsyncProcessor::executeRequest_method4}}, {"method5", {&service1AsyncProcessor::setUpAndProcess_method5, &service1AsyncProcessor::setUpAndProcess_method5, &service1AsyncProcessor::executeRequest_method5, &service1AsyncProcessor::executeRequest_method5}}, {"method6", {&service1AsyncProcessor::setUpAndProcess_method6, &service1AsyncProcessor::setUpAndProcess_method6, &service1AsyncProcessor::executeRequest_method6, &service1AsyncProcessor::executeRequest_method6}}, }; apache::thrift::ServiceRequestInfoMap const& service1ServiceInfoHolder::requestInfoMap() const { static folly::Indestructible requestInfoMap{staticRequestInfoMap()}; return *requestInfoMap; } apache::thrift::ServiceRequestInfoMap service1ServiceInfoHolder::staticRequestInfoMap() { apache::thrift::ServiceRequestInfoMap requestInfoMap = { {"method1", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service1.method1", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"method2", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service1.method2", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"method3", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service1.method3", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"method4", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service1.method4", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"method5", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service1.method5", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"method6", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service1.method6", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, }; return requestInfoMap; } } // namespace test_cpp2::cpp_reflection