/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/visitation/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #pragma once #include "thrift/compiler/test/fixtures/visitation/gen-cpp2/service3.h" #include namespace test_cpp2::cpp_reflection { typedef apache::thrift::ThriftPresult service3_methodA_pargs; typedef apache::thrift::ThriftPresult service3_methodA_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct1*>, apache::thrift::FieldData<3, ::apache::thrift::type_class::floating_point, double*>> service3_methodB_pargs; typedef apache::thrift::ThriftPresult service3_methodB_presult; typedef apache::thrift::ThriftPresult service3_methodC_pargs; typedef apache::thrift::ThriftPresult> service3_methodC_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct1*>, apache::thrift::FieldData<3, ::apache::thrift::type_class::floating_point, double*>> service3_methodD_pargs; typedef apache::thrift::ThriftPresult> service3_methodD_presult; typedef apache::thrift::ThriftPresult service3_methodE_pargs; typedef apache::thrift::ThriftPresult> service3_methodE_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::test_cpp2::cpp_reflection::struct1*>, apache::thrift::FieldData<3, ::apache::thrift::type_class::floating_point, double*>> service3_methodF_pargs; typedef apache::thrift::ThriftPresult> service3_methodF_presult; template void service3AsyncProcessor::setUpAndProcess_methodA(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &service3AsyncProcessor::executeRequest_methodA, this); } template void service3AsyncProcessor::executeRequest_methodA(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); struct ArgsState { service3_methodA_pargs pargs() { service3_methodA_pargs args; return args; } auto asTupleOfRefs() & { return std::tie( ); } } args; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "service3.methodA", serverRequest.requestContext()); try { auto pargs = args.pargs(); deserializeRequest(pargs, "methodA", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "methodA"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = apache::thrift::HandlerCallbackPtr::make( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , this->getServiceName() , "methodA" , return_methodA , throw_wrapped_methodA , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); const auto makeExecuteHandler = [&] { return [ifacePtr = iface_](auto&& cb, ArgsState args) mutable { (void)args; ifacePtr->async_tm_methodA(std::move(cb)); }; }; #if FOLLY_HAS_COROUTINES if (apache::thrift::detail::shouldProcessServiceInterceptorsOnRequest(*callback)) { [](auto callback, auto executeHandler, ArgsState args) -> folly::coro::Task { auto argRefs = args.asTupleOfRefs(); co_await apache::thrift::detail::processServiceInterceptorsOnRequest( *callback, apache::thrift::detail::ServiceInterceptorOnRequestArguments(argRefs)); executeHandler(std::move(callback), std::move(args)); }(std::move(callback), makeExecuteHandler(), std::move(args)) .scheduleOn(apache::thrift::detail::ServerRequestHelper::executor(serverRequest)) .startInlineUnsafe(); } else { makeExecuteHandler()(std::move(callback), std::move(args)); } #else makeExecuteHandler()(std::move(callback), std::move(args)); #endif // FOLLY_HAS_COROUTINES } template apache::thrift::SerializedResponse service3AsyncProcessor::return_methodA(apache::thrift::ContextStack* ctx) { ProtocolOut_ prot; ::test_cpp2::cpp_reflection::service3_methodA_presult result; return serializeResponse("methodA", &prot, ctx, result); } template void service3AsyncProcessor::throw_wrapped_methodA(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "methodA"); return; } } template void service3AsyncProcessor::setUpAndProcess_methodB(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &service3AsyncProcessor::executeRequest_methodB, this); } template void service3AsyncProcessor::executeRequest_methodB(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); struct ArgsState { ::std::int32_t uarg_x{0}; std::unique_ptr<::test_cpp2::cpp_reflection::struct1> uarg_y = std::make_unique<::test_cpp2::cpp_reflection::struct1>(); double uarg_z{0}; service3_methodB_pargs pargs() { service3_methodB_pargs args; args.get<0>().value = &uarg_x; args.get<1>().value = uarg_y.get(); args.get<2>().value = &uarg_z; return args; } auto asTupleOfRefs() & { return std::tie( std::as_const(uarg_x), std::as_const(*uarg_y), std::as_const(uarg_z) ); } } args; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "service3.methodB", serverRequest.requestContext()); try { auto pargs = args.pargs(); deserializeRequest(pargs, "methodB", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "methodB"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = apache::thrift::HandlerCallbackPtr::make( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , this->getServiceName() , "methodB" , return_methodB , throw_wrapped_methodB , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); const auto makeExecuteHandler = [&] { return [ifacePtr = iface_](auto&& cb, ArgsState args) mutable { (void)args; ifacePtr->async_tm_methodB(std::move(cb), args.uarg_x, std::move(args.uarg_y), args.uarg_z); }; }; #if FOLLY_HAS_COROUTINES if (apache::thrift::detail::shouldProcessServiceInterceptorsOnRequest(*callback)) { [](auto callback, auto executeHandler, ArgsState args) -> folly::coro::Task { auto argRefs = args.asTupleOfRefs(); co_await apache::thrift::detail::processServiceInterceptorsOnRequest( *callback, apache::thrift::detail::ServiceInterceptorOnRequestArguments(argRefs)); executeHandler(std::move(callback), std::move(args)); }(std::move(callback), makeExecuteHandler(), std::move(args)) .scheduleOn(apache::thrift::detail::ServerRequestHelper::executor(serverRequest)) .startInlineUnsafe(); } else { makeExecuteHandler()(std::move(callback), std::move(args)); } #else makeExecuteHandler()(std::move(callback), std::move(args)); #endif // FOLLY_HAS_COROUTINES } template apache::thrift::SerializedResponse service3AsyncProcessor::return_methodB(apache::thrift::ContextStack* ctx) { ProtocolOut_ prot; ::test_cpp2::cpp_reflection::service3_methodB_presult result; return serializeResponse("methodB", &prot, ctx, result); } template void service3AsyncProcessor::throw_wrapped_methodB(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "methodB"); return; } } template void service3AsyncProcessor::setUpAndProcess_methodC(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &service3AsyncProcessor::executeRequest_methodC, this); } template void service3AsyncProcessor::executeRequest_methodC(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); struct ArgsState { service3_methodC_pargs pargs() { service3_methodC_pargs args; return args; } auto asTupleOfRefs() & { return std::tie( ); } } args; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "service3.methodC", serverRequest.requestContext()); try { auto pargs = args.pargs(); deserializeRequest(pargs, "methodC", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "methodC"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = apache::thrift::HandlerCallbackPtr<::std::int32_t>::make( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , this->getServiceName() , "methodC" , return_methodC , throw_wrapped_methodC , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); const auto makeExecuteHandler = [&] { return [ifacePtr = iface_](auto&& cb, ArgsState args) mutable { (void)args; ifacePtr->async_tm_methodC(std::move(cb)); }; }; #if FOLLY_HAS_COROUTINES if (apache::thrift::detail::shouldProcessServiceInterceptorsOnRequest(*callback)) { [](auto callback, auto executeHandler, ArgsState args) -> folly::coro::Task { auto argRefs = args.asTupleOfRefs(); co_await apache::thrift::detail::processServiceInterceptorsOnRequest( *callback, apache::thrift::detail::ServiceInterceptorOnRequestArguments(argRefs)); executeHandler(std::move(callback), std::move(args)); }(std::move(callback), makeExecuteHandler(), std::move(args)) .scheduleOn(apache::thrift::detail::ServerRequestHelper::executor(serverRequest)) .startInlineUnsafe(); } else { makeExecuteHandler()(std::move(callback), std::move(args)); } #else makeExecuteHandler()(std::move(callback), std::move(args)); #endif // FOLLY_HAS_COROUTINES } template apache::thrift::SerializedResponse service3AsyncProcessor::return_methodC(apache::thrift::ContextStack* ctx, ::std::int32_t const& _return) { ProtocolOut_ prot; ::test_cpp2::cpp_reflection::service3_methodC_presult result; result.get<0>().value = const_cast<::std::int32_t*>(&_return); result.setIsSet(0, true); return serializeResponse("methodC", &prot, ctx, result); } template void service3AsyncProcessor::throw_wrapped_methodC(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "methodC"); return; } } template void service3AsyncProcessor::setUpAndProcess_methodD(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &service3AsyncProcessor::executeRequest_methodD, this); } template void service3AsyncProcessor::executeRequest_methodD(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); struct ArgsState { ::std::int32_t uarg_i{0}; std::unique_ptr<::test_cpp2::cpp_reflection::struct1> uarg_j = std::make_unique<::test_cpp2::cpp_reflection::struct1>(); double uarg_k{0}; service3_methodD_pargs pargs() { service3_methodD_pargs args; args.get<0>().value = &uarg_i; args.get<1>().value = uarg_j.get(); args.get<2>().value = &uarg_k; return args; } auto asTupleOfRefs() & { return std::tie( std::as_const(uarg_i), std::as_const(*uarg_j), std::as_const(uarg_k) ); } } args; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "service3.methodD", serverRequest.requestContext()); try { auto pargs = args.pargs(); deserializeRequest(pargs, "methodD", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "methodD"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = apache::thrift::HandlerCallbackPtr<::std::int32_t>::make( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , this->getServiceName() , "methodD" , return_methodD , throw_wrapped_methodD , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); const auto makeExecuteHandler = [&] { return [ifacePtr = iface_](auto&& cb, ArgsState args) mutable { (void)args; ifacePtr->async_tm_methodD(std::move(cb), args.uarg_i, std::move(args.uarg_j), args.uarg_k); }; }; #if FOLLY_HAS_COROUTINES if (apache::thrift::detail::shouldProcessServiceInterceptorsOnRequest(*callback)) { [](auto callback, auto executeHandler, ArgsState args) -> folly::coro::Task { auto argRefs = args.asTupleOfRefs(); co_await apache::thrift::detail::processServiceInterceptorsOnRequest( *callback, apache::thrift::detail::ServiceInterceptorOnRequestArguments(argRefs)); executeHandler(std::move(callback), std::move(args)); }(std::move(callback), makeExecuteHandler(), std::move(args)) .scheduleOn(apache::thrift::detail::ServerRequestHelper::executor(serverRequest)) .startInlineUnsafe(); } else { makeExecuteHandler()(std::move(callback), std::move(args)); } #else makeExecuteHandler()(std::move(callback), std::move(args)); #endif // FOLLY_HAS_COROUTINES } template apache::thrift::SerializedResponse service3AsyncProcessor::return_methodD(apache::thrift::ContextStack* ctx, ::std::int32_t const& _return) { ProtocolOut_ prot; ::test_cpp2::cpp_reflection::service3_methodD_presult result; result.get<0>().value = const_cast<::std::int32_t*>(&_return); result.setIsSet(0, true); return serializeResponse("methodD", &prot, ctx, result); } template void service3AsyncProcessor::throw_wrapped_methodD(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "methodD"); return; } } template void service3AsyncProcessor::setUpAndProcess_methodE(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &service3AsyncProcessor::executeRequest_methodE, this); } template void service3AsyncProcessor::executeRequest_methodE(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); struct ArgsState { service3_methodE_pargs pargs() { service3_methodE_pargs args; return args; } auto asTupleOfRefs() & { return std::tie( ); } } args; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "service3.methodE", serverRequest.requestContext()); try { auto pargs = args.pargs(); deserializeRequest(pargs, "methodE", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "methodE"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = apache::thrift::HandlerCallbackPtr>::make( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , this->getServiceName() , "methodE" , return_methodE , throw_wrapped_methodE , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); const auto makeExecuteHandler = [&] { return [ifacePtr = iface_](auto&& cb, ArgsState args) mutable { (void)args; ifacePtr->async_tm_methodE(std::move(cb)); }; }; #if FOLLY_HAS_COROUTINES if (apache::thrift::detail::shouldProcessServiceInterceptorsOnRequest(*callback)) { [](auto callback, auto executeHandler, ArgsState args) -> folly::coro::Task { auto argRefs = args.asTupleOfRefs(); co_await apache::thrift::detail::processServiceInterceptorsOnRequest( *callback, apache::thrift::detail::ServiceInterceptorOnRequestArguments(argRefs)); executeHandler(std::move(callback), std::move(args)); }(std::move(callback), makeExecuteHandler(), std::move(args)) .scheduleOn(apache::thrift::detail::ServerRequestHelper::executor(serverRequest)) .startInlineUnsafe(); } else { makeExecuteHandler()(std::move(callback), std::move(args)); } #else makeExecuteHandler()(std::move(callback), std::move(args)); #endif // FOLLY_HAS_COROUTINES } template apache::thrift::SerializedResponse service3AsyncProcessor::return_methodE(apache::thrift::ContextStack* ctx, ::test_cpp2::cpp_reflection::struct2 const& _return) { ProtocolOut_ prot; ::test_cpp2::cpp_reflection::service3_methodE_presult result; result.get<0>().value = const_cast<::test_cpp2::cpp_reflection::struct2*>(&_return); result.setIsSet(0, true); return serializeResponse("methodE", &prot, ctx, result); } template void service3AsyncProcessor::throw_wrapped_methodE(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "methodE"); return; } } template void service3AsyncProcessor::setUpAndProcess_methodF(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, [[maybe_unused]] apache::thrift::concurrency::ThreadManager* tm) { if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) { return; } auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL); ctx->setRequestExecutionScope(std::move(scope)); processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &service3AsyncProcessor::executeRequest_methodF, this); } template void service3AsyncProcessor::executeRequest_methodF(apache::thrift::ServerRequest&& serverRequest) { // make sure getRequestContext is null // so async calls don't accidentally use it iface_->setRequestContext(nullptr); struct ArgsState { ::std::int32_t uarg_l{0}; std::unique_ptr<::test_cpp2::cpp_reflection::struct1> uarg_m = std::make_unique<::test_cpp2::cpp_reflection::struct1>(); double uarg_n{0}; service3_methodF_pargs pargs() { service3_methodF_pargs args; args.get<0>().value = &uarg_l; args.get<1>().value = uarg_m.get(); args.get<2>().value = &uarg_n; return args; } auto asTupleOfRefs() & { return std::tie( std::as_const(uarg_l), std::as_const(*uarg_m), std::as_const(uarg_n) ); } } args; auto ctxStack = apache::thrift::ContextStack::create( this->getEventHandlersSharedPtr(), this->getServiceName(), "service3.methodF", serverRequest.requestContext()); try { auto pargs = args.pargs(); deserializeRequest(pargs, "methodF", apache::thrift::detail::ServerRequestHelper::compressedRequest(std::move(serverRequest)).uncompress(), ctxStack.get()); } catch (...) { folly::exception_wrapper ew(std::current_exception()); apache::thrift::detail::ap::process_handle_exn_deserialization( ew , apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , serverRequest.requestContext() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , "methodF"); return; } auto requestPileNotification = apache::thrift::detail::ServerRequestHelper::moveRequestPileNotification(serverRequest); auto concurrencyControllerNotification = apache::thrift::detail::ServerRequestHelper::moveConcurrencyControllerNotification(serverRequest); auto callback = apache::thrift::HandlerCallbackPtr>::make( apache::thrift::detail::ServerRequestHelper::request(std::move(serverRequest)) , std::move(ctxStack) , this->getServiceName() , "methodF" , return_methodF , throw_wrapped_methodF , serverRequest.requestContext()->getProtoSeqId() , apache::thrift::detail::ServerRequestHelper::eventBase(serverRequest) , apache::thrift::detail::ServerRequestHelper::executor(serverRequest) , serverRequest.requestContext() , requestPileNotification , concurrencyControllerNotification, std::move(serverRequest.requestData()) ); const auto makeExecuteHandler = [&] { return [ifacePtr = iface_](auto&& cb, ArgsState args) mutable { (void)args; ifacePtr->async_tm_methodF(std::move(cb), args.uarg_l, std::move(args.uarg_m), args.uarg_n); }; }; #if FOLLY_HAS_COROUTINES if (apache::thrift::detail::shouldProcessServiceInterceptorsOnRequest(*callback)) { [](auto callback, auto executeHandler, ArgsState args) -> folly::coro::Task { auto argRefs = args.asTupleOfRefs(); co_await apache::thrift::detail::processServiceInterceptorsOnRequest( *callback, apache::thrift::detail::ServiceInterceptorOnRequestArguments(argRefs)); executeHandler(std::move(callback), std::move(args)); }(std::move(callback), makeExecuteHandler(), std::move(args)) .scheduleOn(apache::thrift::detail::ServerRequestHelper::executor(serverRequest)) .startInlineUnsafe(); } else { makeExecuteHandler()(std::move(callback), std::move(args)); } #else makeExecuteHandler()(std::move(callback), std::move(args)); #endif // FOLLY_HAS_COROUTINES } template apache::thrift::SerializedResponse service3AsyncProcessor::return_methodF(apache::thrift::ContextStack* ctx, ::test_cpp2::cpp_reflection::struct3 const& _return) { ProtocolOut_ prot; ::test_cpp2::cpp_reflection::service3_methodF_presult result; result.get<0>().value = const_cast<::test_cpp2::cpp_reflection::struct3*>(&_return); result.setIsSet(0, true); return serializeResponse("methodF", &prot, ctx, result); } template void service3AsyncProcessor::throw_wrapped_methodF(apache::thrift::ResponseChannelRequest::UniquePtr req,[[maybe_unused]] int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) { if (!ew) { return; } { apache::thrift::detail::ap::process_throw_wrapped_handler_error( ew, std::move(req), reqCtx, ctx, "methodF"); return; } } } // namespace test_cpp2::cpp_reflection