/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/basic-annotations/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-annotations/gen-cpp2/module_types.h" namespace apache { namespace thrift { class Cpp2RequestContext; namespace detail { namespace ac { struct ClientRequestContext; }} namespace transport { class THeader; } }} namespace cpp2 { class MyService; } // namespace cpp2 namespace apache::thrift { template <> class Client<::cpp2::MyService> : public apache::thrift::GeneratedAsyncClient { public: using apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient; char const* getServiceName() const noexcept override { return "MyService"; } /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void sync_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void sync_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future future_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture semifuture_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future future_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture semifuture_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future>> header_future_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ template folly::coro::Task co_ping() { return co_ping(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void recv_instance_ping(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void sync_getRandomData(::std::string& _return); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future<::std::string> future_getRandomData(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::SemiFuture<::std::string> semifuture_getRandomData(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future>> header_future_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool sync_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::Future future_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::SemiFuture semifuture_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool recv_instance_hasDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void recv_instance_putDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void lobDataById(std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_dataStr); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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_dataStr); 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_dataStr, bool stealRpcOptions = false); public: /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void sync_lobDataById(::std::int64_t p_id, const ::std::string& p_dataStr); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void sync_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_dataStr); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual folly::Future future_lobDataById(::std::int64_t p_id, const ::std::string& p_dataStr); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual folly::SemiFuture semifuture_lobDataById(::std::int64_t p_id, const ::std::string& p_dataStr); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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_dataStr); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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_dataStr); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ template folly::coro::Task co_lobDataById(::std::int64_t p_id, const ::std::string& p_dataStr) { return co_lobDataById(nullptr, p_id, p_dataStr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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_dataStr) { return co_lobDataById(&rpcOptions, p_id, p_dataStr); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ folly::coro::Task co_lobDataById(::std::int64_t p_id, const ::std::string& p_dataStr) { co_await folly::coro::detachOnCancel(semifuture_lobDataById(p_id, p_dataStr)); } /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/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_dataStr) { co_await folly::coro::detachOnCancel(semifuture_lobDataById(rpcOptions, p_id, p_dataStr)); } #endif private: template folly::coro::Task co_lobDataById(apache::thrift::RpcOptions* rpcOptions, ::std::int64_t p_id, const ::std::string& p_dataStr) { 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_dataStr); } else { fbthrift_serialize_and_send_lobDataById(*defaultRpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_dataStr); } 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-annotations/src/module.thrift", "service": "MyService", "function": "lobDataById"} */ virtual void lobDataById(folly::Function callback, ::std::int64_t p_id, const ::std::string& p_dataStr); 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_dataStr); 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-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual void cppDoNothing(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual void cppDoNothing(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void fbthrift_serialize_and_send_cppDoNothing(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-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual void sync_cppDoNothing(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual void sync_cppDoNothing(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::Future future_cppDoNothing(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::SemiFuture semifuture_cppDoNothing(); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::Future future_cppDoNothing(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::SemiFuture semifuture_cppDoNothing(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::Future>> header_future_cppDoNothing(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::SemiFuture>> header_semifuture_cppDoNothing(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ template folly::coro::Task co_cppDoNothing() { return co_cppDoNothing(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ template folly::coro::Task co_cppDoNothing(apache::thrift::RpcOptions& rpcOptions) { return co_cppDoNothing(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ folly::coro::Task co_cppDoNothing() { co_await folly::coro::detachOnCancel(semifuture_cppDoNothing()); } /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ folly::coro::Task co_cppDoNothing(apache::thrift::RpcOptions& rpcOptions) { co_await folly::coro::detachOnCancel(semifuture_cppDoNothing(rpcOptions)); } #endif private: template folly::coro::Task co_cppDoNothing(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] = cppDoNothingCtx(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_cppDoNothing(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { fbthrift_serialize_and_send_cppDoNothing(*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_cppDoNothing(returnState)) { co_yield folly::coro::co_error(std::move(ew)); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual void cppDoNothing(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ static folly::exception_wrapper recv_wrapped_cppDoNothing(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ static void recv_cppDoNothing(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual void recv_instance_cppDoNothing(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/basic-annotations/src/module.thrift", "service": "MyService", "function": "doNothing"} */ virtual folly::exception_wrapper recv_instance_wrapped_cppDoNothing(::apache::thrift::ClientReceiveState& state); private: template apache::thrift::SerializedRequest fbthrift_serialize_cppDoNothing(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack); template void fbthrift_send_cppDoNothing(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>> cppDoNothingCtx(apache::thrift::RpcOptions* rpcOptions); public: }; } // namespace apache::thrift namespace cpp2 { using MyServiceAsyncClient [[deprecated("Use apache::thrift::Client instead")]] = ::apache::thrift::Client; } // namespace cpp2