/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/visitation/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #pragma once #include #include "thrift/compiler/test/fixtures/visitation/gen-cpp2/module_types.h" #include "thrift/compiler/test/fixtures/visitation/gen-cpp2/reflection_dep_B_types.h" #include "thrift/compiler/test/fixtures/visitation/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 service1; } // namespace test_cpp2::cpp_reflection namespace apache::thrift { template <> class Client<::test_cpp2::cpp_reflection::service1> : public apache::thrift::GeneratedAsyncClient { public: using apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient; char const* getServiceName() const noexcept override { return "service1"; } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual void method1(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual void method1(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_method1(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/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual void sync_method1(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual void sync_method1(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::Future future_method1(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::SemiFuture semifuture_method1(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::Future future_method1(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::SemiFuture semifuture_method1(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::Future>> header_future_method1(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::SemiFuture>> header_semifuture_method1(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ template folly::coro::Task co_method1() { return co_method1(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ template folly::coro::Task co_method1(apache::thrift::RpcOptions& rpcOptions) { return co_method1(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ folly::coro::Task co_method1() { co_await folly::coro::detachOnCancel(semifuture_method1()); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ folly::coro::Task co_method1(apache::thrift::RpcOptions& rpcOptions) { co_await folly::coro::detachOnCancel(semifuture_method1(rpcOptions)); } #endif private: template folly::coro::Task co_method1(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] = method1Ctx(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_method1(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_method1(*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_method1(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual void method1(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ static folly::exception_wrapper recv_wrapped_method1(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ static void recv_method1(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual void recv_instance_method1(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method1"} */ virtual folly::exception_wrapper recv_instance_wrapped_method1(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_method1(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_method1(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>> method1Ctx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual void method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual void method2(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_method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual void sync_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual void sync_method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::Future future_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::SemiFuture semifuture_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::Future future_method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::SemiFuture semifuture_method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::Future>> header_future_method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::SemiFuture>> header_semifuture_method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ template folly::coro::Task co_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { return co_method2(nullptr, p_x, p_y, p_z); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ template folly::coro::Task co_method2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { return co_method2(&rpcOptions, p_x, p_y, p_z); } #else /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ folly::coro::Task co_method2(::std::int32_t p_x, const ::test_cpp2::cpp_reflection::struct1& p_y, double p_z) { co_await folly::coro::detachOnCancel(semifuture_method2(p_x, p_y, p_z)); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ folly::coro::Task co_method2(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_method2(rpcOptions, p_x, p_y, p_z)); } #endif private: template folly::coro::Task co_method2(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] = method2Ctx(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_method2(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_x, p_y, p_z); } else { fbthrift_serialize_and_send_method2(*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_method2(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual void method2(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/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ static folly::exception_wrapper recv_wrapped_method2(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ static void recv_method2(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual void recv_instance_method2(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method2"} */ virtual folly::exception_wrapper recv_instance_wrapped_method2(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_method2(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_method2(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>> method2Ctx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual void method3(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual void method3(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_method3(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/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual ::std::int32_t sync_method3(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual ::std::int32_t sync_method3(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::Future<::std::int32_t> future_method3(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_method3(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::Future<::std::int32_t> future_method3(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_method3(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::Future>> header_future_method3(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::SemiFuture>> header_semifuture_method3(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ template folly::coro::Task<::std::int32_t> co_method3() { return co_method3(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ template folly::coro::Task<::std::int32_t> co_method3(apache::thrift::RpcOptions& rpcOptions) { return co_method3(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ folly::coro::Task<::std::int32_t> co_method3() { co_return co_await folly::coro::detachOnCancel(semifuture_method3()); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ folly::coro::Task<::std::int32_t> co_method3(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_method3(rpcOptions)); } #endif private: template folly::coro::Task<::std::int32_t> co_method3(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] = method3Ctx(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_method3(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_method3(*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_method3(_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/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual void method3(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ static folly::exception_wrapper recv_wrapped_method3(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ static ::std::int32_t recv_method3(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual ::std::int32_t recv_instance_method3(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method3"} */ virtual folly::exception_wrapper recv_instance_wrapped_method3(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_method3(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_method3(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>> method3Ctx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual void method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual void method4(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_method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual ::std::int32_t sync_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual ::std::int32_t sync_method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::Future<::std::int32_t> future_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::Future<::std::int32_t> future_method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::Future>> header_future_method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::SemiFuture>> header_semifuture_method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ template folly::coro::Task<::std::int32_t> co_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { return co_method4(nullptr, p_i, p_j, p_k); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ template folly::coro::Task<::std::int32_t> co_method4(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { return co_method4(&rpcOptions, p_i, p_j, p_k); } #else /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ folly::coro::Task<::std::int32_t> co_method4(::std::int32_t p_i, const ::test_cpp2::cpp_reflection::struct1& p_j, double p_k) { co_return co_await folly::coro::detachOnCancel(semifuture_method4(p_i, p_j, p_k)); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ folly::coro::Task<::std::int32_t> co_method4(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_method4(rpcOptions, p_i, p_j, p_k)); } #endif private: template folly::coro::Task<::std::int32_t> co_method4(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] = method4Ctx(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_method4(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_i, p_j, p_k); } else { fbthrift_serialize_and_send_method4(*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_method4(_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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual void method4(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/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ static folly::exception_wrapper recv_wrapped_method4(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ static ::std::int32_t recv_method4(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual ::std::int32_t recv_instance_method4(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method4"} */ virtual folly::exception_wrapper recv_instance_wrapped_method4(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_method4(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_method4(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>> method4Ctx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual void method5(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual void method5(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_method5(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/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual void sync_method5(::test_cpp2::cpp_reflection::struct2& _return); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual void sync_method5(apache::thrift::RpcOptions& rpcOptions, ::test_cpp2::cpp_reflection::struct2& _return); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_method5(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_method5(); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_method5(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_method5(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::Future>> header_future_method5(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::SemiFuture>> header_semifuture_method5(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method5() { return co_method5(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method5(apache::thrift::RpcOptions& rpcOptions) { return co_method5(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method5() { co_return co_await folly::coro::detachOnCancel(semifuture_method5()); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method5(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_method5(rpcOptions)); } #endif private: template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method5(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] = method5Ctx(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_method5(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_method5(*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_method5(_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/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual void method5(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ static folly::exception_wrapper recv_wrapped_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ static void recv_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual void recv_instance_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method5"} */ virtual folly::exception_wrapper recv_instance_wrapped_method5(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_method5(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_method5(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>> method5Ctx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual void method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual void method6(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_method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual void sync_method6(::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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual void sync_method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_method6(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_method6(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::Future<::test_cpp2::cpp_reflection::struct2> future_method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::SemiFuture<::test_cpp2::cpp_reflection::struct2> semifuture_method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::Future>> header_future_method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::SemiFuture>> header_semifuture_method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method6(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { return co_method6(nullptr, p_l, p_m, p_n); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method6(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { return co_method6(&rpcOptions, p_l, p_m, p_n); } #else /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method6(::std::int32_t p_l, const ::test_cpp2::cpp_reflection::struct1& p_m, double p_n) { co_return co_await folly::coro::detachOnCancel(semifuture_method6(p_l, p_m, p_n)); } /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method6(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_method6(rpcOptions, p_l, p_m, p_n)); } #endif private: template folly::coro::Task<::test_cpp2::cpp_reflection::struct2> co_method6(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] = method6Ctx(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_method6(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_l, p_m, p_n); } else { fbthrift_serialize_and_send_method6(*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_method6(_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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual void method6(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/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ static folly::exception_wrapper recv_wrapped_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ static void recv_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual void recv_instance_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/visitation/src/module.thrift", "service": "service1", "function": "method6"} */ virtual folly::exception_wrapper recv_instance_wrapped_method6(::test_cpp2::cpp_reflection::struct2& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_method6(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_method6(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>> method6Ctx(apache::thrift::RpcOptions* rpcOptions); public: }; } // namespace apache::thrift namespace test_cpp2::cpp_reflection { using service1AsyncClient [[deprecated("Use apache::thrift::Client instead")]] = ::apache::thrift::Client; } // namespace test_cpp2::cpp_reflection