/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/stream/src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #include "thrift/compiler/test/fixtures/stream/gen-cpp2/PubSubStreamingServiceAsyncClient.h" #include namespace cpp2 { typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::integral, ::std::int32_t*>> PubSubStreamingService_returnstream_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult> > PubSubStreamingService_returnstream_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_streamthrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_streamthrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_servicethrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult> > PubSubStreamingService_servicethrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_servicethrows2_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::cpp2::FooEx2>>, apache::thrift::ThriftPresult> > PubSubStreamingService_servicethrows2_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_boththrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_boththrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_responseandstreamstreamthrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult>, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_responseandstreamstreamthrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_responseandstreamservicethrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooEx>>, apache::thrift::ThriftPresult> > PubSubStreamingService_responseandstreamservicethrows_presult; typedef apache::thrift::ThriftPresult> PubSubStreamingService_responseandstreamboththrows_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooEx>>, apache::thrift::ThriftPresult, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::FooStreamEx>> > PubSubStreamingService_responseandstreamboththrows_presult; typedef apache::thrift::ThriftPresult, apache::thrift::FieldData<2, ::apache::thrift::type_class::integral, ::std::int32_t*>> PubSubStreamingService_returnstreamFast_pargs; typedef apache::thrift::ThriftPResultStream< apache::thrift::ThriftPresult, apache::thrift::ThriftPresult> > PubSubStreamingService_returnstreamFast_presult; } // namespace cpp2 template apache::thrift::SerializedRequest apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_returnstream(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::cpp2::PubSubStreamingService_returnstream_pargs args; args.get<0>().value = &p_i32_from; args.get<1>().value = &p_i32_to; 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, "returnstream", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_returnstream(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "returnstream", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_streamthrows(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_streamthrows_pargs args; args.get<0>().value = &p_foo; 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, "streamthrows", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_streamthrows(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "streamthrows", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_servicethrows(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_servicethrows_pargs args; args.get<0>().value = &p_foo; 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, "servicethrows", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_servicethrows(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "servicethrows", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_servicethrows2(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_servicethrows2_pargs args; args.get<0>().value = &p_foo; 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, "servicethrows2", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_servicethrows2(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "servicethrows2", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_boththrows(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_boththrows_pargs args; args.get<0>().value = &p_foo; 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, "boththrows", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_boththrows(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "boththrows", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_responseandstreamstreamthrows(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_responseandstreamstreamthrows_pargs args; args.get<0>().value = &p_foo; 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, "responseandstreamstreamthrows", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_responseandstreamstreamthrows(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "responseandstreamstreamthrows", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_responseandstreamservicethrows(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_responseandstreamservicethrows_pargs args; args.get<0>().value = &p_foo; 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, "responseandstreamservicethrows", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_responseandstreamservicethrows(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "responseandstreamservicethrows", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_responseandstreamboththrows(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_foo) { ::cpp2::PubSubStreamingService_responseandstreamboththrows_pargs args; args.get<0>().value = &p_foo; 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, "responseandstreamboththrows", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_responseandstreamboththrows(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "responseandstreamboththrows", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); 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::PubSubStreamingService>::fbthrift_serialize_returnstreamFast(Protocol_* prot, const RpcOptions& rpcOptions, apache::thrift::transport::THeader& header, apache::thrift::ContextStack* contextStack, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::cpp2::PubSubStreamingService_returnstreamFast_pargs args; args.get<0>().value = &p_i32_from; args.get<1>().value = &p_i32_to; 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, "returnstreamFast", writer, sizer, channel_->getChecksumSamplingRate()); } template void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_send_returnstreamFast(apache::thrift::SerializedRequest&& request, RpcOptions&& rpcOptions, std::shared_ptr header, apache::thrift::StreamClientCallback* callback) { static ::apache::thrift::MethodMetadata::Data* methodMetadata = new ::apache::thrift::MethodMetadata::Data( "returnstreamFast", ::apache::thrift::FunctionQualifier::Unspecified, "PubSubStreamingService"); apache::thrift::clientSendT(std::move(request), std::forward(rpcOptions), std::move(callback), std::move(header), channel_.get(), ::apache::thrift::MethodMetadata::from_static(methodMetadata)); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::returnstream(std::unique_ptr callback, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::apache::thrift::RpcOptions rpcOptions; returnstream(rpcOptions, std::move(callback), p_i32_from, p_i32_to); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::returnstream(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { auto [ctx, header] = returnstreamCtx(&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_returnstream(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_i32_from, p_i32_to); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_returnstream(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_returnstream(&writer, rpcOptions, *header, contextStack, p_i32_from, p_i32_to); if (stealRpcOptions) { fbthrift_send_returnstream(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_returnstream(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::PubSubStreamingService>::returnstreamCtx(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(), "PubSubStreamingService.returnstream", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_returnstream(::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::apache::thrift::RpcOptions rpcOptions; return sync_returnstream(rpcOptions, p_i32_from, p_i32_to); } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_returnstream(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { 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 = returnstreamCtx(&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_returnstream(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_i32_from, p_i32_to); }); #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_returnstream(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_returnstream(::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_returnstream(rpcOptions, p_i32_from, p_i32_to); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_returnstream(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_returnstream, channel_); auto callback = std::move(callbackAndFuture.first); returnstream(rpcOptions, std::move(callback), p_i32_from, p_i32_to); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_returnstream(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_returnstream, channel_); auto callback = std::move(callbackAndFuture.first); returnstream(rpcOptions, std::move(callback), p_i32_from, p_i32_to); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_returnstream(apache::thrift::ClientBufferedStream<::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::PubSubStreamingService_returnstream_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<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_returnstream(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream<::std::int32_t> _return; auto ew = recv_wrapped_returnstream(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_returnstream(::apache::thrift::ClientReceiveState& state) { return recv_returnstream(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_returnstream(apache::thrift::ClientBufferedStream<::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_returnstream(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::streamthrows(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; streamthrows(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::streamthrows(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = streamthrowsCtx(&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_streamthrows(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_streamthrows(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_streamthrows(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_streamthrows(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_streamthrows(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::PubSubStreamingService>::streamthrowsCtx(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(), "PubSubStreamingService.streamthrows", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_streamthrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_streamthrows(rpcOptions, p_foo); } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_streamthrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = streamthrowsCtx(&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_streamthrows(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_streamthrows(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_streamthrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_streamthrows(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_streamthrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_streamthrows, channel_); auto callback = std::move(callbackAndFuture.first); streamthrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_streamthrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_streamthrows, channel_); auto callback = std::move(callbackAndFuture.first); streamthrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_streamthrows(apache::thrift::ClientBufferedStream<::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::PubSubStreamingService_streamthrows_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<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_streamthrows(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream<::std::int32_t> _return; auto ew = recv_wrapped_streamthrows(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_streamthrows(::apache::thrift::ClientReceiveState& state) { return recv_streamthrows(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_streamthrows(apache::thrift::ClientBufferedStream<::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_streamthrows(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::servicethrows(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; servicethrows(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::servicethrows(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = servicethrowsCtx(&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_servicethrows(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_servicethrows(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_servicethrows(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_servicethrows(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_servicethrows(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::PubSubStreamingService>::servicethrowsCtx(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(), "PubSubStreamingService.servicethrows", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_servicethrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_servicethrows(rpcOptions, p_foo); } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_servicethrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = servicethrowsCtx(&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_servicethrows(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_servicethrows(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_servicethrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_servicethrows(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_servicethrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_servicethrows, channel_); auto callback = std::move(callbackAndFuture.first); servicethrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_servicethrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_servicethrows, channel_); auto callback = std::move(callbackAndFuture.first); servicethrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_servicethrows(apache::thrift::ClientBufferedStream<::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::PubSubStreamingService_servicethrows_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<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_servicethrows(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream<::std::int32_t> _return; auto ew = recv_wrapped_servicethrows(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_servicethrows(::apache::thrift::ClientReceiveState& state) { return recv_servicethrows(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_servicethrows(apache::thrift::ClientBufferedStream<::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_servicethrows(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::servicethrows2(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; servicethrows2(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::servicethrows2(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = servicethrows2Ctx(&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_servicethrows2(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_servicethrows2(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_servicethrows2(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_servicethrows2(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_servicethrows2(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::PubSubStreamingService>::servicethrows2Ctx(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(), "PubSubStreamingService.servicethrows2", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_servicethrows2(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_servicethrows2(rpcOptions, p_foo); } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_servicethrows2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = servicethrows2Ctx(&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_servicethrows2(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_servicethrows2(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_servicethrows2(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_servicethrows2(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_servicethrows2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_servicethrows2, channel_); auto callback = std::move(callbackAndFuture.first); servicethrows2(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_servicethrows2(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_servicethrows2, channel_); auto callback = std::move(callbackAndFuture.first); servicethrows2(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_servicethrows2(apache::thrift::ClientBufferedStream<::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::PubSubStreamingService_servicethrows2_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<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_servicethrows2(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream<::std::int32_t> _return; auto ew = recv_wrapped_servicethrows2(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_servicethrows2(::apache::thrift::ClientReceiveState& state) { return recv_servicethrows2(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_servicethrows2(apache::thrift::ClientBufferedStream<::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_servicethrows2(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::boththrows(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; boththrows(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::boththrows(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = boththrowsCtx(&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_boththrows(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_boththrows(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_boththrows(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_boththrows(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_boththrows(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::PubSubStreamingService>::boththrowsCtx(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(), "PubSubStreamingService.boththrows", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_boththrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_boththrows(rpcOptions, p_foo); } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_boththrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = boththrowsCtx(&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_boththrows(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_boththrows(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_boththrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_boththrows(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_boththrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_boththrows, channel_); auto callback = std::move(callbackAndFuture.first); boththrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_boththrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_boththrows, channel_); auto callback = std::move(callbackAndFuture.first); boththrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_boththrows(apache::thrift::ClientBufferedStream<::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::PubSubStreamingService_boththrows_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<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_boththrows(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream<::std::int32_t> _return; auto ew = recv_wrapped_boththrows(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_boththrows(::apache::thrift::ClientReceiveState& state) { return recv_boththrows(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_boththrows(apache::thrift::ClientBufferedStream<::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_boththrows(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::responseandstreamstreamthrows(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; responseandstreamstreamthrows(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::responseandstreamstreamthrows(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = responseandstreamstreamthrowsCtx(&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_responseandstreamstreamthrows(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_responseandstreamstreamthrows(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_responseandstreamstreamthrows(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_responseandstreamstreamthrows(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_responseandstreamstreamthrows(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::PubSubStreamingService>::responseandstreamstreamthrowsCtx(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(), "PubSubStreamingService.responseandstreamstreamthrows", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_responseandstreamstreamthrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_responseandstreamstreamthrows(rpcOptions, p_foo); } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_responseandstreamstreamthrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = responseandstreamstreamthrowsCtx(&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_responseandstreamstreamthrows(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_responseandstreamstreamthrows(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_responseandstreamstreamthrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_responseandstreamstreamthrows(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_responseandstreamstreamthrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_responseandstreamstreamthrows, channel_); auto callback = std::move(callbackAndFuture.first); responseandstreamstreamthrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_responseandstreamstreamthrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_responseandstreamstreamthrows, channel_); auto callback = std::move(callbackAndFuture.first); responseandstreamstreamthrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_responseandstreamstreamthrows(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::PubSubStreamingService_responseandstreamstreamthrows_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::PubSubStreamingService>::recv_responseandstreamstreamthrows(::apache::thrift::ClientReceiveState& state) { apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> _return; auto ew = recv_wrapped_responseandstreamstreamthrows(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_responseandstreamstreamthrows(::apache::thrift::ClientReceiveState& state) { return recv_responseandstreamstreamthrows(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_responseandstreamstreamthrows(apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_responseandstreamstreamthrows(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::responseandstreamservicethrows(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; responseandstreamservicethrows(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::responseandstreamservicethrows(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = responseandstreamservicethrowsCtx(&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_responseandstreamservicethrows(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_responseandstreamservicethrows(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_responseandstreamservicethrows(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_responseandstreamservicethrows(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_responseandstreamservicethrows(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::PubSubStreamingService>::responseandstreamservicethrowsCtx(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(), "PubSubStreamingService.responseandstreamservicethrows", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_responseandstreamservicethrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_responseandstreamservicethrows(rpcOptions, p_foo); } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_responseandstreamservicethrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = responseandstreamservicethrowsCtx(&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_responseandstreamservicethrows(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_responseandstreamservicethrows(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_responseandstreamservicethrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_responseandstreamservicethrows(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_responseandstreamservicethrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_responseandstreamservicethrows, channel_); auto callback = std::move(callbackAndFuture.first); responseandstreamservicethrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_responseandstreamservicethrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_responseandstreamservicethrows, channel_); auto callback = std::move(callbackAndFuture.first); responseandstreamservicethrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_responseandstreamservicethrows(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::PubSubStreamingService_responseandstreamservicethrows_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::PubSubStreamingService>::recv_responseandstreamservicethrows(::apache::thrift::ClientReceiveState& state) { apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> _return; auto ew = recv_wrapped_responseandstreamservicethrows(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_responseandstreamservicethrows(::apache::thrift::ClientReceiveState& state) { return recv_responseandstreamservicethrows(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_responseandstreamservicethrows(apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_responseandstreamservicethrows(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::responseandstreamboththrows(std::unique_ptr callback, ::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; responseandstreamboththrows(rpcOptions, std::move(callback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::responseandstreamboththrows(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_foo) { auto [ctx, header] = responseandstreamboththrowsCtx(&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_responseandstreamboththrows(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_foo); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_responseandstreamboththrows(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_foo, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_responseandstreamboththrows(&writer, rpcOptions, *header, contextStack, p_foo); if (stealRpcOptions) { fbthrift_send_responseandstreamboththrows(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_responseandstreamboththrows(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::PubSubStreamingService>::responseandstreamboththrowsCtx(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(), "PubSubStreamingService.responseandstreamboththrows", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_responseandstreamboththrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return sync_responseandstreamboththrows(rpcOptions, p_foo); } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_responseandstreamboththrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { 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 = responseandstreamboththrowsCtx(&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_responseandstreamboththrows(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_foo); }); #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_responseandstreamboththrows(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_responseandstreamboththrows(::std::int32_t p_foo) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_responseandstreamboththrows(rpcOptions, p_foo); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_responseandstreamboththrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_responseandstreamboththrows, channel_); auto callback = std::move(callbackAndFuture.first); responseandstreamboththrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_responseandstreamboththrows(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_foo) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_responseandstreamboththrows, channel_); auto callback = std::move(callbackAndFuture.first); responseandstreamboththrows(rpcOptions, std::move(callback), p_foo); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_responseandstreamboththrows(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::PubSubStreamingService_responseandstreamboththrows_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::PubSubStreamingService>::recv_responseandstreamboththrows(::apache::thrift::ClientReceiveState& state) { apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> _return; auto ew = recv_wrapped_responseandstreamboththrows(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_responseandstreamboththrows(::apache::thrift::ClientReceiveState& state) { return recv_responseandstreamboththrows(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_responseandstreamboththrows(apache::thrift::ResponseAndClientBufferedStream<::std::int32_t,::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_responseandstreamboththrows(_return, state); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::returnstreamFast(std::unique_ptr callback, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::apache::thrift::RpcOptions rpcOptions; returnstreamFast(rpcOptions, std::move(callback), p_i32_from, p_i32_to); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::returnstreamFast(apache::thrift::RpcOptions& rpcOptions, std::unique_ptr callback, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { auto [ctx, header] = returnstreamFastCtx(&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_returnstreamFast(rpcOptions, std::move(header), contextStack, std::move(streamCallback), p_i32_from, p_i32_to); } void apache::thrift::Client<::cpp2::PubSubStreamingService>::fbthrift_serialize_and_send_returnstreamFast(apache::thrift::RpcOptions& rpcOptions, std::shared_ptr header, apache::thrift::ContextStack* contextStack, apache::thrift::StreamClientCallback* callback, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to, bool stealRpcOptions) { apache::thrift::detail::ac::withProtocolWriter(apache::thrift::GeneratedAsyncClient::getChannel()->getProtocolId(), [&](auto&& writer) { apache::thrift::SerializedRequest request = fbthrift_serialize_returnstreamFast(&writer, rpcOptions, *header, contextStack, p_i32_from, p_i32_to); if (stealRpcOptions) { fbthrift_send_returnstreamFast(std::move(request), std::move(rpcOptions), std::move(header), std::move(callback)); } else { fbthrift_send_returnstreamFast(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::PubSubStreamingService>::returnstreamFastCtx(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(), "PubSubStreamingService.returnstreamFast", *header); return {std::move(ctx), std::move(header)}; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_returnstreamFast(::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::apache::thrift::RpcOptions rpcOptions; return sync_returnstreamFast(rpcOptions, p_i32_from, p_i32_to); } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::sync_returnstreamFast(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { 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 = returnstreamFastCtx(&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_returnstreamFast(rpcOptions, std::move(ctxAndHeader.second), ctxAndHeader.first.get(), std::move(wrappedCallback), p_i32_from, p_i32_to); }); #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_returnstreamFast(returnState); }); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_returnstreamFast(::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { ::apache::thrift::RpcOptions rpcOptions; return semifuture_returnstreamFast(rpcOptions, p_i32_from, p_i32_to); } folly::SemiFuture> apache::thrift::Client<::cpp2::PubSubStreamingService>::semifuture_returnstreamFast(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { auto callbackAndFuture = makeSemiFutureCallback(recv_wrapped_returnstreamFast, channel_); auto callback = std::move(callbackAndFuture.first); returnstreamFast(rpcOptions, std::move(callback), p_i32_from, p_i32_to); return std::move(callbackAndFuture.second); } folly::SemiFuture, std::unique_ptr>> apache::thrift::Client<::cpp2::PubSubStreamingService>::header_semifuture_returnstreamFast(apache::thrift::RpcOptions& rpcOptions, ::std::int32_t p_i32_from, ::std::int32_t p_i32_to) { auto callbackAndFuture = makeHeaderSemiFutureCallback(recv_wrapped_returnstreamFast, channel_); auto callback = std::move(callbackAndFuture.first); returnstreamFast(rpcOptions, std::move(callback), p_i32_from, p_i32_to); return std::move(callbackAndFuture.second); } #if FOLLY_HAS_COROUTINES #endif // FOLLY_HAS_COROUTINES folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_wrapped_returnstreamFast(apache::thrift::ClientBufferedStream<::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::PubSubStreamingService_returnstreamFast_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<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_returnstreamFast(::apache::thrift::ClientReceiveState& state) { apache::thrift::ClientBufferedStream<::std::int32_t> _return; auto ew = recv_wrapped_returnstreamFast(_return, state); if (ew) { ew.throw_exception(); } return _return; } apache::thrift::ClientBufferedStream<::std::int32_t> apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_returnstreamFast(::apache::thrift::ClientReceiveState& state) { return recv_returnstreamFast(state); } folly::exception_wrapper apache::thrift::Client<::cpp2::PubSubStreamingService>::recv_instance_wrapped_returnstreamFast(apache::thrift::ClientBufferedStream<::std::int32_t>& _return, ::apache::thrift::ClientReceiveState& state) { return recv_wrapped_returnstreamFast(_return, state); }