/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/fatal/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #pragma once #include #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/module_types.h" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/reflection_dep_B_types.h" #include "thrift/compiler/test/fixtures/fatal/gen-cpp2/reflection_dep_C_types.h" #include "thrift/test/fatal_custom_types.h" namespace apache { namespace thrift { class Cpp2RequestContext; namespace detail { namespace ac { struct ClientRequestContext; }} namespace transport { class THeader; } }} namespace test_cpp2::cpp_reflection { class service2; } // namespace test_cpp2::cpp_reflection namespace apache::thrift { template <> class Client<::test_cpp2::cpp_reflection::service2> : public apache::thrift::GeneratedAsyncClient { public: using apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient; char const* getServiceName() const noexcept override { return "service2"; } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual void methodA(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual void methodA(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_methodA(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual void sync_methodA(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual void sync_methodA(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::Future future_methodA(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::SemiFuture semifuture_methodA(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::Future future_methodA(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::SemiFuture semifuture_methodA(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::Future>> header_future_methodA(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::SemiFuture>> header_semifuture_methodA(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ template folly::coro::Task co_methodA() { return co_methodA(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ template folly::coro::Task co_methodA(apache::thrift::RpcOptions& rpcOptions) { return co_methodA(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ folly::coro::Task co_methodA() { co_await folly::coro::detachOnCancel(semifuture_methodA()); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ folly::coro::Task co_methodA(apache::thrift::RpcOptions& rpcOptions) { co_await folly::coro::detachOnCancel(semifuture_methodA(rpcOptions)); } #endif private: template folly::coro::Task co_methodA(apache::thrift::RpcOptions* rpcOptions) { const folly::CancellationToken& cancelToken = co_await folly::coro::co_current_cancellation_token; const bool cancellable = cancelToken.canBeCancelled(); apache::thrift::ClientReceiveState returnState; apache::thrift::ClientCoroCallback callback(&returnState, co_await folly::coro::co_current_executor); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto [ctx, header] = methodACtx(rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback); const bool shouldProcessClientInterceptors = ctx && ctx->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnRequest(); } if constexpr (hasRpcOptions) { fbthrift_serialize_and_send_methodA(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_methodA(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } if (cancellable) { folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); }); co_await callback.co_waitUntilDone(); } else { co_await callback.co_waitUntilDone(); } if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnResponse(); } if (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctx)); SCOPE_EXIT { if (hasRpcOptions && returnState.header()) { auto* rheader = returnState.header(); if (!rheader->getHeaders().empty()) { rpcOptions->setReadHeaders(rheader->releaseHeaders()); } rpcOptions->setRoutingData(rheader->releaseRoutingData()); } }; if (auto ew = recv_wrapped_methodA(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual void methodA(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ static folly::exception_wrapper recv_wrapped_methodA(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ static void recv_methodA(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual void recv_instance_methodA(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodA"} */ virtual folly::exception_wrapper recv_instance_wrapped_methodA(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_methodA(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_methodA(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> methodACtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual void methodB(std::unique_ptr callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual void 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); protected: void 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 = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual void sync_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual void sync_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::Future future_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::SemiFuture semifuture_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::Future future_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::SemiFuture semifuture_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::Future>> header_future_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::SemiFuture>> header_semifuture_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ template folly::coro::Task co_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { return co_methodB(nullptr, p_x, p_y, p_z); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ template folly::coro::Task co_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { return co_methodB(&rpcOptions, p_x, p_y, p_z); } #else /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ folly::coro::Task co_methodB(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { co_await folly::coro::detachOnCancel(semifuture_methodB(p_x, p_y, p_z)); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ folly::coro::Task co_methodB(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { co_await folly::coro::detachOnCancel(semifuture_methodB(rpcOptions, p_x, p_y, p_z)); } #endif private: template folly::coro::Task co_methodB(apache::thrift::RpcOptions* rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { const folly::CancellationToken& cancelToken = co_await folly::coro::co_current_cancellation_token; const bool cancellable = cancelToken.canBeCancelled(); apache::thrift::ClientReceiveState returnState; apache::thrift::ClientCoroCallback callback(&returnState, co_await folly::coro::co_current_executor); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto [ctx, header] = methodBCtx(rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback); const bool shouldProcessClientInterceptors = ctx && ctx->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnRequest(); } if constexpr (hasRpcOptions) { fbthrift_serialize_and_send_methodB(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_x, p_y, p_z); } else { fbthrift_serialize_and_send_methodB(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_x, p_y, p_z); } if (cancellable) { folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); }); co_await callback.co_waitUntilDone(); } else { co_await callback.co_waitUntilDone(); } if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnResponse(); } if (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctx)); SCOPE_EXIT { if (hasRpcOptions && returnState.header()) { auto* rheader = returnState.header(); if (!rheader->getHeaders().empty()) { rpcOptions->setReadHeaders(rheader->releaseHeaders()); } rpcOptions->setRoutingData(rheader->releaseRoutingData()); } }; if (auto ew = recv_wrapped_methodB(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual void methodB(folly::Function callback, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ static folly::exception_wrapper recv_wrapped_methodB(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ static void recv_methodB(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual void recv_instance_methodB(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodB"} */ virtual folly::exception_wrapper recv_instance_wrapped_methodB(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest 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); template void fbthrift_send_methodB(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> methodBCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual void methodC(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual void methodC(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_methodC(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual ::std::int32_t sync_methodC(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual ::std::int32_t sync_methodC(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::Future<::std::int32_t> future_methodC(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_methodC(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::Future<::std::int32_t> future_methodC(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_methodC(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::Future>> header_future_methodC(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::SemiFuture>> header_semifuture_methodC(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ template folly::coro::Task<::std::int32_t> co_methodC() { return co_methodC(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ template folly::coro::Task<::std::int32_t> co_methodC(apache::thrift::RpcOptions& rpcOptions) { return co_methodC(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ folly::coro::Task<::std::int32_t> co_methodC() { co_return co_await folly::coro::detachOnCancel(semifuture_methodC()); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ folly::coro::Task<::std::int32_t> co_methodC(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_methodC(rpcOptions)); } #endif private: template folly::coro::Task<::std::int32_t> co_methodC(apache::thrift::RpcOptions* rpcOptions) { const folly::CancellationToken& cancelToken = co_await folly::coro::co_current_cancellation_token; const bool cancellable = cancelToken.canBeCancelled(); apache::thrift::ClientReceiveState returnState; apache::thrift::ClientCoroCallback callback(&returnState, co_await folly::coro::co_current_executor); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto [ctx, header] = methodCCtx(rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback); const bool shouldProcessClientInterceptors = ctx && ctx->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnRequest(); } if constexpr (hasRpcOptions) { fbthrift_serialize_and_send_methodC(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_methodC(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } if (cancellable) { folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); }); co_await callback.co_waitUntilDone(); } else { co_await callback.co_waitUntilDone(); } if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnResponse(); } if (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctx)); SCOPE_EXIT { if (hasRpcOptions && returnState.header()) { auto* rheader = returnState.header(); if (!rheader->getHeaders().empty()) { rpcOptions->setReadHeaders(rheader->releaseHeaders()); } rpcOptions->setRoutingData(rheader->releaseRoutingData()); } }; ::std::int32_t _return; if (auto ew = recv_wrapped_methodC(_return, returnState)) { co_yield folly::coro::co_error(std::move(ew)); } co_return _return; } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual void methodC(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ static folly::exception_wrapper recv_wrapped_methodC(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ static ::std::int32_t recv_methodC(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual ::std::int32_t recv_instance_methodC(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodC"} */ virtual folly::exception_wrapper recv_instance_wrapped_methodC(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_methodC(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_methodC(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> methodCCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual void methodD(std::unique_ptr callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual void 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); protected: void 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 = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual ::std::int32_t sync_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual ::std::int32_t sync_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::Future<::std::int32_t> future_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::Future<::std::int32_t> future_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::Future>> header_future_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::SemiFuture>> header_semifuture_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ template folly::coro::Task<::std::int32_t> co_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { return co_methodD(nullptr, p_i, p_j, p_k); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ template folly::coro::Task<::std::int32_t> co_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { return co_methodD(&rpcOptions, p_i, p_j, p_k); } #else /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ folly::coro::Task<::std::int32_t> co_methodD(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { co_return co_await folly::coro::detachOnCancel(semifuture_methodD(p_i, p_j, p_k)); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ folly::coro::Task<::std::int32_t> co_methodD(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { co_return co_await folly::coro::detachOnCancel(semifuture_methodD(rpcOptions, p_i, p_j, p_k)); } #endif private: template folly::coro::Task<::std::int32_t> co_methodD(apache::thrift::RpcOptions* rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { const folly::CancellationToken& cancelToken = co_await folly::coro::co_current_cancellation_token; const bool cancellable = cancelToken.canBeCancelled(); apache::thrift::ClientReceiveState returnState; apache::thrift::ClientCoroCallback callback(&returnState, co_await folly::coro::co_current_executor); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto [ctx, header] = methodDCtx(rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback); const bool shouldProcessClientInterceptors = ctx && ctx->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnRequest(); } if constexpr (hasRpcOptions) { fbthrift_serialize_and_send_methodD(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_i, p_j, p_k); } else { fbthrift_serialize_and_send_methodD(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_i, p_j, p_k); } if (cancellable) { folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); }); co_await callback.co_waitUntilDone(); } else { co_await callback.co_waitUntilDone(); } if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnResponse(); } if (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctx)); SCOPE_EXIT { if (hasRpcOptions && returnState.header()) { auto* rheader = returnState.header(); if (!rheader->getHeaders().empty()) { rpcOptions->setReadHeaders(rheader->releaseHeaders()); } rpcOptions->setRoutingData(rheader->releaseRoutingData()); } }; ::std::int32_t _return; if (auto ew = recv_wrapped_methodD(_return, returnState)) { co_yield folly::coro::co_error(std::move(ew)); } co_return _return; } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual void methodD(folly::Function callback, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ static folly::exception_wrapper recv_wrapped_methodD(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ static ::std::int32_t recv_methodD(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual ::std::int32_t recv_instance_methodD(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodD"} */ virtual folly::exception_wrapper recv_instance_wrapped_methodD(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest 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); template void fbthrift_send_methodD(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> methodDCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual void methodE(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual void methodE(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_methodE(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual void sync_methodE(::test_cpp2::cpp_reflection::struct2& _return); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual void sync_methodE(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct2& _return); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_methodE(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_methodE(); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_methodE(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_methodE(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::Future>> header_future_methodE(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::SemiFuture>> header_semifuture_methodE(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodE() { return co_methodE(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodE(apache::thrift::RpcOptions& rpcOptions) { return co_methodE(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodE() { co_return co_await folly::coro::detachOnCancel(semifuture_methodE()); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodE(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_methodE(rpcOptions)); } #endif private: template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodE(apache::thrift::RpcOptions* rpcOptions) { const folly::CancellationToken& cancelToken = co_await folly::coro::co_current_cancellation_token; const bool cancellable = cancelToken.canBeCancelled(); apache::thrift::ClientReceiveState returnState; apache::thrift::ClientCoroCallback callback(&returnState, co_await folly::coro::co_current_executor); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto [ctx, header] = methodECtx(rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback); const bool shouldProcessClientInterceptors = ctx && ctx->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnRequest(); } if constexpr (hasRpcOptions) { fbthrift_serialize_and_send_methodE(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_methodE(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } if (cancellable) { folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); }); co_await callback.co_waitUntilDone(); } else { co_await callback.co_waitUntilDone(); } if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnResponse(); } if (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctx)); SCOPE_EXIT { if (hasRpcOptions && returnState.header()) { auto* rheader = returnState.header(); if (!rheader->getHeaders().empty()) { rpcOptions->setReadHeaders(rheader->releaseHeaders()); } rpcOptions->setRoutingData(rheader->releaseRoutingData()); } }; ::test_cpp2::cpp_reflection::struct2 _return; if (auto ew = recv_wrapped_methodE(_return, returnState)) { co_yield folly::coro::co_error(std::move(ew)); } co_return _return; } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual void methodE(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ static folly::exception_wrapper recv_wrapped_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ static void recv_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual void recv_instance_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodE"} */ virtual folly::exception_wrapper recv_instance_wrapped_methodE(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_methodE(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_methodE(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> methodECtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual void methodF(std::unique_ptr callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual void 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); protected: void 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 = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual void sync_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual void 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); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::Future>> header_future_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::SemiFuture>> header_semifuture_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { return co_methodF(nullptr, p_l, p_m, p_n); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { return co_methodF(&rpcOptions, p_l, p_m, p_n); } #else /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodF(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { co_return co_await folly::coro::detachOnCancel(semifuture_methodF(p_l, p_m, p_n)); } /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodF(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { co_return co_await folly::coro::detachOnCancel(semifuture_methodF(rpcOptions, p_l, p_m, p_n)); } #endif private: template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_methodF(apache::thrift::RpcOptions* rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { const folly::CancellationToken& cancelToken = co_await folly::coro::co_current_cancellation_token; const bool cancellable = cancelToken.canBeCancelled(); apache::thrift::ClientReceiveState returnState; apache::thrift::ClientCoroCallback callback(&returnState, co_await folly::coro::co_current_executor); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto [ctx, header] = methodFCtx(rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; static apache::thrift::RpcOptions* defaultRpcOptions = new apache::thrift::RpcOptions(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback); const bool shouldProcessClientInterceptors = ctx && ctx->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnRequest(); } if constexpr (hasRpcOptions) { fbthrift_serialize_and_send_methodF(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_l, p_m, p_n); } else { fbthrift_serialize_and_send_methodF(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_l, p_m, p_n); } if (cancellable) { folly::CancellationCallback cb(cancelToken, [&] { CancellableCallback::cancel(std::move(cancellableCallback)); }); co_await callback.co_waitUntilDone(); } else { co_await callback.co_waitUntilDone(); } if (shouldProcessClientInterceptors) { co_await ctx->processClientInterceptorsOnResponse(); } if (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctx)); SCOPE_EXIT { if (hasRpcOptions && returnState.header()) { auto* rheader = returnState.header(); if (!rheader->getHeaders().empty()) { rpcOptions->setReadHeaders(rheader->releaseHeaders()); } rpcOptions->setRoutingData(rheader->releaseRoutingData()); } }; ::test_cpp2::cpp_reflection::struct2 _return; if (auto ew = recv_wrapped_methodF(_return, returnState)) { co_yield folly::coro::co_error(std::move(ew)); } co_return _return; } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual void methodF(folly::Function callback, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ static folly::exception_wrapper recv_wrapped_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ static void recv_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual void recv_instance_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/fatal/src/module.thrift", "service": "service2", "function": "methodF"} */ virtual folly::exception_wrapper recv_instance_wrapped_methodF(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest 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); template void fbthrift_send_methodF(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> methodFCtx(apache::thrift::RpcOptions* rpcOptions); public: }; } // namespace apache::thrift namespace test_cpp2::cpp_reflection { using service2AsyncClient [[deprecated("Use apache::thrift::Client instead")]] = ::apache::thrift::Client; } // namespace test_cpp2::cpp_reflection