/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/basic-annotations/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include "thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/MyServicePrioParent.h" #include "thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/MyServicePrioParent.tcc" #include "thrift/compiler/test/fixtures/basic-annotations/gen-cpp2/module_metadata.h" #include std::unique_ptr apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::getProcessor() { return std::make_unique<::cpp2::MyServicePrioParentAsyncProcessor>(this); } apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::CreateMethodMetadataResult apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::createMethodMetadata() { return ::apache::thrift::detail::ap::createMethodMetadataMap<::cpp2::MyServicePrioParentAsyncProcessor>(getServiceRequestInfoMap().value().get()); } std::optional> apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::getServiceRequestInfoMap() const { return __fbthrift_serviceInfoHolder.requestInfoMap(); } ::cpp2::MyServicePrioParentServiceInfoHolder apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::__fbthrift_serviceInfoHolder; void apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::ping() { apache::thrift::detail::si::throw_app_exn_unimplemented("ping"); } void apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::sync_ping() { return ping(); } folly::SemiFuture apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::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(); } folly::Future apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::future_ping() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_ping.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_ping(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::co_ping() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_ping.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::MyServicePrioParent>::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::MyServicePrioParent>::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(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_ping.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_ping(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_ping(); 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_ping(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_ping(); 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_ping(); 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<::cpp2::MyServicePrioParent>::pong() { apache::thrift::detail::si::throw_app_exn_unimplemented("pong"); } void apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::sync_pong() { return pong(); } folly::SemiFuture apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::semifuture_pong() { auto expected{apache::thrift::detail::si::InvocationType::SemiFuture}; __fbthrift_invocation_pong.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed); sync_pong(); return folly::makeSemiFuture(); } folly::Future apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::future_pong() { auto expected{apache::thrift::detail::si::InvocationType::Future}; __fbthrift_invocation_pong.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed); return apache::thrift::detail::si::future(semifuture_pong(), getInternalKeepAlive()); } #if FOLLY_HAS_COROUTINES folly::coro::Task apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::co_pong() { auto expected{apache::thrift::detail::si::InvocationType::Coro}; __fbthrift_invocation_pong.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::MyServicePrioParent>::co_pong(apache::thrift::RequestParams /* params */) { auto expected{apache::thrift::detail::si::InvocationType::CoroParam}; __fbthrift_invocation_pong.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Coro, std::memory_order_relaxed); return co_pong(); } #endif // FOLLY_HAS_COROUTINES void apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>::async_tm_pong(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_pong.load(std::memory_order_relaxed); try { switch (invocationType) { case apache::thrift::detail::si::InvocationType::AsyncTm: { #if FOLLY_HAS_COROUTINES __fbthrift_invocation_pong.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_pong(params); apache::thrift::detail::si::async_tm_coro(std::move(callback), std::move(task)); return; #else // FOLLY_HAS_COROUTINES __fbthrift_invocation_pong.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_pong(); apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut)); return; } case apache::thrift::detail::si::InvocationType::SemiFuture: { auto fut = semifuture_pong(); 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_pong(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_pong(); 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_pong(); 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 MyServicePrioParentSvNull::ping() { return; } void MyServicePrioParentSvNull::pong() { return; } const char* MyServicePrioParentAsyncProcessor::getServiceName() { return "MyServicePrioParent"; } void MyServicePrioParentAsyncProcessor::getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) { ::apache::thrift::detail::md::ServiceMetadata<::apache::thrift::ServiceHandler<::cpp2::MyServicePrioParent>>::gen(response); } void MyServicePrioParentAsyncProcessor::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 MyServicePrioParentAsyncProcessor::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 MyServicePrioParentAsyncProcessor::ProcessMap& MyServicePrioParentAsyncProcessor::getOwnProcessMap() { return kOwnProcessMap_; } const MyServicePrioParentAsyncProcessor::ProcessMap MyServicePrioParentAsyncProcessor::kOwnProcessMap_ { {"ping", {&MyServicePrioParentAsyncProcessor::setUpAndProcess_ping, &MyServicePrioParentAsyncProcessor::setUpAndProcess_ping, &MyServicePrioParentAsyncProcessor::executeRequest_ping, &MyServicePrioParentAsyncProcessor::executeRequest_ping}}, {"pong", {&MyServicePrioParentAsyncProcessor::setUpAndProcess_pong, &MyServicePrioParentAsyncProcessor::setUpAndProcess_pong, &MyServicePrioParentAsyncProcessor::executeRequest_pong, &MyServicePrioParentAsyncProcessor::executeRequest_pong}}, }; apache::thrift::ServiceRequestInfoMap const& MyServicePrioParentServiceInfoHolder::requestInfoMap() const { static folly::Indestructible requestInfoMap{staticRequestInfoMap()}; return *requestInfoMap; } apache::thrift::ServiceRequestInfoMap MyServicePrioParentServiceInfoHolder::staticRequestInfoMap() { apache::thrift::ServiceRequestInfoMap requestInfoMap = { {"ping", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyServicePrioParent.ping", std::nullopt, apache::thrift::concurrency::IMPORTANT, std::nullopt}}, {"pong", { false, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, "MyServicePrioParent.pong", std::nullopt, apache::thrift::concurrency::HIGH_IMPORTANT, std::nullopt}}, }; return requestInfoMap; } } // namespace cpp2