/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/interactions/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include "thrift/compiler/test/fixtures/interactions/gen-cpp2/MyService.h" #include "thrift/compiler/test/fixtures/interactions/gen-cpp2/MyService.tcc" #include "thrift/compiler/test/fixtures/interactions/gen-cpp2/module_metadata.h" #include std::unique_ptr apache::thrift::ServiceHandler<::cpp2::MyService>::getProcessor() { return std::make_unique<::cpp2::MyServiceAsyncProcessor>(this); } apache::thrift::ServiceHandler<::cpp2::MyService>::CreateMethodMetadataResult apache::thrift::ServiceHandler<::cpp2::MyService>::createMethodMetadata() { return ::apache::thrift::detail::ap::createMethodMetadataMap<::cpp2::MyServiceAsyncProcessor>(getServiceRequestInfoMap().value().get()); } std::optional> apache::thrift::ServiceHandler<::cpp2::MyService>::getServiceRequestInfoMap() const { return __fbthrift_serviceInfoHolder.requestInfoMap(); } ::cpp2::MyServiceServiceInfoHolder apache::thrift::ServiceHandler<::cpp2::MyService>::__fbthrift_serviceInfoHolder; std::unique_ptr::MyInteractionIf> apache::thrift::ServiceHandler<::cpp2::MyService>::createMyInteraction() { apache::thrift::detail::si::throw_app_exn_unimplemented("createMyInteraction"); } std::unique_ptr::MyInteractionFastIf> apache::thrift::ServiceHandler<::cpp2::MyService>::createMyInteractionFast() { apache::thrift::detail::si::throw_app_exn_unimplemented("createMyInteractionFast"); } std::unique_ptr::SerialInteractionIf> apache::thrift::ServiceHandler<::cpp2::MyService>::createSerialInteraction() { apache::thrift::detail::si::throw_app_exn_unimplemented("createSerialInteraction"); } void apache::thrift::ServiceHandler<::cpp2::MyService>::foo() { apache::thrift::detail::si::throw_app_exn_unimplemented("foo"); } void apache::thrift::ServiceHandler<::cpp2::MyService>::sync_foo() { return foo(); } folly::SemiFuture apache::thrift::ServiceHandler<::cpp2::MyService>::semifuture_foo() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_foo.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_foo(); return folly::makeSemiFuture(); } folly::Future apache::thrift::ServiceHandler<::cpp2::MyService>::future_foo() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_foo.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_foo(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyService>::co_foo() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_foo.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<::cpp2::MyService>::co_foo(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_foo.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_foo(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::async_tm_foo(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_foo.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_foo.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_foo(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_foo.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_foo(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_foo(); 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_foo(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_foo(); 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_foo(); 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()); } } apache::thrift::TileAndResponse::MyInteractionIf, void> apache::thrift::ServiceHandler<::cpp2::MyService>::interact(::std::int32_t /*arg*/) { apache::thrift::detail::si::throw_app_exn_unimplemented("interact"); } apache::thrift::TileAndResponse::MyInteractionIf, void> apache::thrift::ServiceHandler<::cpp2::MyService>::sync_interact(::std::int32_t p_arg) { return interact(p_arg); } folly::SemiFuture::MyInteractionIf, void>> apache::thrift::ServiceHandler<::cpp2::MyService>::semifuture_interact(::std::int32_t p_arg) { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_interact.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_interact(p_arg); } folly::Future::MyInteractionIf, void>> apache::thrift::ServiceHandler<::cpp2::MyService>::future_interact(::std::int32_t p_arg) { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_interact.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_interact(p_arg), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task::MyInteractionIf, void>> apache::thrift::ServiceHandler<::cpp2::MyService>::co_interact(::std::int32_t p_arg) { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_interact.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 /*arg*/>(p_arg)); } folly::coro::Task::MyInteractionIf, void>> apache::thrift::ServiceHandler<::cpp2::MyService>::co_interact(apache::thrift::RequestParams /* params */, ::std::int32_t p_arg) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_interact.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_interact(p_arg); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::async_tm_interact(std::unique_ptr::MyInteractionIf, void>>> callback, ::std::int32_t p_arg) { // 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_interact.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_interact.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_interact(params, p_arg); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_interact.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_interact(p_arg); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_interact(p_arg); 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_interact(params, p_arg); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_interact(p_arg); 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_interact(p_arg)); return; } default: { folly::assume_unreachable(); } } #if FOLLY_HAS_COROUTINES } catch (apache::thrift::detail::si::UnimplementedCoroMethod& ex) { std::tie(p_arg) = std::move(ex).restoreArgs<::std::int32_t /*arg*/>(); goto determineInvocationType; #endif // FOLLY_HAS_COROUTINES } catch (...) { callback->exception(std::current_exception()); } } apache::thrift::TileAndResponse::MyInteractionFastIf, ::std::int32_t> apache::thrift::ServiceHandler<::cpp2::MyService>::interactFast() { apache::thrift::detail::si::throw_app_exn_unimplemented("interactFast"); } apache::thrift::TileAndResponse::MyInteractionFastIf, ::std::int32_t> apache::thrift::ServiceHandler<::cpp2::MyService>::sync_interactFast() { return interactFast(); } folly::SemiFuture::MyInteractionFastIf, ::std::int32_t>> apache::thrift::ServiceHandler<::cpp2::MyService>::semifuture_interactFast() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_interactFast.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_interactFast(); } folly::Future::MyInteractionFastIf, ::std::int32_t>> apache::thrift::ServiceHandler<::cpp2::MyService>::future_interactFast() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_interactFast.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_interactFast(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task::MyInteractionFastIf, ::std::int32_t>> apache::thrift::ServiceHandler<::cpp2::MyService>::co_interactFast() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_interactFast.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::MyInteractionFastIf, ::std::int32_t>> apache::thrift::ServiceHandler<::cpp2::MyService>::co_interactFast(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_interactFast.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_interactFast(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::async_tm_interactFast(std::unique_ptr::MyInteractionFastIf, ::std::int32_t>>> 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_interactFast.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_interactFast.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_interactFast(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_interactFast.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_interactFast(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_interactFast(); 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_interactFast(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_interactFast(); 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_interactFast()); 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()); } } apache::thrift::TileAndResponse::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>> apache::thrift::ServiceHandler<::cpp2::MyService>::serialize() { apache::thrift::detail::si::throw_app_exn_unimplemented("serialize"); } apache::thrift::TileAndResponse::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>> apache::thrift::ServiceHandler<::cpp2::MyService>::sync_serialize() { return serialize(); } folly::SemiFuture::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>>> apache::thrift::ServiceHandler<::cpp2::MyService>::semifuture_serialize() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_serialize.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_serialize(); } folly::Future::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>>> apache::thrift::ServiceHandler<::cpp2::MyService>::future_serialize() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_serialize.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_serialize(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>>> apache::thrift::ServiceHandler<::cpp2::MyService>::co_serialize() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_serialize.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::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>>> apache::thrift::ServiceHandler<::cpp2::MyService>::co_serialize(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_serialize.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_serialize(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::async_tm_serialize(std::unique_ptr::SerialInteractionIf, ::apache::thrift::ResponseAndServerStream<::std::int32_t, ::std::int32_t>>>> 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_serialize.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_serialize.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_serialize(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_serialize.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_serialize(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_serialize(); 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_serialize(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_serialize(); 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_serialize()); 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<::cpp2::MyService>::MyInteractionIf::frobnicate() { apache::thrift::detail::si::throw_app_exn_unimplemented("frobnicate"); } ::std::int32_t apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::sync_frobnicate() { return frobnicate(); } folly::SemiFuture<::std::int32_t> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::semifuture_frobnicate() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_frobnicate.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_frobnicate(); } #if FOLLY_HAS_COROUTINES folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_frobnicate() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_frobnicate.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task<::std::int32_t> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_frobnicate(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_frobnicate.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_frobnicate(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::async_tm_frobnicate(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_frobnicate.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_frobnicate.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_frobnicate(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_frobnicate.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_frobnicate(); 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_frobnicate(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_frobnicate(); 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_frobnicate()); 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<::cpp2::MyService>::MyInteractionIf::ping() { apache::thrift::detail::si::throw_app_exn_unimplemented("ping"); } void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::sync_ping() { return ping(); } folly::SemiFuture apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::semifuture_ping() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_ping.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_ping(); return folly::makeSemiFuture(); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_ping() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_ping.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_ping(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_ping.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_ping(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::async_tm_ping(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_ping.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_ping.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_ping(params); apache::thrift::detail::si::async_tm_coro_oneway(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_ping.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_ping(); apache::thrift::detail::si::async_tm_semifuture_oneway(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_ping(params); apache::thrift::detail::si::async_tm_coro_oneway(std::move(callback), std::move(task)); return; } case apache::thrift::detail::si::InvocationType::Coro: { auto task = co_ping(); apache::thrift::detail::si::async_tm_coro_oneway(std::move(callback), std::move(task)); return; } #endif // FOLLY_HAS_COROUTINES case apache::thrift::detail::si::InvocationType::Sync: { sync_ping(); 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()); } } ::apache::thrift::ServerStream apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::truthify() { apache::thrift::detail::si::throw_app_exn_unimplemented("truthify"); } ::apache::thrift::ServerStream apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::sync_truthify() { return truthify(); } folly::SemiFuture<::apache::thrift::ServerStream> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::semifuture_truthify() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_truthify.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_truthify(); } #if FOLLY_HAS_COROUTINES folly::coro::Task<::apache::thrift::ServerStream> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_truthify() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_truthify.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task<::apache::thrift::ServerStream> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_truthify(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_truthify.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_truthify(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::async_tm_truthify(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_truthify.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_truthify.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_truthify(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_truthify.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_truthify(); 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_truthify(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_truthify(); 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_truthify()); 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()); } } ::apache::thrift::ResponseAndSinkConsumer<::std::set<::std::int32_t>, ::std::string, ::std::string> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::encode() { apache::thrift::detail::si::throw_app_exn_unimplemented("encode"); } ::apache::thrift::ResponseAndSinkConsumer<::std::set<::std::int32_t>, ::std::string, ::std::string> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::sync_encode() { return encode(); } folly::SemiFuture<::apache::thrift::ResponseAndSinkConsumer<::std::set<::std::int32_t>, ::std::string, ::std::string>> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::semifuture_encode() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_encode.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); return sync_encode(); } #if FOLLY_HAS_COROUTINES folly::coro::Task<::apache::thrift::ResponseAndSinkConsumer<::std::set<::std::int32_t>, ::std::string, ::std::string>> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_encode() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_encode.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task<::apache::thrift::ResponseAndSinkConsumer<::std::set<::std::int32_t>, ::std::string, ::std::string>> apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::co_encode(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_encode.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_encode(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionIf::async_tm_encode(std::unique_ptr, ::std::string, ::std::string>>> 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_encode.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_encode.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_encode(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_encode.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_encode(); 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_encode(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_encode(); 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_encode()); 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<::cpp2::MyService>::MyInteractionFastIf::async_eb_frobnicate(std::unique_ptr> callback) { callback->exception(apache::thrift::detail::si::create_app_exn_unimplemented("frobnicate")); } void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionFastIf::async_eb_ping(std::unique_ptr /*callback*/) { LOG(DFATAL) << "Function ping is unimplemented"; } void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionFastIf::async_eb_truthify(std::unique_ptr>> callback) { callback->exception(apache::thrift::detail::si::create_app_exn_unimplemented("truthify")); } void apache::thrift::ServiceHandler<::cpp2::MyService>::MyInteractionFastIf::async_eb_encode(std::unique_ptr, ::std::string, ::std::string>>> callback) { callback->exception(apache::thrift::detail::si::create_app_exn_unimplemented("encode")); } void apache::thrift::ServiceHandler<::cpp2::MyService>::SerialInteractionIf::frobnicate() { apache::thrift::detail::si::throw_app_exn_unimplemented("frobnicate"); } void apache::thrift::ServiceHandler<::cpp2::MyService>::SerialInteractionIf::sync_frobnicate() { return frobnicate(); } folly::SemiFuture apache::thrift::ServiceHandler<::cpp2::MyService>::SerialInteractionIf::semifuture_frobnicate() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_frobnicate.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_frobnicate(); return folly::makeSemiFuture(); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyService>::SerialInteractionIf::co_frobnicate() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_frobnicate.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); folly::throw_exception(apache::thrift::detail::si::UnimplementedCoroMethod::withCapturedArgs<>()); } folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyService>::SerialInteractionIf::co_frobnicate(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_frobnicate.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_frobnicate(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyService>::SerialInteractionIf::async_tm_frobnicate(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_frobnicate.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_frobnicate.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_frobnicate(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_frobnicate.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); [[fallthrough]]; #endif // FOLLY_HAS_COROUTINES } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_frobnicate(); 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_frobnicate(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_frobnicate(); 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_frobnicate(); 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()); } } namespace cpp2 { void MyServiceSvNull::foo() { return; } const char* MyServiceAsyncProcessor::getServiceName() { return "MyService"; } void MyServiceAsyncProcessor::getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) { ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::MyService>>::gen(response); } void MyServiceAsyncProcessor::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 MyServiceAsyncProcessor::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 MyServiceAsyncProcessor::ProcessMap& MyServiceAsyncProcessor::getOwnProcessMap() { return kOwnProcessMap_; } const MyServiceAsyncProcessor::ProcessMap MyServiceAsyncProcessor::kOwnProcessMap_ { {"foo", {&MyServiceAsyncProcessor::setUpAndProcess_foo, &MyServiceAsyncProcessor::setUpAndProcess_foo, &MyServiceAsyncProcessor::executeRequest_foo, &MyServiceAsyncProcessor::executeRequest_foo}}, {"interact", {&MyServiceAsyncProcessor::setUpAndProcess_interact, &MyServiceAsyncProcessor::setUpAndProcess_interact, &MyServiceAsyncProcessor::executeRequest_interact, &MyServiceAsyncProcessor::executeRequest_interact}}, {"interactFast", {&MyServiceAsyncProcessor::setUpAndProcess_interactFast, &MyServiceAsyncProcessor::setUpAndProcess_interactFast, &MyServiceAsyncProcessor::executeRequest_interactFast, &MyServiceAsyncProcessor::executeRequest_interactFast}}, {"serialize", {&MyServiceAsyncProcessor::setUpAndProcess_serialize, &MyServiceAsyncProcessor::setUpAndProcess_serialize, &MyServiceAsyncProcessor::executeRequest_serialize, &MyServiceAsyncProcessor::executeRequest_serialize}}, {"MyInteraction.frobnicate", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_frobnicate, &MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_frobnicate, &MyServiceAsyncProcessor::executeRequest_MyInteraction_frobnicate, &MyServiceAsyncProcessor::executeRequest_MyInteraction_frobnicate}}, {"MyInteraction.ping", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_ping, &MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_ping, &MyServiceAsyncProcessor::executeRequest_MyInteraction_ping, &MyServiceAsyncProcessor::executeRequest_MyInteraction_ping}}, {"MyInteraction.truthify", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_truthify, &MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_truthify, &MyServiceAsyncProcessor::executeRequest_MyInteraction_truthify, &MyServiceAsyncProcessor::executeRequest_MyInteraction_truthify}}, {"MyInteraction.encode", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_encode, &MyServiceAsyncProcessor::setUpAndProcess_MyInteraction_encode, &MyServiceAsyncProcessor::executeRequest_MyInteraction_encode, &MyServiceAsyncProcessor::executeRequest_MyInteraction_encode}}, {"MyInteractionFast.frobnicate", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_frobnicate, &MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_frobnicate, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_frobnicate, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_frobnicate}}, {"MyInteractionFast.ping", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_ping, &MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_ping, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_ping, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_ping}}, {"MyInteractionFast.truthify", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_truthify, &MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_truthify, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_truthify, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_truthify}}, {"MyInteractionFast.encode", {&MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_encode, &MyServiceAsyncProcessor::setUpAndProcess_MyInteractionFast_encode, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_encode, &MyServiceAsyncProcessor::executeRequest_MyInteractionFast_encode}}, {"SerialInteraction.frobnicate", {&MyServiceAsyncProcessor::setUpAndProcess_SerialInteraction_frobnicate, &MyServiceAsyncProcessor::setUpAndProcess_SerialInteraction_frobnicate, &MyServiceAsyncProcessor::executeRequest_SerialInteraction_frobnicate, &MyServiceAsyncProcessor::executeRequest_SerialInteraction_frobnicate}}, }; apache::thrift::ServiceRequestInfoMap const& MyServiceServiceInfoHolder::requestInfoMap() const { static folly::Indestructible requestInfoMap{staticRequestInfoMap()}; return *requestInfoMap; } apache::thrift::ServiceRequestInfoMap MyServiceServiceInfoHolder::staticRequestInfoMap() { apache::thrift::ServiceRequestInfoMap requestInfoMap = { {"foo", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyService.foo", std::nullopt, apache::thrift::concurrency::NORMAL, std::nullopt}}, {"interact", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyService.interact", std::nullopt, apache::thrift::concurrency::NORMAL, "MyInteraction"}}, {"interactFast", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyService.interactFast", std::nullopt, apache::thrift::concurrency::NORMAL, "MyInteractionFast"}}, {"serialize", { false, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, "MyService.serialize", std::nullopt, apache::thrift::concurrency::NORMAL, "SerialInteraction"}}, {"MyInteraction.frobnicate", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyService.MyInteraction.frobnicate", "MyInteraction", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteraction.ping", { false, apache::thrift::RpcKind::SINGLE_REQUEST_NO_RESPONSE, "MyService.MyInteraction.ping", "MyInteraction", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteraction.truthify", { false, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, "MyService.MyInteraction.truthify", "MyInteraction", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteraction.encode", { false, apache::thrift::RpcKind::SINK, "MyService.MyInteraction.encode", "MyInteraction", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteractionFast.frobnicate", { true, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyService.MyInteractionFast.frobnicate", "MyInteractionFast", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteractionFast.ping", { true, apache::thrift::RpcKind::SINGLE_REQUEST_NO_RESPONSE, "MyService.MyInteractionFast.ping", "MyInteractionFast", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteractionFast.truthify", { true, apache::thrift::RpcKind::SINGLE_REQUEST_STREAMING_RESPONSE, "MyService.MyInteractionFast.truthify", "MyInteractionFast", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"MyInteractionFast.encode", { true, apache::thrift::RpcKind::SINK, "MyService.MyInteractionFast.encode", "MyInteractionFast", apache::thrift::concurrency::NORMAL, std::nullopt}}, {"SerialInteraction.frobnicate", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyService.SerialInteraction.frobnicate", "SerialInteraction", apache::thrift::concurrency::NORMAL, std::nullopt}}, }; return requestInfoMap; } const MyServiceAsyncProcessor::InteractionConstructorMap& MyServiceAsyncProcessor::getInteractionConstructorMap() { return interactionConstructorMap_; } const MyServiceAsyncProcessor::InteractionConstructorMap MyServiceAsyncProcessor::interactionConstructorMap_ { {"MyInteraction", &MyServiceAsyncProcessor::createMyInteraction}, {"MyInteractionFast", &MyServiceAsyncProcessor::createMyInteractionFast}, {"SerialInteraction", &MyServiceAsyncProcessor::createSerialInteraction}, }; std::unique_ptr MyServiceAsyncProcessor::createInteractionImpl(const std::string& name) { auto fn = getInteractionConstructorMap().at(name); return (this->*fn)(); }} // namespace cpp2