/** * 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/service3.h" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/service3.tcc" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/module_metadata.h" #include std::unique_ptr apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::getProcessor() { return std::make_unique<::test_cpp2::cpp_reflection::service3AsyncProcessor>(this); } apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::CreateMethodMetadataResult apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::createMethodMetadata() { return ::apache::thrift::detail::ap::createMethodMetadataMap<::test_cpp2::cpp_reflection::service3AsyncProcessor>(getServiceRequestInfoMap().value().get()); } std::optional> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::getServiceRequestInfoMap() const { return __fbthrift_serviceInfoHolder.requestInfoMap(); } ::test_cpp2::cpp_reflection::service3ServiceInfoHolder apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::__fbthrift_serviceInfoHolder; void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::methodA() { apache::thrift::detail::si::throw_app_exn_unimplemented("methodA"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::sync_methodA() { return methodA(); } folly::SemiFuture apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::semifuture_methodA() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_methodA.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_methodA(); return folly::makeSemiFuture(); } folly::Future apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::future_methodA() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_methodA.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_methodA(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::co_methodA() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_methodA.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::service3>::co_methodA(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_methodA.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_methodA(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::async_tm_methodA(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_methodA.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_methodA.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_methodA(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_methodA.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_methodA(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_methodA(); 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_methodA(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_methodA(); 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_methodA(); 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::service3>::methodB(::std::int32_t /*x*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*y*/, double /*z*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("methodB"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::sync_methodB(::std::int32_t p_x, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_y, double p_z) { return methodB(p_x, std::move(p_y), p_z); } folly::SemiFuture apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::semifuture_methodB(::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_methodB.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_methodB(p_x, std::move(p_y), p_z); return folly::makeSemiFuture(); } folly::Future apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::future_methodB(::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_methodB.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_methodB(p_x, std::move(p_y), p_z), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::co_methodB(::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_methodB.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::service3>::co_methodB(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_methodB.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_methodB(p_x, std::move(p_y), p_z); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::async_tm_methodB(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_methodB.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_methodB.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_methodB(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_methodB.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_methodB(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_methodB(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_methodB(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_methodB(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_methodB(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::service3>::methodC() { apache::thrift::detail::si::throw_app_exn_unimplemented("methodC"); } ::std::int32_t apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::sync_methodC() { return methodC(); } folly::SemiFuture<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::semifuture_methodC() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_methodC.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_methodC(); } folly::Future<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::future_methodC() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_methodC.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_methodC(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::co_methodC() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_methodC.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::service3>::co_methodC(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_methodC.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_methodC(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::async_tm_methodC(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_methodC.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_methodC.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_methodC(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_methodC.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_methodC(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_methodC(); 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_methodC(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_methodC(); 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_methodC()); 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::service3>::methodD(::std::int32_t /*i*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*j*/, double /*k*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("methodD"); } ::std::int32_t apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::sync_methodD(::std::int32_t p_i, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_j, double p_k) { return methodD(p_i, std::move(p_j), p_k); } folly::SemiFuture<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::semifuture_methodD(::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_methodD.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_methodD(p_i, std::move(p_j), p_k); } folly::Future<::std::int32_t> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::future_methodD(::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_methodD.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_methodD(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::service3>::co_methodD(::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_methodD.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::service3>::co_methodD(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_methodD.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_methodD(p_i, std::move(p_j), p_k); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::async_tm_methodD(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_methodD.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_methodD.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_methodD(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_methodD.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_methodD(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_methodD(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_methodD(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_methodD(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_methodD(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::service3>::methodE(::test_cpp2::cpp_reflection::struct2& /*_return*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("methodE"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::sync_methodE(::test_cpp2::cpp_reflection::struct2& _return) { return methodE(_return); } folly::SemiFuture> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::semifuture_methodE() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_methodE.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_methodE(*ret); return folly::makeSemiFuture(std::move(ret)); } folly::Future> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::future_methodE() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_methodE.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_methodE(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::co_methodE() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_methodE.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::service3>::co_methodE(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_methodE.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_methodE(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::async_tm_methodE(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_methodE.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_methodE.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_methodE(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_methodE.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_methodE(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_methodE(); 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_methodE(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_methodE(); 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_methodE(_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::service3>::methodF(::test_cpp2::cpp_reflection::struct3& /*_return*/, ::std::int32_t /*l*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*m*/, double /*n*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("methodF"); } void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::sync_methodF(::test_cpp2::cpp_reflection::struct3& _return, ::std::int32_t p_l, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> p_m, double p_n) { return methodF(_return, p_l, std::move(p_m), p_n); } folly::SemiFuture> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::semifuture_methodF(::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_methodF.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); auto ret = std::make_unique<::test_cpp2::cpp_reflection::struct3>(); sync_methodF(*ret, p_l, std::move(p_m), p_n); return folly::makeSemiFuture(std::move(ret)); } folly::Future> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::future_methodF(::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_methodF.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_methodF(p_l, std::move(p_m), p_n), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task> apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::co_methodF(::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_methodF.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::service3>::co_methodF(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_methodF.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_methodF(p_l, std::move(p_m), p_n); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>::async_tm_methodF(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_methodF.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_methodF.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_methodF(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_methodF.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_methodF(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_methodF(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_methodF(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_methodF(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::struct3 _return; sync_methodF(_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 service3SvNull::methodA() { return; } void service3SvNull::methodB(::std::int32_t /*x*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*y*/, double /*z*/) { return; } ::std::int32_t service3SvNull::methodC() { return 0; } ::std::int32_t service3SvNull::methodD(::std::int32_t /*i*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*j*/, double /*k*/) { return 0; } void service3SvNull::methodE(::test_cpp2::cpp_reflection::struct2& /*_return*/) { } void service3SvNull::methodF(::test_cpp2::cpp_reflection::struct3& /*_return*/, ::std::int32_t /*l*/, std::unique_ptr<::test_cpp2::cpp_reflection::struct1> /*m*/, double /*n*/) { } const char* service3AsyncProcessor::getServiceName() { return "service3"; } void service3AsyncProcessor::getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) { ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::test_cpp2::cpp_reflection::service3>>::gen(response); } void service3AsyncProcessor::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 service3AsyncProcessor::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 service3AsyncProcessor::ProcessMap& service3AsyncProcessor::getOwnProcessMap() { return kOwnProcessMap_; } const service3AsyncProcessor::ProcessMap service3AsyncProcessor::kOwnProcessMap_ { {"methodA", {&service3AsyncProcessor::setUpAndProcess_methodA, &service3AsyncProcessor::setUpAndProcess_methodA, &service3AsyncProcessor::executeRequest_methodA, &service3AsyncProcessor::executeRequest_methodA}}, {"methodB", {&service3AsyncProcessor::setUpAndProcess_methodB, &service3AsyncProcessor::setUpAndProcess_methodB, &service3AsyncProcessor::executeRequest_methodB, &service3AsyncProcessor::executeRequest_methodB}}, {"methodC", {&service3AsyncProcessor::setUpAndProcess_methodC, &service3AsyncProcessor::setUpAndProcess_methodC, &service3AsyncProcessor::executeRequest_methodC, &service3AsyncProcessor::executeRequest_methodC}}, {"methodD", {&service3AsyncProcessor::setUpAndProcess_methodD, &service3AsyncProcessor::setUpAndProcess_methodD, &service3AsyncProcessor::executeRequest_methodD, &service3AsyncProcessor::executeRequest_methodD}}, {"methodE", {&service3AsyncProcessor::setUpAndProcess_methodE, &service3AsyncProcessor::setUpAndProcess_methodE, &service3AsyncProcessor::executeRequest_methodE, &service3AsyncProcessor::executeRequest_methodE}}, {"methodF", {&service3AsyncProcessor::setUpAndProcess_methodF, &service3AsyncProcessor::setUpAndProcess_methodF, &service3AsyncProcessor::executeRequest_methodF, &service3AsyncProcessor::executeRequest_methodF}}, }; apache::thrift::ServiceRequestInfoMap const& service3ServiceInfoHolder::requestInfoMap() const { static folly::Indestructible requestInfoMap{staticRequestInfoMap()}; return *requestInfoMap; } apache::thrift::ServiceRequestInfoMap service3ServiceInfoHolder::staticRequestInfoMap() { apache::thrift::ServiceRequestInfoMap requestInfoMap = { {"methodA", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service3.methodA", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"methodB", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service3.methodB", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"methodC", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service3.methodC", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"methodD", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service3.methodD", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"methodE", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service3.methodE", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"methodF", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "service3.methodF", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, }; return requestInfoMap; } } // namespace test_cpp2::cpp_reflection