/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/basic-stack-arguments/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include "thrift/compiler/test/fixtures/basic-stack-arguments/gen-cpp2/MyServiceAsyncClient.h" #include namespace cpp2 { typedef apache::thrift::ThriftPresult> MyService_hasDataById_pargs; typedef apache::thrift::ThriftPresult> MyService_hasDataById_presult; typedef apache::thrift::ThriftPresult> MyService_getDataById_pargs; typedef apache::thrift::ThriftPresult> MyService_getDataById_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::string, ::std::string*>> MyService_putDataById_pargs; typedef apache::thrift::ThriftPresult MyService_putDataById_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::string, ::std::string*>> MyService_lobDataById_pargs; } // namespace cpp2 template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_hasDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id) { ::cpp2::MyService_hasDataById_pargs args; args.get<0>().value = &p_id; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "hasDataById", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_hasDataById(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "hasDataById", ::apache::thrift::FunctionQualifier::Unspecified, "MyService"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_getDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id) { ::cpp2::MyService_getDataById_pargs args; args.get<0>().value = &p_id; const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "getDataById", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_getDataById(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "getDataById", ::apache::thrift::FunctionQualifier::Unspecified, "MyService"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::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) { ::cpp2::MyService_putDataById_pargs args; args.get<0>().value = &p_id; args.get<1>().value = const_cast<::std::string*>(&p_data); const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "putDataById", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_putDataById(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "putDataById", ::apache::thrift::FunctionQualifier::Unspecified, "MyService"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_lobDataById(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int64_t p_id, const ::std::string& p_data) { ::cpp2::MyService_lobDataById_pargs args; args.get<0>().value = &p_id; args.get<1>().value = const_cast<::std::string*>(&p_data); const auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; const auto writer = [&](Protocol_* p) { args.write(p); }; return apache::thrift::preprocessSendT( prot, rpcOptions, contextStack, header, "lobDataById", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_lobDataById(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "lobDataById", ::apache::thrift::FunctionQualifier::OneWay, "MyService"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } void apache::thrift::Client<::cpp2::MyService>::hasDataById(std::unique_ptr callback, ::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; hasDataById(rpcOptions, std::move(callback), p_id); } void apache::thrift::Client<::cpp2::MyService>::hasDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id) { auto [ctx, header] = hasDataByIdCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_hasDataById(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id); } void apache::thrift::Client<::cpp2::MyService>::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) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_hasDataById(&writer, rpcOptions, *header, contextStack, p_id); if (stealRpcOptions) { fbthrift_send_hasDataById(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_hasDataById(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::hasDataByIdCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "MyService.hasDataById", *header); return {std::move(ctx), std::move(header)}; } bool apache::thrift::Client<::cpp2::MyService>::sync_hasDataById(::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; return sync_hasDataById(rpcOptions, p_id); } bool apache::thrift::Client<::cpp2::MyService>::sync_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = hasDataByIdCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_hasDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { return recv_hasDataById(returnState); }); } folly::Try> apache::thrift::Client<::cpp2::MyService>::sync_complete_hasDataById( apache::thrift::RpcOptions&& rpcOptions, ::std::int64_t p_id) { apache::thrift::ClientReceiveState returnState; auto ctxAndHeader = hasDataByIdCtx(&rpcOptions); apache::thrift::ClientSyncCallback callback(&returnState); const auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* const evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_hasDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, true); }); returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); folly::Try> tryResponse; if (auto* header = returnState.header()) { rpcOptions.setRoutingData(header->releaseRoutingData()); } if (!returnState.hasResponseBuffer()) { assert(returnState.isException()); tryResponse.emplaceException(std::move(returnState.exception())); } else { tryResponse.emplace(); tryResponse->responseContext.rpcTransportStats = returnState.getRpcTransportStats(); if (auto* header = returnState.header()) { if (!header->getHeaders().empty()) { tryResponse->responseContext.headers = header->releaseHeaders(); } if (auto load = header->getServerLoad()) { tryResponse->responseContext.serverLoad = *load; } } tryResponse->response.emplace(); auto ew = folly::fibers::runInMainContext([&] { return recv_wrapped_hasDataById(tryResponse->response.value(), returnState); }); if (ew) { tryResponse->response.emplaceException(std::move(ew)); } } return tryResponse; } folly::Future apache::thrift::Client<::cpp2::MyService>::future_hasDataById(::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; return future_hasDataById(rpcOptions, p_id); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_hasDataById(::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_hasDataById(rpcOptions, p_id); } folly::Future apache::thrift::Client<::cpp2::MyService>::future_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_hasDataById, channel_); hasDataById(rpcOptions, std::move(callback), p_id); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_hasDataById, channel_); auto callback = std::move(callbackAndFuture.first); hasDataById(rpcOptions, std::move(callback), p_id); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::cpp2::MyService>::header_future_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_hasDataById, channel_); hasDataById(rpcOptions, std::move(callback), p_id); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::cpp2::MyService>::header_semifuture_hasDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_hasDataById, channel_); auto callback = std::move(callbackAndFuture.first); hasDataById(rpcOptions, std::move(callback), p_id); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::cpp2::MyService>::hasDataById(folly::Function callback, ::std::int64_t p_id) { hasDataById(std::make_unique(std::move(callback)), p_id); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_hasDataById(bool& _return, ::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::cpp2::MyService_hasDataById_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } bool apache::thrift::Client<::cpp2::MyService>::recv_hasDataById(::apache::thrift::ClientReceiveState& state) { bool _return; auto ew = recv_wrapped_hasDataById(_return, state); if (ew) { ew.throw_exception(); } return _return; } bool apache::thrift::Client<::cpp2::MyService>::recv_instance_hasDataById(::apache::thrift::ClientReceiveState& state) { return recv_hasDataById(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_instance_wrapped_hasDataById(bool& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_hasDataById(_return, state); } void apache::thrift::Client<::cpp2::MyService>::getDataById(std::unique_ptr callback, ::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; getDataById(rpcOptions, std::move(callback), p_id); } void apache::thrift::Client<::cpp2::MyService>::getDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id) { auto [ctx, header] = getDataByIdCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_getDataById(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id); } void apache::thrift::Client<::cpp2::MyService>::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) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_getDataById(&writer, rpcOptions, *header, contextStack, p_id); if (stealRpcOptions) { fbthrift_send_getDataById(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_getDataById(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::getDataByIdCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "MyService.getDataById", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::sync_getDataById(::std::string& _return, ::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; sync_getDataById(rpcOptions, _return, p_id); } void apache::thrift::Client<::cpp2::MyService>::sync_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::string& _return, ::std::int64_t p_id) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = getDataByIdCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_getDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { recv_getDataById(_return, returnState); }); } folly::Try> apache::thrift::Client<::cpp2::MyService>::sync_complete_getDataById( apache::thrift::RpcOptions&& rpcOptions, ::std::int64_t p_id) { apache::thrift::ClientReceiveState returnState; auto ctxAndHeader = getDataByIdCtx(&rpcOptions); apache::thrift::ClientSyncCallback callback(&returnState); const auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* const evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_getDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, true); }); returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); folly::Try> tryResponse; if (auto* header = returnState.header()) { rpcOptions.setRoutingData(header->releaseRoutingData()); } if (!returnState.hasResponseBuffer()) { assert(returnState.isException()); tryResponse.emplaceException(std::move(returnState.exception())); } else { tryResponse.emplace(); tryResponse->responseContext.rpcTransportStats = returnState.getRpcTransportStats(); if (auto* header = returnState.header()) { if (!header->getHeaders().empty()) { tryResponse->responseContext.headers = header->releaseHeaders(); } if (auto load = header->getServerLoad()) { tryResponse->responseContext.serverLoad = *load; } } tryResponse->response.emplace(); auto ew = folly::fibers::runInMainContext([&] { return recv_wrapped_getDataById(tryResponse->response.value(), returnState); }); if (ew) { tryResponse->response.emplaceException(std::move(ew)); } } return tryResponse; } folly::Future<::std::string> apache::thrift::Client<::cpp2::MyService>::future_getDataById(::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; return future_getDataById(rpcOptions, p_id); } folly::SemiFuture<::std::string> apache::thrift::Client<::cpp2::MyService>::semifuture_getDataById(::std::int64_t p_id) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_getDataById(rpcOptions, p_id); } folly::Future<::std::string> apache::thrift::Client<::cpp2::MyService>::future_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper<::std::string>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_getDataById, channel_); getDataById(rpcOptions, std::move(callback), p_id); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture<::std::string> apache::thrift::Client<::cpp2::MyService>::semifuture_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_getDataById, channel_); auto callback = std::move(callbackAndFuture.first); getDataById(rpcOptions, std::move(callback), p_id); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::cpp2::MyService>::header_future_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_getDataById, channel_); getDataById(rpcOptions, std::move(callback), p_id); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::cpp2::MyService>::header_semifuture_getDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_getDataById, channel_); auto callback = std::move(callbackAndFuture.first); getDataById(rpcOptions, std::move(callback), p_id); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::cpp2::MyService>::getDataById(folly::Function callback, ::std::int64_t p_id) { getDataById(std::make_unique(std::move(callback)), p_id); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::cpp2::MyService_getDataById_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } void apache::thrift::Client<::cpp2::MyService>::recv_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_getDataById(_return, state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::cpp2::MyService>::recv_instance_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state) { return recv_getDataById(_return, state); } folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_instance_wrapped_getDataById(::std::string& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_getDataById(_return, state); } void apache::thrift::Client<::cpp2::MyService>::putDataById(std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; putDataById(rpcOptions, std::move(callback), p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::putDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data) { auto [ctx, header] = putDataByIdCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_putDataById(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::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) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_putDataById(&writer, rpcOptions, *header, contextStack, p_id, p_data); if (stealRpcOptions) { fbthrift_send_putDataById(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_putDataById(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::putDataByIdCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "MyService.putDataById", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::sync_putDataById(::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; sync_putDataById(rpcOptions, p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::sync_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = putDataByIdCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_putDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, p_data); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); SCOPE_EXIT { if (returnState.header() && !returnState.header()->getHeaders().empty()) { rpcOptions.setReadHeaders(returnState.header()->releaseHeaders()); } }; return folly::fibers::runInMainContext([&] { recv_putDataById(returnState); }); } folly::Try> apache::thrift::Client<::cpp2::MyService>::sync_complete_putDataById( apache::thrift::RpcOptions&& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { apache::thrift::ClientReceiveState returnState; auto ctxAndHeader = putDataByIdCtx(&rpcOptions); apache::thrift::ClientSyncCallback callback(&returnState); const auto protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* const evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_putDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, p_data, true); }); returnState.resetProtocolId(protocolId); returnState.resetCtx(std::move(ctxAndHeader.first)); folly::Try> tryResponse; if (auto* header = returnState.header()) { rpcOptions.setRoutingData(header->releaseRoutingData()); } if (!returnState.hasResponseBuffer()) { assert(returnState.isException()); tryResponse.emplaceException(std::move(returnState.exception())); } else { tryResponse.emplace(); tryResponse->responseContext.rpcTransportStats = returnState.getRpcTransportStats(); if (auto* header = returnState.header()) { if (!header->getHeaders().empty()) { tryResponse->responseContext.headers = header->releaseHeaders(); } if (auto load = header->getServerLoad()) { tryResponse->responseContext.serverLoad = *load; } } tryResponse->response.emplace(); auto ew = folly::fibers::runInMainContext([&] { return recv_wrapped_putDataById(returnState); }); if (ew) { tryResponse->response.emplaceException(std::move(ew)); } } return tryResponse; } folly::Future apache::thrift::Client<::cpp2::MyService>::future_putDataById(::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; return future_putDataById(rpcOptions, p_id, p_data); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_putDataById(::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_putDataById(rpcOptions, p_id, p_data); } folly::Future apache::thrift::Client<::cpp2::MyService>::future_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_putDataById, channel_); putDataById(rpcOptions, std::move(callback), p_id, p_data); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_putDataById, channel_); auto callback = std::move(callbackAndFuture.first); putDataById(rpcOptions, std::move(callback), p_id, p_data); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::cpp2::MyService>::header_future_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_putDataById, channel_); putDataById(rpcOptions, std::move(callback), p_id, p_data); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::cpp2::MyService>::header_semifuture_putDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_putDataById, channel_); auto callback = std::move(callbackAndFuture.first); putDataById(rpcOptions, std::move(callback), p_id, p_data); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::cpp2::MyService>::putDataById(folly::Function callback, ::std::int64_t p_id, const ::std::string& p_data) { putDataById(std::make_unique(std::move(callback)), p_id, p_data); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_putDataById(::apache::thrift::ClientReceiveState& state) { if (state.isException()) { return std::move(state.exception()); } if (!state.hasResponseBuffer()) { return folly::make_exception_wrapper("recv_ called without result"); } using result = ::cpp2::MyService_putDataById_presult; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } void apache::thrift::Client<::cpp2::MyService>::recv_putDataById(::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_putDataById(state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::cpp2::MyService>::recv_instance_putDataById(::apache::thrift::ClientReceiveState& state) { recv_putDataById(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_instance_wrapped_putDataById(::apache::thrift::ClientReceiveState& state) { return recv_wrapped_putDataById(state); } void apache::thrift::Client<::cpp2::MyService>::lobDataById(std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; lobDataById(rpcOptions, std::move(callback), p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::lobDataById(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int64_t p_id, const ::std::string& p_data) { auto [ctx, header] = lobDataByIdCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_lobDataById(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_and_send_lobDataById(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id, const ::std::string& p_data, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_lobDataById(&writer, rpcOptions, *header, contextStack, p_id, p_data); if (stealRpcOptions) { fbthrift_send_lobDataById(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_lobDataById(std::move(request), rpcOptions, std::move(header), std::move(callback)); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::lobDataByIdCtx(apache::thrift::RpcOptions* rpcOptions) { auto header = std::make_shared( apache::thrift::transport::THeader::ALLOW_BIG_FRAMES); header->setProtocolId(channel_->getProtocolId()); if (rpcOptions) { header->setHeaders(rpcOptions->releaseWriteHeaders()); } auto ctx = apache::thrift::ContextStack::createWithClientContext( handlers_, interceptors_, getServiceName(), "MyService.lobDataById", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::sync_lobDataById(::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; sync_lobDataById(rpcOptions, p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::sync_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = lobDataByIdCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); #if FOLLY_HAS_COROUTINES const bool shouldProcessClientInterceptors = ctxAndHeader.first && ctxAndHeader.first->shouldProcessClientInterceptors(); if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnRequest()); } #endif callback.waitUntilDone( evb, [&] { fbthrift_serialize_and_send_lobDataById(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, p_data); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } } folly::Future apache::thrift::Client<::cpp2::MyService>::future_lobDataById(::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; return future_lobDataById(rpcOptions, p_id, p_data); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_lobDataById(::std::int64_t p_id, const ::std::string& p_data) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_lobDataById(rpcOptions, p_id, p_data); } folly::Future apache::thrift::Client<::cpp2::MyService>::future_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique(std::move(promise), channel_); lobDataById(rpcOptions, std::move(callback), p_id, p_data); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_lobDataById(apache::thrift::RpcOptions& rpcOptions, ::std::int64_t p_id, const ::std::string& p_data) { auto callbackAndFuture = makeOneWaySemiFutureCallback(channel_); auto callback = std::move(callbackAndFuture.first); lobDataById(rpcOptions, std::move(callback), p_id, p_data); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::cpp2::MyService>::lobDataById(folly::Function callback, ::std::int64_t p_id, const ::std::string& p_data) { lobDataById(std::make_unique(std::move(callback)), p_id, p_data); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES