/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/interactions/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include "thrift/compiler/test/fixtures/interactions/gen-cpp2/MyServiceAsyncClient.h" #include namespace cpp2 { typedef apache::thrift::ThriftPresult MyService_foo_pargs; typedef apache::thrift::ThriftPresult MyService_foo_presult; typedef apache::thrift::ThriftPresult> MyService_interact_pargs; typedef apache::thrift::ThriftPresult MyService_interact_presult; typedef apache::thrift::ThriftPresult MyService_interactFast_pargs; typedef apache::thrift::ThriftPresult> MyService_interactFast_presult; typedef apache::thrift::ThriftPresult MyService_serialize_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult> > MyService_serialize_presult; } // namespace cpp2 template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_foo(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_foo_pargs args; 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, "foo", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_foo(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( "foo", ::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_interact(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_arg) { ::cpp2::MyService_interact_pargs args; args.get<0>().value = &p_arg; 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, "interact", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_interact(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback, const apache::thrift::InteractionHandle& handle) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(handle, rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "interact", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Factory, "MyInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), 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_interactFast(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_interactFast_pargs args; 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, "interactFast", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_interactFast(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback, const apache::thrift::InteractionHandle& handle) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(handle, rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "interactFast", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Factory, "MyInteractionFast"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), 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_serialize(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_serialize_pargs args; 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, "serialize", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::fbthrift_send_serialize(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback, const apache::thrift::InteractionHandle& handle) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(handle, rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "serialize", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Factory, "SerialInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } apache::thrift::Client<::cpp2::MyService>::MyInteraction apache::thrift::Client<::cpp2::MyService>::createMyInteraction() { return MyInteraction(channel_, "MyInteraction"); } apache::thrift::Client<::cpp2::MyService>::MyInteractionFast apache::thrift::Client<::cpp2::MyService>::createMyInteractionFast() { return MyInteractionFast(channel_, "MyInteractionFast"); } apache::thrift::Client<::cpp2::MyService>::SerialInteraction apache::thrift::Client<::cpp2::MyService>::createSerialInteraction() { return SerialInteraction(channel_, "SerialInteraction"); } void apache::thrift::Client<::cpp2::MyService>::foo(std::unique_ptr callback) { ::apache::thrift::RpcOptions rpcOptions; foo(rpcOptions, std::move(callback)); } void apache::thrift::Client<::cpp2::MyService>::foo(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = fooCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_foo(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_and_send_foo(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_foo(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_foo(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_foo(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>::fooCtx(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.foo", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::sync_foo() { ::apache::thrift::RpcOptions rpcOptions; sync_foo(rpcOptions); } void apache::thrift::Client<::cpp2::MyService>::sync_foo(apache::thrift::RpcOptions& rpcOptions) { 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 = fooCtx(&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_foo(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #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_foo(returnState); }); } folly::Future apache::thrift::Client<::cpp2::MyService>::future_foo() { ::apache::thrift::RpcOptions rpcOptions; return future_foo(rpcOptions); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_foo() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_foo(rpcOptions); } folly::Future apache::thrift::Client<::cpp2::MyService>::future_foo(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_foo, channel_); foo(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::semifuture_foo(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_foo, channel_); auto callback = std::move(callbackAndFuture.first); foo(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } folly::Future>> apache::thrift::Client<::cpp2::MyService>::header_future_foo(apache::thrift::RpcOptions& rpcOptions) { using CallbackHelper = apache::thrift::detail::FutureCallbackHelper>>; folly::Promise promise; auto future = promise.getFuture(); auto callback = std::make_unique>(std::move(promise), recv_wrapped_foo, channel_); foo(rpcOptions, std::move(callback)); return std::move(future).thenValue(CallbackHelper::extractResult); } folly::SemiFuture>> apache::thrift::Client<::cpp2::MyService>::header_semifuture_foo(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_foo, channel_); auto callback = std::move(callbackAndFuture.first); foo(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } void apache::thrift::Client<::cpp2::MyService>::foo(folly::Function callback) { foo(std::make_unique(std::move(callback))); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_foo(::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_foo_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_foo(::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_foo(state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::cpp2::MyService>::recv_instance_foo(::apache::thrift::ClientReceiveState& state) { recv_foo(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_instance_wrapped_foo(::apache::thrift::ClientReceiveState& state) { return recv_wrapped_foo(state); } void apache::thrift::Client<::cpp2::MyService>::interact(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, const apache::thrift::InteractionHandle& handle, ::std::int32_t p_arg) { auto [ctx, header] = interactCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_interact(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), handle, p_arg); } void apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_and_send_interact(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, const apache::thrift::InteractionHandle& handle, ::std::int32_t p_arg, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_interact(&writer, rpcOptions, *header, contextStack, p_arg); if (stealRpcOptions) { fbthrift_send_interact(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback), handle); } else { fbthrift_send_interact(std::move(request), rpcOptions, std::move(header), std::move(callback), handle); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::interactCtx(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.interact", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::Client<::cpp2::MyService>::MyInteraction apache::thrift::Client<::cpp2::MyService>::sync_interact(::std::int32_t p_arg) { ::apache::thrift::RpcOptions rpcOptions; return sync_interact(rpcOptions, p_arg); } apache::thrift::Client<::cpp2::MyService>::MyInteraction apache::thrift::Client<::cpp2::MyService>::sync_interact(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_arg) { 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 = interactCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); MyInteraction handle(channel_, "MyInteraction"); #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_interact(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), handle, p_arg); }); #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_interact(returnState); return std::move(handle); }); } folly::SemiFuture::MyInteraction> apache::thrift::Client<::cpp2::MyService>::semifuture_interact(::std::int32_t p_arg) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_interact(rpcOptions, p_arg); } folly::SemiFuture::MyInteraction> apache::thrift::Client<::cpp2::MyService>::semifuture_interact(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_arg) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_interact, channel_); MyInteraction handle(channel_, "MyInteraction"); auto callback = std::move(callbackAndFuture.first); interact(rpcOptions, std::move(callback), handle, p_arg); return std::move(callbackAndFuture.second).deferValue([handle = std::move(handle)](auto&&) mutable { return std::move(handle); }); } std::pair< apache::thrift::Client<::cpp2::MyService>::MyInteraction, folly::SemiFuture > apache::thrift::Client<::cpp2::MyService>::eager_semifuture_interact(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_arg) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_interact, channel_); MyInteraction handle(channel_, "MyInteraction"); auto callback = std::move(callbackAndFuture.first); interact(rpcOptions, std::move(callback), handle, p_arg); return std::make_pair(std::move(handle), std::move(callbackAndFuture.second)); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_interact(::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_interact_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_interact(::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_interact(state); if (ew) { ew.throw_exception(); } } void apache::thrift::Client<::cpp2::MyService>::interactFast(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, const apache::thrift::InteractionHandle& handle) { auto [ctx, header] = interactFastCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_interactFast(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback), handle); } void apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_and_send_interactFast(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, const apache::thrift::InteractionHandle& handle, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_interactFast(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_interactFast(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback), handle); } else { fbthrift_send_interactFast(std::move(request), rpcOptions, std::move(header), std::move(callback), handle); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::interactFastCtx(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.interactFast", *header); return {std::move(ctx), std::move(header)}; } std::pair::MyInteractionFast, ::std::int32_t> apache::thrift::Client<::cpp2::MyService>::sync_interactFast() { ::apache::thrift::RpcOptions rpcOptions; return sync_interactFast(rpcOptions); } std::pair::MyInteractionFast, ::std::int32_t> apache::thrift::Client<::cpp2::MyService>::sync_interactFast(apache::thrift::RpcOptions& rpcOptions) { 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 = interactFastCtx(&rpcOptions); auto wrappedCallback = apache::thrift::RequestClientCallback::Ptr(&callback); MyInteractionFast handle(channel_, "MyInteractionFast"); #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_interactFast(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), handle); }); #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 std::make_pair( std::move(handle), recv_interactFast(returnState) ); }); } folly::SemiFuture::MyInteractionFast, ::std::int32_t>> apache::thrift::Client<::cpp2::MyService>::semifuture_interactFast() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_interactFast(rpcOptions); } folly::SemiFuture::MyInteractionFast, ::std::int32_t>> apache::thrift::Client<::cpp2::MyService>::semifuture_interactFast(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_interactFast, channel_); MyInteractionFast handle(channel_, "MyInteractionFast"); auto callback = std::move(callbackAndFuture.first); interactFast(rpcOptions, std::move(callback), handle); return std::move(callbackAndFuture.second).deferValue([handle = std::move(handle)](auto&& val) mutable { return std::make_pair(std::move(handle), std::move(val)); }); } std::pair< apache::thrift::Client<::cpp2::MyService>::MyInteractionFast, folly::SemiFuture<::std::int32_t> > apache::thrift::Client<::cpp2::MyService>::eager_semifuture_interactFast(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_interactFast, channel_); MyInteractionFast handle(channel_, "MyInteractionFast"); auto callback = std::move(callbackAndFuture.first); interactFast(rpcOptions, std::move(callback), handle); return std::make_pair(std::move(handle), std::move(callbackAndFuture.second)); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_interactFast(::std::int32_t& _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_interactFast_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"); } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::recv_interactFast(::apache::thrift::ClientReceiveState& state) { ::std::int32_t _return; auto ew = recv_wrapped_interactFast(_return, state); if (ew) { ew.throw_exception(); } return _return; } void apache::thrift::Client<::cpp2::MyService>::serialize(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, const apache::thrift::InteractionHandle& handle) { auto [ctx, header] = serializeCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); auto streamCallback = apache::thrift::createStreamClientCallback(std::move(wrappedCallback), rpcOptions.getBufferOptions()); fbthrift_serialize_and_send_serialize(rpcOptions, std::move(header), contextStack, std::move(streamCallback), handle); } void apache::thrift::Client<::cpp2::MyService>::fbthrift_serialize_and_send_serialize(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, const apache::thrift::InteractionHandle& handle, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_serialize(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_serialize(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback), handle); } else { fbthrift_send_serialize(std::move(request), rpcOptions, std::move(header), std::move(callback), handle); } }); } std::pair<::apache::thrift::ContextStack::UniquePtr, std::shared_ptr<::apache::thrift::transport::THeader>> apache::thrift::Client<::cpp2::MyService>::serializeCtx(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.serialize", *header); return {std::move(ctx), std::move(header)}; } std::pair::SerialInteraction, apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>> apache::thrift::Client<::cpp2::MyService>::sync_serialize() { ::apache::thrift::RpcOptions rpcOptions; return sync_serialize(rpcOptions); } std::pair::SerialInteraction, apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>> apache::thrift::Client<::cpp2::MyService>::sync_serialize(apache::thrift::RpcOptions& rpcOptions) { 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 = serializeCtx(&rpcOptions); auto wrappedCallback = apache::thrift::createStreamClientCallback( apache::thrift::RequestClientCallback::Ptr(&callback), rpcOptions.getBufferOptions()); SerialInteraction handle(channel_, "SerialInteraction"); #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_serialize(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), handle); }); #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 std::make_pair( std::move(handle), recv_serialize(returnState) ); }); } folly::SemiFuture::SerialInteraction, apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>>> apache::thrift::Client<::cpp2::MyService>::semifuture_serialize() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_serialize(rpcOptions); } folly::SemiFuture::SerialInteraction, apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>>> apache::thrift::Client<::cpp2::MyService>::semifuture_serialize(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_serialize, channel_); SerialInteraction handle(channel_, "SerialInteraction"); auto callback = std::move(callbackAndFuture.first); serialize(rpcOptions, std::move(callback), handle); return std::move(callbackAndFuture.second).deferValue([handle = std::move(handle)](auto&& val) mutable { return std::make_pair(std::move(handle), std::move(val)); }); } std::pair< apache::thrift::Client<::cpp2::MyService>::SerialInteraction, folly::SemiFuture> > apache::thrift::Client<::cpp2::MyService>::eager_semifuture_serialize(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_serialize, channel_); SerialInteraction handle(channel_, "SerialInteraction"); auto callback = std::move(callbackAndFuture.first); serialize(rpcOptions, std::move(callback), handle); return std::make_pair(std::move(handle), std::move(callbackAndFuture.second)); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::recv_wrapped_serialize(apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>& _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_serialize_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"); } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::MyService>::recv_serialize(::apache::thrift::ClientReceiveState& state) { apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> _return; auto ew = recv_wrapped_serialize(_return, state); if (ew) { ew.throw_exception(); } return _return; } namespace cpp2 { typedef apache::thrift::ThriftPresult MyService_MyInteraction_frobnicate_pargs; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::CustomException>> MyService_MyInteraction_frobnicate_presult; typedef apache::thrift::ThriftPresult MyService_MyInteraction_ping_pargs; typedef apache::thrift::ThriftPresult MyService_MyInteraction_truthify_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult> > MyService_MyInteraction_truthify_presult; typedef apache::thrift::ThriftPresult MyService_MyInteraction_encode_pargs; typedef apache::thrift::ThriftPResultSink< apache::thrift::ThriftPresult, ::std::set<::std::int32_t>*>>, apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult> > MyService_MyInteraction_encode_presult; } // namespace cpp2 template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_frobnicate(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteraction_frobnicate_pargs args; 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, "MyInteraction.frobnicate", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_send_frobnicate(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteraction.frobnicate", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_ping(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteraction_ping_pargs args; 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, "MyInteraction.ping", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_send_ping(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteraction.ping", ::apache::thrift::FunctionQualifier::OneWay, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_truthify(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteraction_truthify_pargs args; 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, "MyInteraction.truthify", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_send_truthify(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteraction.truthify", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_encode(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteraction_encode_pargs args; 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, "MyInteraction.encode", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_send_encode(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::SinkClientCallback* callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteraction.encode", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::frobnicate(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = frobnicateCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_frobnicate(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_and_send_frobnicate(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_frobnicate(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_frobnicate(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_frobnicate(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>::MyInteraction::frobnicateCtx(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.MyInteraction.frobnicate", *header); return {std::move(ctx), std::move(header)}; } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::MyInteraction::sync_frobnicate() { ::apache::thrift::RpcOptions rpcOptions; return sync_frobnicate(rpcOptions); } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::MyInteraction::sync_frobnicate(apache::thrift::RpcOptions& rpcOptions) { 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 = frobnicateCtx(&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_frobnicate(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #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_frobnicate(returnState); }); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::cpp2::MyService>::MyInteraction::semifuture_frobnicate() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_frobnicate(rpcOptions); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::cpp2::MyService>::MyInteraction::semifuture_frobnicate(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_frobnicate, channel_); auto callback = std::move(callbackAndFuture.first); frobnicate(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::MyInteraction::recv_wrapped_frobnicate(::std::int32_t& _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_MyInteraction_frobnicate_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"); } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::MyInteraction::recv_frobnicate(::apache::thrift::ClientReceiveState& state) { ::std::int32_t _return; auto ew = recv_wrapped_frobnicate(_return, state); if (ew) { ew.throw_exception(); } return _return; } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::ping(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = pingCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_ping(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_and_send_ping(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_ping(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_ping(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_ping(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>::MyInteraction::pingCtx(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.MyInteraction.ping", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::sync_ping() { ::apache::thrift::RpcOptions rpcOptions; sync_ping(rpcOptions); } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::sync_ping(apache::thrift::RpcOptions& rpcOptions) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = pingCtx(&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_ping(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::MyInteraction::semifuture_ping() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_ping(rpcOptions); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::MyInteraction::semifuture_ping(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeOneWaySemiFutureCallback(channel_); auto callback = std::move(callbackAndFuture.first); ping(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES void apache::thrift::Client<::cpp2::MyService>::MyInteraction::truthify(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = truthifyCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); auto streamCallback = apache::thrift::createStreamClientCallback(std::move(wrappedCallback), rpcOptions.getBufferOptions()); fbthrift_serialize_and_send_truthify(rpcOptions, std::move(header), contextStack, std::move(streamCallback)); } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_and_send_truthify(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_truthify(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_truthify(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_truthify(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>::MyInteraction::truthifyCtx(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.MyInteraction.truthify", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream apache::thrift::Client<::cpp2::MyService>::MyInteraction::sync_truthify() { ::apache::thrift::RpcOptions rpcOptions; return sync_truthify(rpcOptions); } apache::thrift::ClientBufferedStream apache::thrift::Client<::cpp2::MyService>::MyInteraction::sync_truthify(apache::thrift::RpcOptions& rpcOptions) { 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 = truthifyCtx(&rpcOptions); auto wrappedCallback = apache::thrift::createStreamClientCallback( apache::thrift::RequestClientCallback::Ptr(&callback), rpcOptions.getBufferOptions()); #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_truthify(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #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_truthify(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::MyService>::MyInteraction::semifuture_truthify() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_truthify(rpcOptions); } folly::SemiFuture> apache::thrift::Client<::cpp2::MyService>::MyInteraction::semifuture_truthify(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_truthify, channel_); auto callback = std::move(callbackAndFuture.first); truthify(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::MyInteraction::recv_wrapped_truthify(apache::thrift::ClientBufferedStream& _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_MyInteraction_truthify_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"); } apache::thrift::ClientBufferedStream apache::thrift::Client<::cpp2::MyService>::MyInteraction::recv_truthify(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream _return; auto ew = recv_wrapped_truthify(_return, state); if (ew) { ew.throw_exception(); } return _return; } void apache::thrift::Client<::cpp2::MyService>::MyInteraction::fbthrift_serialize_and_send_encode(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::SinkClientCallback* callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_encode(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_encode(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_encode(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>::MyInteraction::encodeCtx(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.MyInteraction.encode", *header); return {std::move(ctx), std::move(header)}; } #if FOLLY_HAS_COROUTINES folly::coro::Task, ::std::string, ::std::string>> apache::thrift::Client<::cpp2::MyService>::MyInteraction::co_encode() { ::apache::thrift::RpcOptions rpcOptions; co_return co_await co_encode(rpcOptions); } folly::coro::Task, ::std::string, ::std::string>> apache::thrift::Client<::cpp2::MyService>::MyInteraction::co_encode(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] = encodeCtx(&rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; auto wrappedCallback = apache::thrift::createSinkClientCallback( apache::thrift::RequestClientCallback::Ptr(apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback))); fbthrift_serialize_and_send_encode(rpcOptions, std::move(header), ctx.get(), 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)); co_return recv_encode(returnState); } #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::MyInteraction::recv_wrapped_encode(apache::thrift::ResponseAndClientSink<::std::set<::std::int32_t>, ::std::string, ::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_MyInteraction_encode_presult; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, state.extractSink(), _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, state.extractSink(), _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } apache::thrift::ResponseAndClientSink<::std::set<::std::int32_t>, ::std::string, ::std::string> apache::thrift::Client<::cpp2::MyService>::MyInteraction::recv_encode(::apache::thrift::ClientReceiveState& state) { apache::thrift::ResponseAndClientSink<::std::set<::std::int32_t>, ::std::string, ::std::string> _return; auto ew = recv_wrapped_encode(_return, state); if (ew) { ew.throw_exception(); } return _return; } namespace cpp2 { typedef apache::thrift::ThriftPresult MyService_MyInteractionFast_frobnicate_pargs; typedef apache::thrift::ThriftPresult> MyService_MyInteractionFast_frobnicate_presult; typedef apache::thrift::ThriftPresult MyService_MyInteractionFast_ping_pargs; typedef apache::thrift::ThriftPresult MyService_MyInteractionFast_truthify_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult> > MyService_MyInteractionFast_truthify_presult; typedef apache::thrift::ThriftPresult MyService_MyInteractionFast_encode_pargs; typedef apache::thrift::ThriftPResultSink< apache::thrift::ThriftPresult, ::std::set<::std::int32_t>*>>, apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult> > MyService_MyInteractionFast_encode_presult; } // namespace cpp2 template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_frobnicate(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteractionFast_frobnicate_pargs args; 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, "MyInteractionFast.frobnicate", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_send_frobnicate(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteractionFast.frobnicate", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteractionFast"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_ping(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteractionFast_ping_pargs args; 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, "MyInteractionFast.ping", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_send_ping(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteractionFast.ping", ::apache::thrift::FunctionQualifier::OneWay, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteractionFast"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_truthify(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteractionFast_truthify_pargs args; 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, "MyInteractionFast.truthify", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_send_truthify(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteractionFast.truthify", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteractionFast"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_encode(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_MyInteractionFast_encode_pargs args; 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, "MyInteractionFast.encode", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_send_encode(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::SinkClientCallback* callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "MyInteractionFast.encode", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "MyInteractionFast"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::frobnicate(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = frobnicateCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_frobnicate(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_and_send_frobnicate(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_frobnicate(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_frobnicate(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_frobnicate(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>::MyInteractionFast::frobnicateCtx(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.MyInteractionFast.frobnicate", *header); return {std::move(ctx), std::move(header)}; } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::sync_frobnicate() { ::apache::thrift::RpcOptions rpcOptions; return sync_frobnicate(rpcOptions); } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::sync_frobnicate(apache::thrift::RpcOptions& rpcOptions) { 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 = frobnicateCtx(&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_frobnicate(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #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_frobnicate(returnState); }); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::semifuture_frobnicate() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_frobnicate(rpcOptions); } folly::SemiFuture<::std::int32_t> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::semifuture_frobnicate(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_frobnicate, channel_); auto callback = std::move(callbackAndFuture.first); frobnicate(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::recv_wrapped_frobnicate(::std::int32_t& _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_MyInteractionFast_frobnicate_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"); } ::std::int32_t apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::recv_frobnicate(::apache::thrift::ClientReceiveState& state) { ::std::int32_t _return; auto ew = recv_wrapped_frobnicate(_return, state); if (ew) { ew.throw_exception(); } return _return; } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::ping(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = pingCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_ping(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_and_send_ping(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_ping(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_ping(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_ping(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>::MyInteractionFast::pingCtx(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.MyInteractionFast.ping", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::sync_ping() { ::apache::thrift::RpcOptions rpcOptions; sync_ping(rpcOptions); } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::sync_ping(apache::thrift::RpcOptions& rpcOptions) { apache::thrift::ClientReceiveState returnState; apache::thrift::ClientSyncCallback callback(&returnState); auto evb = apache::thrift::GeneratedAsyncClient::getChannel()->getEventBase(); auto ctxAndHeader = pingCtx(&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_ping(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #if FOLLY_HAS_COROUTINES if (shouldProcessClientInterceptors) { folly::coro::blockingWait(ctxAndHeader.first->processClientInterceptorsOnResponse()); } #endif if (returnState.isException()) { returnState.exception().throw_exception(); } } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::semifuture_ping() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_ping(rpcOptions); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::semifuture_ping(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeOneWaySemiFutureCallback(channel_); auto callback = std::move(callbackAndFuture.first); ping(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::truthify(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = truthifyCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); auto streamCallback = apache::thrift::createStreamClientCallback(std::move(wrappedCallback), rpcOptions.getBufferOptions()); fbthrift_serialize_and_send_truthify(rpcOptions, std::move(header), contextStack, std::move(streamCallback)); } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_and_send_truthify(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_truthify(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_truthify(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_truthify(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>::MyInteractionFast::truthifyCtx(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.MyInteractionFast.truthify", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::sync_truthify() { ::apache::thrift::RpcOptions rpcOptions; return sync_truthify(rpcOptions); } apache::thrift::ClientBufferedStream apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::sync_truthify(apache::thrift::RpcOptions& rpcOptions) { 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 = truthifyCtx(&rpcOptions); auto wrappedCallback = apache::thrift::createStreamClientCallback( apache::thrift::RequestClientCallback::Ptr(&callback), rpcOptions.getBufferOptions()); #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_truthify(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #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_truthify(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::semifuture_truthify() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_truthify(rpcOptions); } folly::SemiFuture> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::semifuture_truthify(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_truthify, channel_); auto callback = std::move(callbackAndFuture.first); truthify(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::recv_wrapped_truthify(apache::thrift::ClientBufferedStream& _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_MyInteractionFast_truthify_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"); } apache::thrift::ClientBufferedStream apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::recv_truthify(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream _return; auto ew = recv_wrapped_truthify(_return, state); if (ew) { ew.throw_exception(); } return _return; } void apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::fbthrift_serialize_and_send_encode(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::SinkClientCallback* callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_encode(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_encode(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_encode(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>::MyInteractionFast::encodeCtx(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.MyInteractionFast.encode", *header); return {std::move(ctx), std::move(header)}; } #if FOLLY_HAS_COROUTINES folly::coro::Task, ::std::string, ::std::string>> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::co_encode() { ::apache::thrift::RpcOptions rpcOptions; co_return co_await co_encode(rpcOptions); } folly::coro::Task, ::std::string, ::std::string>> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::co_encode(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] = encodeCtx(&rpcOptions); using CancellableCallback = apache::thrift::CancellableRequestClientCallback; auto cancellableCallback = cancellable ? CancellableCallback::create(&callback, channel_) : nullptr; auto wrappedCallback = apache::thrift::createSinkClientCallback( apache::thrift::RequestClientCallback::Ptr(apache::thrift::RequestClientCallback::Ptr(cancellableCallback ? (apache::thrift::RequestClientCallback*)cancellableCallback.get() : &callback))); fbthrift_serialize_and_send_encode(rpcOptions, std::move(header), ctx.get(), 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)); co_return recv_encode(returnState); } #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::recv_wrapped_encode(apache::thrift::ResponseAndClientSink<::std::set<::std::int32_t>, ::std::string, ::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_MyInteractionFast_encode_presult; using ExMapType = apache::thrift::detail::ap::EmptyExMapType; switch (state.protocolId()) { case apache::thrift::protocol::T_BINARY_PROTOCOL: { apache::thrift::BinaryProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, state.extractSink(), _return); } case apache::thrift::protocol::T_COMPACT_PROTOCOL: { apache::thrift::CompactProtocolReader reader; return apache::thrift::detail::ac::recv_wrapped( &reader, state, state.extractSink(), _return); } default: { } } return folly::make_exception_wrapper("Could not find Protocol"); } apache::thrift::ResponseAndClientSink<::std::set<::std::int32_t>, ::std::string, ::std::string> apache::thrift::Client<::cpp2::MyService>::MyInteractionFast::recv_encode(::apache::thrift::ClientReceiveState& state) { apache::thrift::ResponseAndClientSink<::std::set<::std::int32_t>, ::std::string, ::std::string> _return; auto ew = recv_wrapped_encode(_return, state); if (ew) { ew.throw_exception(); } return _return; } namespace cpp2 { typedef apache::thrift::ThriftPresult MyService_SerialInteraction_frobnicate_pargs; typedef apache::thrift::ThriftPresult MyService_SerialInteraction_frobnicate_presult; } // namespace cpp2 template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::MyService>::SerialInteraction::fbthrift_serialize_frobnicate(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack) { ::cpp2::MyService_SerialInteraction_frobnicate_pargs args; 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, "SerialInteraction.frobnicate", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::MyService>::SerialInteraction::fbthrift_send_frobnicate(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::RequestClientCallback::Ptr callback) { apache::thrift::RpcOptions rpcOpts(std::forward(rpcOptions)); setInteraction(rpcOpts); static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "SerialInteraction.frobnicate", ::apache::thrift::FunctionQualifier::Unspecified, "MyService", ::apache::thrift::InteractionMethodPosition::Member, "SerialInteraction"); apache::thrift::clientSendT(std::move(request), std::move(rpcOpts), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } void apache::thrift::Client<::cpp2::MyService>::SerialInteraction::frobnicate(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback) { auto [ctx, header] = frobnicateCtx(&rpcOptions); auto [wrappedCallback, contextStack] = apache::thrift::GeneratedAsyncClient::template prepareRequestClientCallback(std::move(callback), std::move(ctx)); fbthrift_serialize_and_send_frobnicate(rpcOptions, std::move(header), contextStack, std::move(wrappedCallback)); } void apache::thrift::Client<::cpp2::MyService>::SerialInteraction::fbthrift_serialize_and_send_frobnicate(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::RequestClientCallback::Ptr callback, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_frobnicate(&writer, rpcOptions, *header, contextStack); if (stealRpcOptions) { fbthrift_send_frobnicate(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_frobnicate(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>::SerialInteraction::frobnicateCtx(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.SerialInteraction.frobnicate", *header); return {std::move(ctx), std::move(header)}; } void apache::thrift::Client<::cpp2::MyService>::SerialInteraction::sync_frobnicate() { ::apache::thrift::RpcOptions rpcOptions; sync_frobnicate(rpcOptions); } void apache::thrift::Client<::cpp2::MyService>::SerialInteraction::sync_frobnicate(apache::thrift::RpcOptions& rpcOptions) { 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 = frobnicateCtx(&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_frobnicate(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback)); }); #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_frobnicate(returnState); }); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::SerialInteraction::semifuture_frobnicate() { ::apache::thrift::RpcOptions rpcOptions; return semifuture_frobnicate(rpcOptions); } folly::SemiFuture apache::thrift::Client<::cpp2::MyService>::SerialInteraction::semifuture_frobnicate(apache::thrift::RpcOptions& rpcOptions) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_frobnicate, channel_); auto callback = std::move(callbackAndFuture.first); frobnicate(rpcOptions, std::move(callback)); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::MyService>::SerialInteraction::recv_wrapped_frobnicate(::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_SerialInteraction_frobnicate_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>::SerialInteraction::recv_frobnicate(::apache::thrift::ClientReceiveState& state) { auto ew = recv_wrapped_frobnicate(state); if (ew) { ew.throw_exception(); } }