/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/basic/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/basic/gen-cpp2/module_types.h" namespace apache { namespace thrift { class Cpp2RequestContext; namespace detail { namespace ac { struct ClientRequestContext; }} namespace transport { class THeader; } }} namespace test::fixtures::basic { class MyService; } // namespace test::fixtures::basic namespace apache::thrift { template <> class Client<::test::fixtures::basic::MyService> : public apache::thrift::GeneratedAsyncClient { public: using apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient; char const* getServiceName() const noexcept override { return "MyService"; } static const char* __fbthrift_thrift_uri() { return "test.dev/fixtures/basic/MyService"; } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_ping(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/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void sync_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void sync_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future future_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture semifuture_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future future_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture semifuture_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future>> header_future_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture>> header_semifuture_ping(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ template folly::coro::Task co_ping() { return co_ping(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ template folly::coro::Task co_ping(apache::thrift::RpcOptions& rpcOptions) { return co_ping(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ folly::coro::Task co_ping() { co_await folly::coro::detachOnCancel(semifuture_ping()); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ folly::coro::Task co_ping(apache::thrift::RpcOptions& rpcOptions) { co_await folly::coro::detachOnCancel(semifuture_ping(rpcOptions)); } #endif private: template folly::coro::Task co_ping(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] = pingCtx(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_ping(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_ping(*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_ping(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ static folly::exception_wrapper recv_wrapped_ping(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ static void recv_ping(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void recv_instance_ping(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::exception_wrapper recv_instance_wrapped_ping(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_ping(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_ping(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>> pingCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_getRandomData(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/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void sync_getRandomData(::std::string& _return); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void sync_getRandomData(apache::thrift::RpcOptions& rpcOptions, ::std::string& _return); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future<::std::string> future_getRandomData(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::SemiFuture<::std::string> semifuture_getRandomData(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future<::std::string> future_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::SemiFuture<::std::string> semifuture_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future>> header_future_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::SemiFuture>> header_semifuture_getRandomData(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ template folly::coro::Task<::std::string> co_getRandomData() { return co_getRandomData(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ template folly::coro::Task<::std::string> co_getRandomData(apache::thrift::RpcOptions& rpcOptions) { return co_getRandomData(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ folly::coro::Task<::std::string> co_getRandomData() { co_return co_await folly::coro::detachOnCancel(semifuture_getRandomData()); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ folly::coro::Task<::std::string> co_getRandomData(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_getRandomData(rpcOptions)); } #endif private: template folly::coro::Task<::std::string> co_getRandomData(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] = getRandomDataCtx(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_getRandomData(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_getRandomData(*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::string _return; if (auto ew = recv_wrapped_getRandomData(_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/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ static folly::exception_wrapper recv_wrapped_getRandomData(::std::string& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ static void recv_getRandomData(::std::string& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void recv_instance_getRandomData(::std::string& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::exception_wrapper recv_instance_wrapped_getRandomData(::std::string& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_getRandomData(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_getRandomData(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>> getRandomDataCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual void sink(std::unique_ptr callback, ::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual void sink(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_sink); protected: void fbthrift_serialize_and_send_sink(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_sink, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual void sync_sink(::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual void sync_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::Future future_sink(::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::SemiFuture semifuture_sink(::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::Future future_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::SemiFuture semifuture_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::Future>> header_future_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::SemiFuture>> header_semifuture_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ template folly::coro::Task co_sink(::std::int64_t p_sink) { return co_sink(nullptr, p_sink); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ template folly::coro::Task co_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink) { return co_sink(&rpcOptions, p_sink); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ folly::coro::Task co_sink(::std::int64_t p_sink) { co_await folly::coro::detachOnCancel(semifuture_sink(p_sink)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ folly::coro::Task co_sink(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_sink) { co_await folly::coro::detachOnCancel(semifuture_sink(rpcOptions, p_sink)); } #endif private: template folly::coro::Task co_sink(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_sink) { 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] = sinkCtx(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_sink(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_sink); } else { fbthrift_serialize_and_send_sink(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_sink); } 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_sink(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual void sink(folly::Function callback, ::std::int64_t p_sink); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ static folly::exception_wrapper recv_wrapped_sink(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ static void recv_sink(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual void recv_instance_sink(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "sink"} */ virtual folly::exception_wrapper recv_instance_wrapped_sink(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_sink(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_sink); template void fbthrift_send_sink(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>> sinkCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void putDataById(std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void putDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data); protected: void fbthrift_serialize_and_send_putDataById(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id, const ::std::string& p_data, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void sync_putDataById(::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void sync_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::Future future_putDataById(::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::SemiFuture semifuture_putDataById(::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::Future future_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::SemiFuture semifuture_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::Future>> header_future_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::SemiFuture>> header_semifuture_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ template folly::coro::Task co_putDataById(::std::int64_t p_id, const ::std::string& p_data) { return co_putDataById(nullptr, p_id, p_data); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ template folly::coro::Task co_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { return co_putDataById(&rpcOptions, p_id, p_data); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ folly::coro::Task co_putDataById(::std::int64_t p_id, const ::std::string& p_data) { co_await folly::coro::detachOnCancel(semifuture_putDataById(p_id, p_data)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ folly::coro::Task co_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { co_await folly::coro::detachOnCancel(semifuture_putDataById(rpcOptions, p_id, p_data)); } #endif private: template folly::coro::Task co_putDataById(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { 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] = putDataByIdCtx(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_putDataById(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_data); } else { fbthrift_serialize_and_send_putDataById(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_data); } 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_putDataById(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void putDataById(folly::Function callback, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ static folly::exception_wrapper recv_wrapped_putDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ static void recv_putDataById(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void recv_instance_putDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_putDataById(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_putDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id, const ::std::string& p_data); template void fbthrift_send_putDataById(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>> putDataByIdCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual void hasDataById(std::unique_ptr callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual void hasDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id); protected: void fbthrift_serialize_and_send_hasDataById(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool sync_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool sync_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::Future future_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::SemiFuture semifuture_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::Future future_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::SemiFuture semifuture_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::Future>> header_future_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::SemiFuture>> header_semifuture_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ template folly::coro::Task co_hasDataById(::std::int64_t p_id) { return co_hasDataById(nullptr, p_id); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ template folly::coro::Task co_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { return co_hasDataById(&rpcOptions, p_id); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ folly::coro::Task co_hasDataById(::std::int64_t p_id) { co_return co_await folly::coro::detachOnCancel(semifuture_hasDataById(p_id)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ folly::coro::Task co_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { co_return co_await folly::coro::detachOnCancel(semifuture_hasDataById(rpcOptions, p_id)); } #endif private: template folly::coro::Task co_hasDataById(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_id) { 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] = hasDataByIdCtx(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_hasDataById(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } else { fbthrift_serialize_and_send_hasDataById(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } 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()); } }; bool _return; if (auto ew = recv_wrapped_hasDataById(_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/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual void hasDataById(folly::Function callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ static folly::exception_wrapper recv_wrapped_hasDataById(bool& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ static bool recv_hasDataById(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool recv_instance_hasDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_hasDataById(bool& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_hasDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id); template void fbthrift_send_hasDataById(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>> hasDataByIdCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void getDataById(std::unique_ptr callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void getDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id); protected: void fbthrift_serialize_and_send_getDataById(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void sync_getDataById(::std::string& _return, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void sync_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::string& _return, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::Future<::std::string> future_getDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::SemiFuture<::std::string> semifuture_getDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::Future<::std::string> future_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::SemiFuture<::std::string> semifuture_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::Future>> header_future_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::SemiFuture>> header_semifuture_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ template folly::coro::Task<::std::string> co_getDataById(::std::int64_t p_id) { return co_getDataById(nullptr, p_id); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ template folly::coro::Task<::std::string> co_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { return co_getDataById(&rpcOptions, p_id); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ folly::coro::Task<::std::string> co_getDataById(::std::int64_t p_id) { co_return co_await folly::coro::detachOnCancel(semifuture_getDataById(p_id)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ folly::coro::Task<::std::string> co_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { co_return co_await folly::coro::detachOnCancel(semifuture_getDataById(rpcOptions, p_id)); } #endif private: template folly::coro::Task<::std::string> co_getDataById(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_id) { 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] = getDataByIdCtx(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_getDataById(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } else { fbthrift_serialize_and_send_getDataById(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } 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::string _return; if (auto ew = recv_wrapped_getDataById(_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/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void getDataById(folly::Function callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ static folly::exception_wrapper recv_wrapped_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ static void recv_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void recv_instance_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_getDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id); template void fbthrift_send_getDataById(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>> getDataByIdCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual void deleteDataById(std::unique_ptr callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual void deleteDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id); protected: void fbthrift_serialize_and_send_deleteDataById(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual void sync_deleteDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual void sync_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::Future future_deleteDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::SemiFuture semifuture_deleteDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::Future future_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::SemiFuture semifuture_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::Future>> header_future_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::SemiFuture>> header_semifuture_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ template folly::coro::Task co_deleteDataById(::std::int64_t p_id) { return co_deleteDataById(nullptr, p_id); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ template folly::coro::Task co_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { return co_deleteDataById(&rpcOptions, p_id); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ folly::coro::Task co_deleteDataById(::std::int64_t p_id) { co_await folly::coro::detachOnCancel(semifuture_deleteDataById(p_id)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ folly::coro::Task co_deleteDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { co_await folly::coro::detachOnCancel(semifuture_deleteDataById(rpcOptions, p_id)); } #endif private: template folly::coro::Task co_deleteDataById(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_id) { 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] = deleteDataByIdCtx(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_deleteDataById(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } else { fbthrift_serialize_and_send_deleteDataById(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } 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_deleteDataById(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual void deleteDataById(folly::Function callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ static folly::exception_wrapper recv_wrapped_deleteDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ static void recv_deleteDataById(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual void recv_instance_deleteDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "deleteDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_deleteDataById(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_deleteDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id); template void fbthrift_send_deleteDataById(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>> deleteDataByIdCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void lobDataById(std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void lobDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data); protected: void fbthrift_serialize_and_send_lobDataById(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id, const ::std::string& p_data, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void sync_lobDataById(::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void sync_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual folly::Future future_lobDataById(::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual folly::SemiFuture semifuture_lobDataById(::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual folly::Future future_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual folly::SemiFuture semifuture_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ template folly::coro::Task co_lobDataById(::std::int64_t p_id, const ::std::string& p_data) { return co_lobDataById(nullptr, p_id, p_data); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ template folly::coro::Task co_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { return co_lobDataById(&rpcOptions, p_id, p_data); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ folly::coro::Task co_lobDataById(::std::int64_t p_id, const ::std::string& p_data) { co_await folly::coro::detachOnCancel(semifuture_lobDataById(p_id, p_data)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ folly::coro::Task co_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { co_await folly::coro::detachOnCancel(semifuture_lobDataById(rpcOptions, p_id, p_data)); } #endif private: template folly::coro::Task co_lobDataById(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { 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 [ctx, header] = lobDataByIdCtx(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_lobDataById(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_data); } else { fbthrift_serialize_and_send_lobDataById(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_data); } 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())); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void lobDataById(folly::Function callback, ::std::int64_t p_id, const ::std::string& p_data); private: template apache::thrift::SerializedRequest fbthrift_serialize_lobDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id, const ::std::string& p_data); template void fbthrift_send_lobDataById(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>> lobDataByIdCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual void invalid_return_for_hack(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual void invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_invalid_return_for_hack(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/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual void sync_invalid_return_for_hack(::std::set& _return); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual void sync_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions, ::std::set& _return); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::Future<::std::set> future_invalid_return_for_hack(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::SemiFuture<::std::set> semifuture_invalid_return_for_hack(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::Future<::std::set> future_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::SemiFuture<::std::set> semifuture_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::Future, std::unique_ptr>> header_future_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::SemiFuture, std::unique_ptr>> header_semifuture_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ template folly::coro::Task<::std::set> co_invalid_return_for_hack() { return co_invalid_return_for_hack(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ template folly::coro::Task<::std::set> co_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions) { return co_invalid_return_for_hack(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ folly::coro::Task<::std::set> co_invalid_return_for_hack() { co_return co_await folly::coro::detachOnCancel(semifuture_invalid_return_for_hack()); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ folly::coro::Task<::std::set> co_invalid_return_for_hack(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_invalid_return_for_hack(rpcOptions)); } #endif private: template folly::coro::Task<::std::set> co_invalid_return_for_hack(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] = invalid_return_for_hackCtx(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_invalid_return_for_hack(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_invalid_return_for_hack(*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::set _return; if (auto ew = recv_wrapped_invalid_return_for_hack(_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/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual void invalid_return_for_hack(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ static folly::exception_wrapper recv_wrapped_invalid_return_for_hack(::std::set& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ static void recv_invalid_return_for_hack(::std::set& _return, ::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual void recv_instance_invalid_return_for_hack(::std::set& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "invalid_return_for_hack"} */ virtual folly::exception_wrapper recv_instance_wrapped_invalid_return_for_hack(::std::set& _return, ::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_invalid_return_for_hack(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_invalid_return_for_hack(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>> invalid_return_for_hackCtx(apache::thrift::RpcOptions* rpcOptions); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual void rpc_skipped_codegen(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual void rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_rpc_skipped_codegen(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/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual void sync_rpc_skipped_codegen(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual void sync_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::Future future_rpc_skipped_codegen(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::SemiFuture semifuture_rpc_skipped_codegen(); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::Future future_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::SemiFuture semifuture_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::Future>> header_future_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::SemiFuture>> header_semifuture_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ template folly::coro::Task co_rpc_skipped_codegen() { return co_rpc_skipped_codegen(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ template folly::coro::Task co_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions) { return co_rpc_skipped_codegen(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ folly::coro::Task co_rpc_skipped_codegen() { co_await folly::coro::detachOnCancel(semifuture_rpc_skipped_codegen()); } /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ folly::coro::Task co_rpc_skipped_codegen(apache::thrift::RpcOptions& rpcOptions) { co_await folly::coro::detachOnCancel(semifuture_rpc_skipped_codegen(rpcOptions)); } #endif private: template folly::coro::Task co_rpc_skipped_codegen(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] = rpc_skipped_codegenCtx(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_rpc_skipped_codegen(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_rpc_skipped_codegen(*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_rpc_skipped_codegen(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual void rpc_skipped_codegen(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ static folly::exception_wrapper recv_wrapped_rpc_skipped_codegen(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ static void recv_rpc_skipped_codegen(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual void recv_instance_rpc_skipped_codegen(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic/src/module.thrift", "service": "MyService", "function": "rpc_skipped_codegen"} */ virtual folly::exception_wrapper recv_instance_wrapped_rpc_skipped_codegen(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_rpc_skipped_codegen(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_rpc_skipped_codegen(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>> rpc_skipped_codegenCtx(apache::thrift::RpcOptions* rpcOptions); public: }; } // namespace apache::thrift namespace test::fixtures::basic { using MyServiceAsyncClient [[deprecated("Use apache::thrift::Client instead")]] = ::apache::thrift::Client; } // namespace test::fixtures::basic