1 /**
2 * Autogenerated by Thrift for src/module.thrift
3 *
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 * @generated @nocommit
6 */
7 #pragma once
8
9 #include "thrift/compiler/test/fixtures/exceptions/gen-cpp2/Raiser.h"
10
11 #include <thrift/lib/cpp2/gen/service_tcc.h>
12
13 namespace cpp2 {
14 typedef apache::thrift::ThriftPresult<false> Raiser_doBland_pargs;
15 typedef apache::thrift::ThriftPresult<true> Raiser_doBland_presult;
16 typedef apache::thrift::ThriftPresult<false> Raiser_doRaise_pargs;
17 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::Banal>, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::cpp2::Fiery>, apache::thrift::FieldData<3, ::apache::thrift::type_class::structure, ::cpp2::Serious>> Raiser_doRaise_presult;
18 typedef apache::thrift::ThriftPresult<false> Raiser_get200_pargs;
19 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::string, ::std::string*>> Raiser_get200_presult;
20 typedef apache::thrift::ThriftPresult<false> Raiser_get500_pargs;
21 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::string, ::std::string*>, apache::thrift::FieldData<1, ::apache::thrift::type_class::structure, ::cpp2::Fiery>, apache::thrift::FieldData<2, ::apache::thrift::type_class::structure, ::cpp2::Banal>, apache::thrift::FieldData<3, ::apache::thrift::type_class::structure, ::cpp2::Serious>> Raiser_get500_presult;
22 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_doBland(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)23 void RaiserAsyncProcessor::setUpAndProcess_doBland(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
24 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
25 return;
26 }
27 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
28 ctx->setRequestExecutionScope(std::move(scope));
29 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &RaiserAsyncProcessor::process_doBland<ProtocolIn_, ProtocolOut_>, this);
30 }
31
32 template <typename ProtocolIn_, typename ProtocolOut_>
process_doBland(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)33 void RaiserAsyncProcessor::process_doBland(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
34 if (!req->getShouldStartProcessing()) {
35 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
36 return;
37 }
38 // make sure getRequestContext is null
39 // so async calls don't accidentally use it
40 iface_->setRequestContext(nullptr);
41 Raiser_doBland_pargs args;
42 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "Raiser.doBland", ctx));
43 try {
44 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
45 }
46 catch (const std::exception& ex) {
47 folly::exception_wrapper ew(std::current_exception(), ex);
48 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
49 ew, std::move(req), ctx, eb, "doBland");
50 return;
51 }
52 auto callback = std::make_unique<apache::thrift::HandlerCallback<void>>(std::move(req), std::move(ctxStack), return_doBland<ProtocolIn_,ProtocolOut_>, throw_wrapped_doBland<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
53 iface_->async_tm_doBland(std::move(callback));
54 }
55
56 template <class ProtocolIn_, class ProtocolOut_>
return_doBland(apache::thrift::ContextStack * ctx)57 apache::thrift::SerializedResponse RaiserAsyncProcessor::return_doBland(apache::thrift::ContextStack* ctx) {
58 ProtocolOut_ prot;
59 Raiser_doBland_presult result;
60 return serializeResponse(&prot, ctx, result);
61 }
62
63 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_doBland(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)64 void RaiserAsyncProcessor::throw_wrapped_doBland(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
65 if (!ew) {
66 return;
67 }
68 {
69 (void)protoSeqId;
70 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
71 ew, std::move(req), reqCtx, ctx, "doBland");
72 return;
73 }
74 }
75
76 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_doRaise(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)77 void RaiserAsyncProcessor::setUpAndProcess_doRaise(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
78 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
79 return;
80 }
81 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
82 ctx->setRequestExecutionScope(std::move(scope));
83 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &RaiserAsyncProcessor::process_doRaise<ProtocolIn_, ProtocolOut_>, this);
84 }
85
86 template <typename ProtocolIn_, typename ProtocolOut_>
process_doRaise(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)87 void RaiserAsyncProcessor::process_doRaise(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
88 if (!req->getShouldStartProcessing()) {
89 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
90 return;
91 }
92 // make sure getRequestContext is null
93 // so async calls don't accidentally use it
94 iface_->setRequestContext(nullptr);
95 Raiser_doRaise_pargs args;
96 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "Raiser.doRaise", ctx));
97 try {
98 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
99 }
100 catch (const std::exception& ex) {
101 folly::exception_wrapper ew(std::current_exception(), ex);
102 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
103 ew, std::move(req), ctx, eb, "doRaise");
104 return;
105 }
106 auto callback = std::make_unique<apache::thrift::HandlerCallback<void>>(std::move(req), std::move(ctxStack), return_doRaise<ProtocolIn_,ProtocolOut_>, throw_wrapped_doRaise<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
107 iface_->async_tm_doRaise(std::move(callback));
108 }
109
110 template <class ProtocolIn_, class ProtocolOut_>
return_doRaise(apache::thrift::ContextStack * ctx)111 apache::thrift::SerializedResponse RaiserAsyncProcessor::return_doRaise(apache::thrift::ContextStack* ctx) {
112 ProtocolOut_ prot;
113 Raiser_doRaise_presult result;
114 return serializeResponse(&prot, ctx, result);
115 }
116
117 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_doRaise(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)118 void RaiserAsyncProcessor::throw_wrapped_doRaise(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
119 if (!ew) {
120 return;
121 }
122 Raiser_doRaise_presult result;
123 if (ew.with_exception([&]( ::cpp2::Banal& e) {
124 if (ctx) {
125 ctx->userExceptionWrapped(true, ew);
126 }
127 ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx);
128 ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::Banal>(ew, *reqCtx);
129 result.get<0>().ref() = e;
130 result.setIsSet(0, true);
131 }
132 )) {} else
133 if (ew.with_exception([&]( ::cpp2::Fiery& e) {
134 if (ctx) {
135 ctx->userExceptionWrapped(true, ew);
136 }
137 ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx);
138 ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::Fiery>(ew, *reqCtx);
139 result.get<1>().ref() = e;
140 result.setIsSet(1, true);
141 }
142 )) {} else
143 if (ew.with_exception([&]( ::cpp2::Serious& e) {
144 if (ctx) {
145 ctx->userExceptionWrapped(true, ew);
146 }
147 ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx);
148 ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::Serious>(ew, *reqCtx);
149 result.get<2>().ref() = e;
150 result.setIsSet(2, true);
151 }
152 )) {} else
153 {
154 (void)protoSeqId;
155 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
156 ew, std::move(req), reqCtx, ctx, "doRaise");
157 return;
158 }
159 ProtocolOut_ prot;
160 auto response = serializeResponse(&prot, ctx, result);
161 auto payload = std::move(response).extractPayload(
162 req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "doRaise");
163 payload.transform(reqCtx->getHeader()->getWriteTransforms());
164 return req->sendReply(std::move(payload));
165 }
166
167 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_get200(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)168 void RaiserAsyncProcessor::setUpAndProcess_get200(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
169 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
170 return;
171 }
172 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
173 ctx->setRequestExecutionScope(std::move(scope));
174 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &RaiserAsyncProcessor::process_get200<ProtocolIn_, ProtocolOut_>, this);
175 }
176
177 template <typename ProtocolIn_, typename ProtocolOut_>
process_get200(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)178 void RaiserAsyncProcessor::process_get200(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
179 if (!req->getShouldStartProcessing()) {
180 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
181 return;
182 }
183 // make sure getRequestContext is null
184 // so async calls don't accidentally use it
185 iface_->setRequestContext(nullptr);
186 Raiser_get200_pargs args;
187 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "Raiser.get200", ctx));
188 try {
189 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
190 }
191 catch (const std::exception& ex) {
192 folly::exception_wrapper ew(std::current_exception(), ex);
193 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
194 ew, std::move(req), ctx, eb, "get200");
195 return;
196 }
197 auto callback = std::make_unique<apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>(std::move(req), std::move(ctxStack), return_get200<ProtocolIn_,ProtocolOut_>, throw_wrapped_get200<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
198 iface_->async_tm_get200(std::move(callback));
199 }
200
201 template <class ProtocolIn_, class ProtocolOut_>
return_get200(apache::thrift::ContextStack * ctx,::std::string const & _return)202 apache::thrift::SerializedResponse RaiserAsyncProcessor::return_get200(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
203 ProtocolOut_ prot;
204 Raiser_get200_presult result;
205 result.get<0>().value = const_cast<::std::string*>(&_return);
206 result.setIsSet(0, true);
207 return serializeResponse(&prot, ctx, result);
208 }
209
210 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_get200(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)211 void RaiserAsyncProcessor::throw_wrapped_get200(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
212 if (!ew) {
213 return;
214 }
215 {
216 (void)protoSeqId;
217 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
218 ew, std::move(req), reqCtx, ctx, "get200");
219 return;
220 }
221 }
222
223 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_get500(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)224 void RaiserAsyncProcessor::setUpAndProcess_get500(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
225 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
226 return;
227 }
228 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
229 ctx->setRequestExecutionScope(std::move(scope));
230 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &RaiserAsyncProcessor::process_get500<ProtocolIn_, ProtocolOut_>, this);
231 }
232
233 template <typename ProtocolIn_, typename ProtocolOut_>
process_get500(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)234 void RaiserAsyncProcessor::process_get500(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
235 if (!req->getShouldStartProcessing()) {
236 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
237 return;
238 }
239 // make sure getRequestContext is null
240 // so async calls don't accidentally use it
241 iface_->setRequestContext(nullptr);
242 Raiser_get500_pargs args;
243 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "Raiser.get500", ctx));
244 try {
245 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
246 }
247 catch (const std::exception& ex) {
248 folly::exception_wrapper ew(std::current_exception(), ex);
249 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
250 ew, std::move(req), ctx, eb, "get500");
251 return;
252 }
253 auto callback = std::make_unique<apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>(std::move(req), std::move(ctxStack), return_get500<ProtocolIn_,ProtocolOut_>, throw_wrapped_get500<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
254 iface_->async_tm_get500(std::move(callback));
255 }
256
257 template <class ProtocolIn_, class ProtocolOut_>
return_get500(apache::thrift::ContextStack * ctx,::std::string const & _return)258 apache::thrift::SerializedResponse RaiserAsyncProcessor::return_get500(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
259 ProtocolOut_ prot;
260 Raiser_get500_presult result;
261 result.get<0>().value = const_cast<::std::string*>(&_return);
262 result.setIsSet(0, true);
263 return serializeResponse(&prot, ctx, result);
264 }
265
266 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_get500(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)267 void RaiserAsyncProcessor::throw_wrapped_get500(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
268 if (!ew) {
269 return;
270 }
271 Raiser_get500_presult result;
272 if (ew.with_exception([&]( ::cpp2::Fiery& e) {
273 if (ctx) {
274 ctx->userExceptionWrapped(true, ew);
275 }
276 ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx);
277 ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::Fiery>(ew, *reqCtx);
278 result.get<1>().ref() = e;
279 result.setIsSet(1, true);
280 }
281 )) {} else
282 if (ew.with_exception([&]( ::cpp2::Banal& e) {
283 if (ctx) {
284 ctx->userExceptionWrapped(true, ew);
285 }
286 ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx);
287 ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::Banal>(ew, *reqCtx);
288 result.get<2>().ref() = e;
289 result.setIsSet(2, true);
290 }
291 )) {} else
292 if (ew.with_exception([&]( ::cpp2::Serious& e) {
293 if (ctx) {
294 ctx->userExceptionWrapped(true, ew);
295 }
296 ::apache::thrift::util::appendExceptionToHeader(ew, *reqCtx);
297 ::apache::thrift::util::appendErrorClassificationToHeader< ::cpp2::Serious>(ew, *reqCtx);
298 result.get<3>().ref() = e;
299 result.setIsSet(3, true);
300 }
301 )) {} else
302 {
303 (void)protoSeqId;
304 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
305 ew, std::move(req), reqCtx, ctx, "get500");
306 return;
307 }
308 ProtocolOut_ prot;
309 auto response = serializeResponse(&prot, ctx, result);
310 auto payload = std::move(response).extractPayload(
311 req->includeEnvelope(), prot.protocolType(), protoSeqId, apache::thrift::MessageType::T_REPLY, "get500");
312 payload.transform(reqCtx->getHeader()->getWriteTransforms());
313 return req->sendReply(std::move(payload));
314 }
315
316
317 } // cpp2
318