/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/py3/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/py3/gen-py3cpp/module_types.h" #if __has_include("thrift/compiler/test/fixtures/py3/gen-py3cpp/DerivedServiceAsyncClient.h") #include "thrift/compiler/test/fixtures/py3/gen-py3cpp/DerivedServiceAsyncClient.h" #else #include "thrift/compiler/test/fixtures/py3/gen-py3cpp/module_clients.h" #endif namespace apache { namespace thrift { class Cpp2RequestContext; namespace detail { namespace ac { struct ClientRequestContext; }} namespace transport { class THeader; } }} namespace py3::simple { class RederivedService; } // namespace py3::simple namespace apache::thrift { template <> class Client<::py3::simple::RederivedService> : public ::py3::simple::DerivedServiceAsyncClient { public: using ::py3::simple::DerivedServiceAsyncClient::DerivedServiceAsyncClient; char const* getServiceName() const noexcept override { return "RederivedService"; } /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual void get_seven(std::unique_ptr callback); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual void get_seven(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback); protected: void get_sevenImpl(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/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual ::std::int32_t sync_get_seven(); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual ::std::int32_t sync_get_seven(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::Future<::std::int32_t> future_get_seven(); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_get_seven(); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::Future<::std::int32_t> future_get_seven(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::SemiFuture<::std::int32_t> semifuture_get_seven(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::Future>> header_future_get_seven(apache::thrift::RpcOptions& rpcOptions); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::SemiFuture>> header_semifuture_get_seven(apache::thrift::RpcOptions& rpcOptions); #if FOLLY_HAS_COROUTINES #if __clang__ /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ template folly::coro::Task<::std::int32_t> co_get_seven() { return co_get_seven(nullptr); } /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ template folly::coro::Task<::std::int32_t> co_get_seven(apache::thrift::RpcOptions& rpcOptions) { return co_get_seven(&rpcOptions); } #else /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ folly::coro::Task<::std::int32_t> co_get_seven() { co_return co_await folly::coro::detachOnCancel(semifuture_get_seven()); } /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ folly::coro::Task<::std::int32_t> co_get_seven(apache::thrift::RpcOptions& rpcOptions) { co_return co_await folly::coro::detachOnCancel(semifuture_get_seven(rpcOptions)); } #endif private: template folly::coro::Task<::std::int32_t> co_get_seven(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] = get_sevenCtx(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) { get_sevenImpl(*rpcOptions, std::move(header), ctx.get(), std::move(wrappedCallback)); } else { get_sevenImpl(*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::int32_t _return; if (auto ew = recv_wrapped_get_seven(_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/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual void get_seven(folly::Function callback); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ static folly::exception_wrapper recv_wrapped_get_seven(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ static ::std::int32_t recv_get_seven(::apache::thrift::ClientReceiveState& state); // Mock friendly virtual instance method /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual ::std::int32_t recv_instance_get_seven(::apache::thrift::ClientReceiveState& state); /** Glean {"file": "thrift/compiler/test/fixtures/py3/src/module.thrift", "service": "RederivedService", "function": "get_seven"} */ virtual folly::exception_wrapper recv_instance_wrapped_get_seven(::std::int32_t& _return, ::apache::thrift::ClientReceiveState& state); private: template void get_sevenT(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>> get_sevenCtx(apache::thrift::RpcOptions* rpcOptions); public: }; } // namespace apache::thrift namespace py3::simple { using RederivedServiceAsyncClient [[deprecated("Use apache::thrift::Client instead")]] = ::apache::thrift::Client; } // namespace py3::simple