/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void pingImpl(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/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void sync_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void sync_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future future_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture semifuture_ping(); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future future_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::SemiFuture semifuture_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::Future>> header_future_ping(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ template folly::coro::Task co_ping() { return co_ping(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/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); if constexpr (hasRpcOptions) { pingImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { pingImpl(*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 (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/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void ping(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ static folly::exception_wrapper recv_wrapped_ping(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual void recv_instance_ping(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "ping"} */ virtual folly::exception_wrapper recv_instance_wrapped_ping(::apache::thrift::ClientReceiveState& state); private: template void pingT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, 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/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void getRandomDataImpl(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/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void sync_getRandomData(::std::string& _return); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void sync_getRandomData(apache::thrift::RpcOptions& rpcOptions, ::std::string& _return); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future<::std::string> future_getRandomData(); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::SemiFuture<::std::string> semifuture_getRandomData(); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future<::std::string> future_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::SemiFuture<::std::string> semifuture_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::Future>> header_future_getRandomData(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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); if constexpr (hasRpcOptions) { getRandomDataImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { getRandomDataImpl(*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 (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/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual void getRandomData(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "getRandomData"} */ virtual folly::exception_wrapper recv_instance_wrapped_getRandomData(::std::string& _return, ::apache::thrift::ClientReceiveState& state); private: template void getRandomDataT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, 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/no_metadata/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/no_metadata/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 hasDataByIdImpl(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/no_metadata/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool sync_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::Future future_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::SemiFuture semifuture_hasDataById(::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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); if constexpr (hasRpcOptions) { hasDataByIdImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } else { hasDataByIdImpl(*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 (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/no_metadata/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual void hasDataById(folly::Function callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual bool recv_instance_hasDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "hasDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_hasDataById(bool& _return, ::apache::thrift::ClientReceiveState& state); private: template void hasDataByIdT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id); 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/no_metadata/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/no_metadata/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 getDataByIdImpl(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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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); if constexpr (hasRpcOptions) { getDataByIdImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id); } else { getDataByIdImpl(*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 (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/no_metadata/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual void getDataById(folly::Function callback, ::std::int64_t p_id); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "getDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state); private: template void getDataByIdT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id); 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/no_metadata/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/no_metadata/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 putDataByIdImpl(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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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); if constexpr (hasRpcOptions) { putDataByIdImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_data); } else { putDataByIdImpl(*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 (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/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "putDataById"} */ static folly::exception_wrapper recv_wrapped_putDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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/no_metadata/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual void recv_instance_putDataById(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/src/module.thrift", "service": "MyService", "function": "putDataById"} */ virtual folly::exception_wrapper recv_instance_wrapped_putDataById(::apache::thrift::ClientReceiveState& state); private: template void putDataByIdT(Protocol_* prot, 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); 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/no_metadata/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/no_metadata/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 lobDataByIdImpl(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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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/no_metadata/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); if constexpr (hasRpcOptions) { lobDataByIdImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback), p_id, p_data); } else { lobDataByIdImpl(*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 (returnState.isException()) { co_yield folly::coro::co_error(std::move(returnState.exception())); } } public: #endif // FOLLY_HAS_COROUTINES /** Glean {"file": "thrift/compiler/test/fixtures/no_metadata/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 void lobDataByIdT(Protocol_* prot, 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); std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> lobDataByIdCtx(apache::thrift::RpcOptions* rpcOptions); public: }; } // namespace apache::thrift namespace cpp2 { using MyServiceAsyncClient [[deprecated("Use apache::thrift::Client instead")]] = ::apache::thrift::Client; } // namespace cpp2