/** * 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 void apache::thrift::Client<::cpp2::MyService>::hasDataByIdT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id) { ::cpp2::MyService_hasDataById_pargs args; args.get<0>().value = &p_id; auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; auto writer = [&](Protocol_* p) { args.write(p); }; static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "hasDataById", ::apache::thrift::FunctionQualifier::Unspecified, "MyService"); apache::thrift::clientSendT(prot, std::forward(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer); } template void apache::thrift::Client<::cpp2::MyService>::getDataByIdT(Protocol_* prot, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, ::std::int64_t p_id) { ::cpp2::MyService_getDataById_pargs args; args.get<0>().value = &p_id; auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; auto writer = [&](Protocol_* p) { args.write(p); }; static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "getDataById", ::apache::thrift::FunctionQualifier::Unspecified, "MyService"); apache::thrift::clientSendT(prot, std::forward(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer); } template void apache::thrift::Client<::cpp2::MyService>::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) { ::cpp2::MyService_putDataById_pargs args; args.get<0>().value = &p_id; args.get<1>().value = const_cast<::std::string*>(&p_data); auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; auto writer = [&](Protocol_* p) { args.write(p); }; static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "putDataById", ::apache::thrift::FunctionQualifier::Unspecified, "MyService"); apache::thrift::clientSendT(prot, std::forward(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer); } template void apache::thrift::Client<::cpp2::MyService>::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) { ::cpp2::MyService_lobDataById_pargs args; args.get<0>().value = &p_id; args.get<1>().value = const_cast<::std::string*>(&p_data); auto sizer = [&](Protocol_* p) { return args.serializedSizeZC(p); }; auto writer = [&](Protocol_* p) { args.write(p); }; static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "lobDataById", ::apache::thrift::FunctionQualifier::OneWay, "MyService"); apache::thrift::clientSendT(prot, std::forward(rpcOptions), std::move(callback), contextStack, std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata), writer, sizer); } 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); apache::thrift::RequestCallback::Context callbackContext; callbackContext.protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* contextStack = ctx.get(); if (callback) { callbackContext.ctx = std::move(ctx); } auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext)); hasDataByIdImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id); } void apache::thrift::Client<::cpp2::MyService>::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) { switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolWriter writer; if (stealRpcOptions) { hasDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id); } else { hasDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id); } break; } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolWriter writer; if (stealRpcOptions) { hasDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id); } else { hasDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id); } break; } default: { apache::thrift::detail::ac::throw_app_exn("Could not find Protocol"); } } } 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_, 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); callback.waitUntilDone( evb, [&] { hasDataByIdImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id); }); 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, [&] { hasDataByIdImpl(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) { 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 future; } 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) { 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 future; } 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); apache::thrift::RequestCallback::Context callbackContext; callbackContext.protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* contextStack = ctx.get(); if (callback) { callbackContext.ctx = std::move(ctx); } auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext)); getDataByIdImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id); } void apache::thrift::Client<::cpp2::MyService>::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) { switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolWriter writer; if (stealRpcOptions) { getDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id); } else { getDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id); } break; } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolWriter writer; if (stealRpcOptions) { getDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id); } else { getDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id); } break; } default: { apache::thrift::detail::ac::throw_app_exn("Could not find Protocol"); } } } 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_, 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); callback.waitUntilDone( evb, [&] { getDataByIdImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id); }); 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, [&] { getDataByIdImpl(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) { folly::Promise<::std::string> 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 future; } 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) { 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 future; } 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); apache::thrift::RequestCallback::Context callbackContext; callbackContext.protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* contextStack = ctx.get(); if (callback) { callbackContext.ctx = std::move(ctx); } auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext)); putDataByIdImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::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) { switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolWriter writer; if (stealRpcOptions) { putDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id, p_data); } else { putDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id, p_data); } break; } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolWriter writer; if (stealRpcOptions) { putDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id, p_data); } else { putDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id, p_data); } break; } default: { apache::thrift::detail::ac::throw_app_exn("Could not find Protocol"); } } } 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_, 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); callback.waitUntilDone( evb, [&] { putDataByIdImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, p_data); }); 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, [&] { putDataByIdImpl(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) { 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 future; } 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) { 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 future; } 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); apache::thrift::RequestCallback::Context callbackContext; callbackContext.oneWay = true; callbackContext.protocolId = apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(); auto* contextStack = ctx.get(); if (callback) { callbackContext.ctx = std::move(ctx); } auto wrappedCallback = apache::thrift::toRequestClientCallbackPtr(std::move(callback), std::move(callbackContext)); lobDataByIdImpl(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), p_id, p_data); } void apache::thrift::Client<::cpp2::MyService>::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) { switch (apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolWriter writer; if (stealRpcOptions) { lobDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id, p_data); } else { lobDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id, p_data); } break; } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolWriter writer; if (stealRpcOptions) { lobDataByIdT(&writer, std::move(rpcOptions), std::move(header), contextStack, std::move(callback), p_id, p_data); } else { lobDataByIdT(&writer, rpcOptions, std::move(header), contextStack, std::move(callback), p_id, p_data); } break; } default: { apache::thrift::detail::ac::throw_app_exn("Could not find Protocol"); } } } 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_, 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); callback.waitUntilDone( evb, [&] { lobDataByIdImpl(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_id, p_data); }); 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) { 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 future; } 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