/** * 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 */ #include "thrift/compiler/test/fixtures/visitation/gen-cpp2/service2AsyncClient.h" #include namespace test_cpp2::cpp_reflection { typedef apache::thrift::ThriftPresult service2_methodA_pargs; typedef apache::thrift::ThriftPresult service2_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*>> service2_methodB_pargs; typedef apache::thrift::ThriftPresult service2_methodB_presult; typedef apache::thrift::ThriftPresult service2_methodC_pargs; typedef apache::thrift::ThriftPresult> service2_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*>> service2_methodD_pargs; typedef apache::thrift::ThriftPresult> service2_methodD_presult; typedef apache::thrift::ThriftPresult service2_methodE_pargs; typedef apache::thrift::ThriftPresult> service2_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*>> service2_methodF_pargs; typedef apache::thrift::ThriftPresult> service2_methodF_presult; } // namespace test_cpp2::cpp_reflection template apache::thrift::SerializedRequest apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_methodA(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::test_cpp2::cpp_reflection::service2_methodA_pargs args; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "methodA", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_send_methodA(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "methodA", ::apache::thrift::FunctionQualifier::Unspecified, "service2"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_methodB(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { ::test_cpp2::cpp_reflection::service2_methodB_pargs args; args.get<0>().value = &p_x; args.get<1>().value = const_cast<::test_cpp2::cpp_reflection::struct1*>(&p_y); args.get<2>().value = &p_z; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "methodB", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_send_methodB(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "methodB", ::apache::thrift::FunctionQualifier::Unspecified, "service2"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_methodC(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::test_cpp2::cpp_reflection::service2_methodC_pargs args; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "methodC", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_send_methodC(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "methodC", ::apache::thrift::FunctionQualifier::Unspecified, "service2"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_methodD(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { ::test_cpp2::cpp_reflection::service2_methodD_pargs args; args.get<0>().value = &p_i; args.get<1>().value = const_cast<::test_cpp2::cpp_reflection::struct1*>(&p_j); args.get<2>().value = &p_k; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "methodD", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_send_methodD(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "methodD", ::apache::thrift::FunctionQualifier::Unspecified, "service2"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_methodE(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::test_cpp2::cpp_reflection::service2_methodE_pargs args; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "methodE", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_send_methodE(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "methodE", ::apache::thrift::FunctionQualifier::Unspecified, "service2"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_methodF(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { ::test_cpp2::cpp_reflection::service2_methodF_pargs args; args.get<0>().value = &p_l; args.get<1>().value = const_cast<::test_cpp2::cpp_reflection::struct1*>(&p_m); args.get<2>().value = &p_n; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "methodF", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_send_methodF(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "methodF", ::apache::thrift::FunctionQualifier::Unspecified, "service2"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodA(std::unique_ptr callback) { ::apache::thrift::RpcOptions rpcOptions; methodA(rpcOptions, std::move(callback)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodA(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = methodACtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_methodA(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_and_send_methodA(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_methodA(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_methodA(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_methodA(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodACtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "service2.methodA", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodA() { ::apache::thrift::RpcOptions rpcOptions; sync_methodA(rpcOptions); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodA(apache::thrift::RpcOptions& rpcOptions) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = methodACtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_methodA(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { recv_methodA(returnState); }); } folly::Future apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodA() { ::apache::thrift::RpcOptions rpcOptions; return future_methodA(rpcOptions); } folly::SemiFuture apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodA() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_methodA(rpcOptions); } folly::Future apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodA(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodA, channel_); methodA(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodA(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodA, channel_); auto callback = std::move(callbackAndFuture.first); methodA(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_future_methodA(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodA, channel_); methodA(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_semifuture_methodA(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodA, channel_); auto callback = std::move(callbackAndFuture.first); methodA(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodA(folly::Function callback) { methodA(std::make_unique(std::move(callback))); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_wrapped_methodA(::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::test_cpp2::cpp_reflection::service2_methodA_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_methodA(::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_methodA(state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_methodA(::apache::thrift::ClientReceiveState& state) { recv_methodA(state); } folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_wrapped_methodA(::apache::thrift::ClientReceiveState& state) { return recv_wrapped_methodA(state); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodB(std::unique_ptr callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { ::apache::thrift::RpcOptions rpcOptions; methodB(rpcOptions, std::move(callback), p_x, p_y, p_z); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodB(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { auto [ctx, header] = methodBCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_methodB(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_x, p_y, p_z); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_and_send_methodB(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_methodB(&writer, rpcOptions, *header, contextStack, p_x, p_y, p_z); if (stealRpcOptions) { fbthrift_send_methodB(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_methodB(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodBCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "service2.methodB", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { ::apache::thrift::RpcOptions rpcOptions; sync_methodB(rpcOptions, p_x, p_y, p_z); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = methodBCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_methodB(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_x, p_y, p_z); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { recv_methodB(returnState); }); } folly::Future apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { ::apache::thrift::RpcOptions rpcOptions; return future_methodB(rpcOptions, p_x, p_y, p_z); } folly::SemiFuture apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_methodB(rpcOptions, p_x, p_y, p_z); } folly::Future apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodB, channel_); methodB(rpcOptions, std::move(callback), p_x, p_y, p_z); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodB, channel_); auto callback = std::move(callbackAndFuture.first); methodB(rpcOptions, std::move(callback), p_x, p_y, p_z); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_future_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodB, channel_); methodB(rpcOptions, std::move(callback), p_x, p_y, p_z); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_semifuture_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodB, channel_); auto callback = std::move(callbackAndFuture.first); methodB(rpcOptions, std::move(callback), p_x, p_y, p_z); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodB(folly::Function callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { methodB(std::make_unique(std::move(callback)), p_x, p_y, p_z); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_wrapped_methodB(::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::test_cpp2::cpp_reflection::service2_methodB_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_methodB(::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_methodB(state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_methodB(::apache::thrift::ClientReceiveState& state) { recv_methodB(state); } folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_wrapped_methodB(::apache::thrift::ClientReceiveState& state) { return recv_wrapped_methodB(state); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodC(std::unique_ptr callback) { ::apache::thrift::RpcOptions rpcOptions; methodC(rpcOptions, std::move(callback)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodC(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = methodCCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_methodC(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_and_send_methodC(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_methodC(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_methodC(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_methodC(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodCCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "service2.methodC", *header); return {std::move(ctx), std::move(header)}; } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodC() { ::apache::thrift::RpcOptions rpcOptions; return sync_methodC(rpcOptions); } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodC(apache::thrift::RpcOptions& rpcOptions) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = methodCCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_methodC(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { return recv_methodC(returnState); }); } folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodC() { ::apache::thrift::RpcOptions rpcOptions; return future_methodC(rpcOptions); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodC() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_methodC(rpcOptions); } folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodC(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::std::int32_t>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodC, channel_); methodC(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodC(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodC, channel_); auto callback = std::move(callbackAndFuture.first); methodC(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_future_methodC(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodC, channel_); methodC(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_semifuture_methodC(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodC, channel_); auto callback = std::move(callbackAndFuture.first); methodC(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodC(folly::Function callback) { methodC(std::make_unique(std::move(callback))); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_wrapped_methodC(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::test_cpp2::cpp_reflection::service2_methodC_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_methodC(::apache::thrift::ClientReceiveState& state) { ::std::int32_t _return; auto ew = recv_wrapped_methodC(_return, state); if (ew) { ew.throw_exception(); } return _return; } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_methodC(::apache::thrift::ClientReceiveState& state) { return recv_methodC(state); } folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_wrapped_methodC(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_methodC(_return, state); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodD(std::unique_ptr callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { ::apache::thrift::RpcOptions rpcOptions; methodD(rpcOptions, std::move(callback), p_i, p_j, p_k); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodD(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { auto [ctx, header] = methodDCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_methodD(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_i, p_j, p_k); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_and_send_methodD(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_methodD(&writer, rpcOptions, *header, contextStack, p_i, p_j, p_k); if (stealRpcOptions) { fbthrift_send_methodD(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_methodD(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodDCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "service2.methodD", *header); return {std::move(ctx), std::move(header)}; } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { ::apache::thrift::RpcOptions rpcOptions; return sync_methodD(rpcOptions, p_i, p_j, p_k); } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = methodDCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_methodD(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_i, p_j, p_k); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { return recv_methodD(returnState); }); } folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { ::apache::thrift::RpcOptions rpcOptions; return future_methodD(rpcOptions, p_i, p_j, p_k); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_methodD(rpcOptions, p_i, p_j, p_k); } folly::Future<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::std::int32_t>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodD, channel_); methodD(rpcOptions, std::move(callback), p_i, p_j, p_k); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodD, channel_); auto callback = std::move(callbackAndFuture.first); methodD(rpcOptions, std::move(callback), p_i, p_j, p_k); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_future_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodD, channel_); methodD(rpcOptions, std::move(callback), p_i, p_j, p_k); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_semifuture_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodD, channel_); auto callback = std::move(callbackAndFuture.first); methodD(rpcOptions, std::move(callback), p_i, p_j, p_k); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodD(folly::Function callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { methodD(std::make_unique(std::move(callback)), p_i, p_j, p_k); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_wrapped_methodD(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::test_cpp2::cpp_reflection::service2_methodD_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_methodD(::apache::thrift::ClientReceiveState& state) { ::std::int32_t _return; auto ew = recv_wrapped_methodD(_return, state); if (ew) { ew.throw_exception(); } return _return; } ::std::int32_t apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_methodD(::apache::thrift::ClientReceiveState& state) { return recv_methodD(state); } folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_wrapped_methodD(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_methodD(_return, state); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodE(std::unique_ptr callback) { ::apache::thrift::RpcOptions rpcOptions; methodE(rpcOptions, std::move(callback)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodE(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = methodECtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_methodE(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_and_send_methodE(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_methodE(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_methodE(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_methodE(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodECtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "service2.methodE", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodE(::test_cpp2::cpp_reflection::struct2& _return) { ::apache::thrift::RpcOptions rpcOptions; sync_methodE(rpcOptions, _return); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodE(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct2& _return) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = methodECtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_methodE(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { recv_methodE(_return, returnState); }); } folly::Future<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodE() { ::apache::thrift::RpcOptions rpcOptions; return future_methodE(rpcOptions); } folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodE() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_methodE(rpcOptions); } folly::Future<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodE(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::test_cpp2::cpp_reflection::struct2>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodE, channel_); methodE(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodE(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodE, channel_); auto callback = std::move(callbackAndFuture.first); methodE(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_future_methodE(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodE, channel_); methodE(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_semifuture_methodE(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodE, channel_); auto callback = std::move(callbackAndFuture.first); methodE(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodE(folly::Function callback) { methodE(std::make_unique(std::move(callback))); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_wrapped_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::test_cpp2::cpp_reflection::service2_methodE_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_methodE(_return, state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { return recv_methodE(_return, state); } folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_wrapped_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_methodE(_return, state); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodF(std::unique_ptr callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { ::apache::thrift::RpcOptions rpcOptions; methodF(rpcOptions, std::move(callback), p_l, p_m, p_n); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodF(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { auto [ctx, header] = methodFCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_methodF(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_l, p_m, p_n); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::fbthrift_serialize_and_send_methodF(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_methodF(&writer, rpcOptions, *header, contextStack, p_l, p_m, p_n); if (stealRpcOptions) { fbthrift_send_methodF(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_methodF(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodFCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "service2.methodF", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { ::apache::thrift::RpcOptions rpcOptions; sync_methodF(rpcOptions, _return, p_l, p_m, p_n); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::sync_methodF(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct2& _return, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = methodFCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_methodF(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_l, p_m, p_n); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { recv_methodF(_return, returnState); }); } folly::Future<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { ::apache::thrift::RpcOptions rpcOptions; return future_methodF(rpcOptions, p_l, p_m, p_n); } folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_methodF(rpcOptions, p_l, p_m, p_n); } folly::Future<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::future_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::test_cpp2::cpp_reflection::struct2>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodF, channel_); methodF(rpcOptions, std::move(callback), p_l, p_m, p_n); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::semifuture_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_methodF, channel_); auto callback = std::move(callbackAndFuture.first); methodF(rpcOptions, std::move(callback), p_l, p_m, p_n); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_future_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_methodF, channel_); methodF(rpcOptions, std::move(callback), p_l, p_m, p_n); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::header_semifuture_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_methodF, channel_); auto callback = std::move(callbackAndFuture.first); methodF(rpcOptions, std::move(callback), p_l, p_m, p_n); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::methodF(folly::Function callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { methodF(std::make_unique(std::move(callback)), p_l, p_m, p_n); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_wrapped_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::test_cpp2::cpp_reflection::service2_methodF_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_methodF(_return, state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { return recv_methodF(_return, state); } folly::exception_wrapper apache::thrift::Client<::test_cpp2::cpp_reflection::service2>::recv_instance_wrapped_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_methodF(_return, state); }