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/basic-annotations/gen-cpp2/MyService.h"
10
11 #include <thrift/lib/cpp2/gen/service_tcc.h>
12
13 namespace cpp2 {
14 typedef apache::thrift::ThriftPresult<false> MyService_ping_pargs;
15 typedef apache::thrift::ThriftPresult<true> MyService_ping_presult;
16 typedef apache::thrift::ThriftPresult<false> MyService_getRandomData_pargs;
17 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::string, ::std::string*>> MyService_getRandomData_presult;
18 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>> MyService_hasDataById_pargs;
19 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::integral, bool*>> MyService_hasDataById_presult;
20 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>> MyService_getDataById_pargs;
21 typedef apache::thrift::ThriftPresult<true, apache::thrift::FieldData<0, ::apache::thrift::type_class::string, ::std::string*>> MyService_getDataById_presult;
22 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::string, ::std::string*>> MyService_putDataById_pargs;
23 typedef apache::thrift::ThriftPresult<true> MyService_putDataById_presult;
24 typedef apache::thrift::ThriftPresult<false, apache::thrift::FieldData<1, ::apache::thrift::type_class::integral, ::std::int64_t*>, apache::thrift::FieldData<2, ::apache::thrift::type_class::string, ::std::string*>> MyService_lobDataById_pargs;
25 typedef apache::thrift::ThriftPresult<false> MyService_cppDoNothing_pargs;
26 typedef apache::thrift::ThriftPresult<true> MyService_cppDoNothing_presult;
27 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_ping(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)28 void MyServiceAsyncProcessor::setUpAndProcess_ping(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
29 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
30 return;
31 }
32 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
33 ctx->setRequestExecutionScope(std::move(scope));
34 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_ping<ProtocolIn_, ProtocolOut_>, this);
35 }
36
37 template <typename ProtocolIn_, typename ProtocolOut_>
process_ping(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)38 void MyServiceAsyncProcessor::process_ping(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
39 if (!req->getShouldStartProcessing()) {
40 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
41 return;
42 }
43 // make sure getRequestContext is null
44 // so async calls don't accidentally use it
45 iface_->setRequestContext(nullptr);
46 MyService_ping_pargs args;
47 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.ping", ctx));
48 try {
49 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
50 }
51 catch (const std::exception& ex) {
52 folly::exception_wrapper ew(std::current_exception(), ex);
53 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
54 ew, std::move(req), ctx, eb, "ping");
55 return;
56 }
57 auto callback = std::make_unique<apache::thrift::HandlerCallback<void>>(std::move(req), std::move(ctxStack), return_ping<ProtocolIn_,ProtocolOut_>, throw_wrapped_ping<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
58 iface_->async_tm_ping(std::move(callback));
59 }
60
61 template <class ProtocolIn_, class ProtocolOut_>
return_ping(apache::thrift::ContextStack * ctx)62 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_ping(apache::thrift::ContextStack* ctx) {
63 ProtocolOut_ prot;
64 MyService_ping_presult result;
65 return serializeResponse(&prot, ctx, result);
66 }
67
68 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_ping(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)69 void MyServiceAsyncProcessor::throw_wrapped_ping(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
70 if (!ew) {
71 return;
72 }
73 {
74 (void)protoSeqId;
75 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
76 ew, std::move(req), reqCtx, ctx, "ping");
77 return;
78 }
79 }
80
81 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_getRandomData(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)82 void MyServiceAsyncProcessor::setUpAndProcess_getRandomData(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
83 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
84 return;
85 }
86 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
87 ctx->setRequestExecutionScope(std::move(scope));
88 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_getRandomData<ProtocolIn_, ProtocolOut_>, this);
89 }
90
91 template <typename ProtocolIn_, typename ProtocolOut_>
process_getRandomData(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)92 void MyServiceAsyncProcessor::process_getRandomData(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
93 if (!req->getShouldStartProcessing()) {
94 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
95 return;
96 }
97 // make sure getRequestContext is null
98 // so async calls don't accidentally use it
99 iface_->setRequestContext(nullptr);
100 MyService_getRandomData_pargs args;
101 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.getRandomData", ctx));
102 try {
103 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
104 }
105 catch (const std::exception& ex) {
106 folly::exception_wrapper ew(std::current_exception(), ex);
107 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
108 ew, std::move(req), ctx, eb, "getRandomData");
109 return;
110 }
111 auto callback = std::make_unique<apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>(std::move(req), std::move(ctxStack), return_getRandomData<ProtocolIn_,ProtocolOut_>, throw_wrapped_getRandomData<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
112 iface_->async_tm_getRandomData(std::move(callback));
113 }
114
115 template <class ProtocolIn_, class ProtocolOut_>
return_getRandomData(apache::thrift::ContextStack * ctx,::std::string const & _return)116 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_getRandomData(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
117 ProtocolOut_ prot;
118 MyService_getRandomData_presult result;
119 result.get<0>().value = const_cast<::std::string*>(&_return);
120 result.setIsSet(0, true);
121 return serializeResponse(&prot, ctx, result);
122 }
123
124 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_getRandomData(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)125 void MyServiceAsyncProcessor::throw_wrapped_getRandomData(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
126 if (!ew) {
127 return;
128 }
129 {
130 (void)protoSeqId;
131 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
132 ew, std::move(req), reqCtx, ctx, "getRandomData");
133 return;
134 }
135 }
136
137 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)138 void MyServiceAsyncProcessor::setUpAndProcess_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
139 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
140 return;
141 }
142 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
143 ctx->setRequestExecutionScope(std::move(scope));
144 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_hasDataById<ProtocolIn_, ProtocolOut_>, this);
145 }
146
147 template <typename ProtocolIn_, typename ProtocolOut_>
process_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)148 void MyServiceAsyncProcessor::process_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
149 if (!req->getShouldStartProcessing()) {
150 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
151 return;
152 }
153 // make sure getRequestContext is null
154 // so async calls don't accidentally use it
155 iface_->setRequestContext(nullptr);
156 MyService_hasDataById_pargs args;
157 ::std::int64_t uarg_id{0};
158 args.get<0>().value = &uarg_id;
159 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.hasDataById", ctx));
160 try {
161 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
162 }
163 catch (const std::exception& ex) {
164 folly::exception_wrapper ew(std::current_exception(), ex);
165 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
166 ew, std::move(req), ctx, eb, "hasDataById");
167 return;
168 }
169 auto callback = std::make_unique<apache::thrift::HandlerCallback<bool>>(std::move(req), std::move(ctxStack), return_hasDataById<ProtocolIn_,ProtocolOut_>, throw_wrapped_hasDataById<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
170 iface_->async_tm_hasDataById(std::move(callback), args.get<0>().ref());
171 }
172
173 template <class ProtocolIn_, class ProtocolOut_>
return_hasDataById(apache::thrift::ContextStack * ctx,bool const & _return)174 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_hasDataById(apache::thrift::ContextStack* ctx, bool const& _return) {
175 ProtocolOut_ prot;
176 MyService_hasDataById_presult result;
177 result.get<0>().value = const_cast<bool*>(&_return);
178 result.setIsSet(0, true);
179 return serializeResponse(&prot, ctx, result);
180 }
181
182 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)183 void MyServiceAsyncProcessor::throw_wrapped_hasDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
184 if (!ew) {
185 return;
186 }
187 {
188 (void)protoSeqId;
189 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
190 ew, std::move(req), reqCtx, ctx, "hasDataById");
191 return;
192 }
193 }
194
195 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)196 void MyServiceAsyncProcessor::setUpAndProcess_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
197 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
198 return;
199 }
200 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
201 ctx->setRequestExecutionScope(std::move(scope));
202 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_getDataById<ProtocolIn_, ProtocolOut_>, this);
203 }
204
205 template <typename ProtocolIn_, typename ProtocolOut_>
process_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)206 void MyServiceAsyncProcessor::process_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
207 if (!req->getShouldStartProcessing()) {
208 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
209 return;
210 }
211 // make sure getRequestContext is null
212 // so async calls don't accidentally use it
213 iface_->setRequestContext(nullptr);
214 MyService_getDataById_pargs args;
215 ::std::int64_t uarg_id{0};
216 args.get<0>().value = &uarg_id;
217 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.getDataById", ctx));
218 try {
219 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
220 }
221 catch (const std::exception& ex) {
222 folly::exception_wrapper ew(std::current_exception(), ex);
223 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
224 ew, std::move(req), ctx, eb, "getDataById");
225 return;
226 }
227 auto callback = std::make_unique<apache::thrift::HandlerCallback<std::unique_ptr<::std::string>>>(std::move(req), std::move(ctxStack), return_getDataById<ProtocolIn_,ProtocolOut_>, throw_wrapped_getDataById<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
228 iface_->async_tm_getDataById(std::move(callback), args.get<0>().ref());
229 }
230
231 template <class ProtocolIn_, class ProtocolOut_>
return_getDataById(apache::thrift::ContextStack * ctx,::std::string const & _return)232 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_getDataById(apache::thrift::ContextStack* ctx, ::std::string const& _return) {
233 ProtocolOut_ prot;
234 MyService_getDataById_presult result;
235 result.get<0>().value = const_cast<::std::string*>(&_return);
236 result.setIsSet(0, true);
237 return serializeResponse(&prot, ctx, result);
238 }
239
240 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)241 void MyServiceAsyncProcessor::throw_wrapped_getDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
242 if (!ew) {
243 return;
244 }
245 {
246 (void)protoSeqId;
247 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
248 ew, std::move(req), reqCtx, ctx, "getDataById");
249 return;
250 }
251 }
252
253 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)254 void MyServiceAsyncProcessor::setUpAndProcess_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
255 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
256 return;
257 }
258 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
259 ctx->setRequestExecutionScope(std::move(scope));
260 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_putDataById<ProtocolIn_, ProtocolOut_>, this);
261 }
262
263 template <typename ProtocolIn_, typename ProtocolOut_>
process_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)264 void MyServiceAsyncProcessor::process_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
265 if (!req->getShouldStartProcessing()) {
266 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
267 return;
268 }
269 // make sure getRequestContext is null
270 // so async calls don't accidentally use it
271 iface_->setRequestContext(nullptr);
272 MyService_putDataById_pargs args;
273 ::std::int64_t uarg_id{0};
274 args.get<0>().value = &uarg_id;
275 auto uarg_data = std::make_unique<::std::string>();
276 args.get<1>().value = uarg_data.get();
277 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.putDataById", ctx));
278 try {
279 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
280 }
281 catch (const std::exception& ex) {
282 folly::exception_wrapper ew(std::current_exception(), ex);
283 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
284 ew, std::move(req), ctx, eb, "putDataById");
285 return;
286 }
287 auto callback = std::make_unique<apache::thrift::HandlerCallback<void>>(std::move(req), std::move(ctxStack), return_putDataById<ProtocolIn_,ProtocolOut_>, throw_wrapped_putDataById<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
288 iface_->async_tm_putDataById(std::move(callback), args.get<0>().ref(), std::move(uarg_data));
289 }
290
291 template <class ProtocolIn_, class ProtocolOut_>
return_putDataById(apache::thrift::ContextStack * ctx)292 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_putDataById(apache::thrift::ContextStack* ctx) {
293 ProtocolOut_ prot;
294 MyService_putDataById_presult result;
295 return serializeResponse(&prot, ctx, result);
296 }
297
298 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)299 void MyServiceAsyncProcessor::throw_wrapped_putDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
300 if (!ew) {
301 return;
302 }
303 {
304 (void)protoSeqId;
305 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
306 ew, std::move(req), reqCtx, ctx, "putDataById");
307 return;
308 }
309 }
310
311 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)312 void MyServiceAsyncProcessor::setUpAndProcess_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
313 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_NO_RESPONSE, iface_)) {
314 return;
315 }
316 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
317 ctx->setRequestExecutionScope(std::move(scope));
318 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_NO_RESPONSE, &MyServiceAsyncProcessor::process_lobDataById<ProtocolIn_, ProtocolOut_>, this);
319 }
320
321 template <typename ProtocolIn_, typename ProtocolOut_>
process_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)322 void MyServiceAsyncProcessor::process_lobDataById(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
323 // make sure getRequestContext is null
324 // so async calls don't accidentally use it
325 iface_->setRequestContext(nullptr);
326 MyService_lobDataById_pargs args;
327 ::std::int64_t uarg_id{0};
328 args.get<0>().value = &uarg_id;
329 auto uarg_data = std::make_unique<::std::string>();
330 args.get<1>().value = uarg_data.get();
331 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.lobDataById", ctx));
332 try {
333 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
334 }
335 catch (const std::exception& ex) {
336 LOG(ERROR) << ex.what() << " in function lobDataById";
337 eb->runInEventBaseThread([req = std::move(req)] {});
338 return;
339 }
340 auto callback = std::make_unique<apache::thrift::HandlerCallbackBase>(std::move(req), std::move(ctxStack), nullptr, eb, tm, ctx);
341 iface_->async_tm_lobDataById(std::move(callback), args.get<0>().ref(), std::move(uarg_data));
342 }
343
344 template <typename ProtocolIn_, typename ProtocolOut_>
setUpAndProcess_cppDoNothing(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)345 void MyServiceAsyncProcessor::setUpAndProcess_cppDoNothing(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
346 if (!setUpRequestProcessing(req, ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, iface_)) {
347 return;
348 }
349 auto scope = iface_->getRequestExecutionScope(ctx, apache::thrift::concurrency::NORMAL);
350 ctx->setRequestExecutionScope(std::move(scope));
351 processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &MyServiceAsyncProcessor::process_cppDoNothing<ProtocolIn_, ProtocolOut_>, this);
352 }
353
354 template <typename ProtocolIn_, typename ProtocolOut_>
process_cppDoNothing(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::Cpp2RequestContext * ctx,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)355 void MyServiceAsyncProcessor::process_cppDoNothing(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
356 if (!req->getShouldStartProcessing()) {
357 apache::thrift::HandlerCallbackBase::releaseRequest(std::move(req), eb);
358 return;
359 }
360 // make sure getRequestContext is null
361 // so async calls don't accidentally use it
362 iface_->setRequestContext(nullptr);
363 MyService_cppDoNothing_pargs args;
364 std::unique_ptr<apache::thrift::ContextStack> ctxStack(this->getContextStack(this->getServiceName(), "MyService.doNothing", ctx));
365 try {
366 deserializeRequest<ProtocolIn_>(args, ctx->getMethodName(), std::move(serializedRequest).uncompress(), ctxStack.get());
367 }
368 catch (const std::exception& ex) {
369 folly::exception_wrapper ew(std::current_exception(), ex);
370 apache::thrift::detail::ap::process_handle_exn_deserialization<ProtocolOut_>(
371 ew, std::move(req), ctx, eb, "doNothing");
372 return;
373 }
374 auto callback = std::make_unique<apache::thrift::HandlerCallback<void>>(std::move(req), std::move(ctxStack), return_cppDoNothing<ProtocolIn_,ProtocolOut_>, throw_wrapped_cppDoNothing<ProtocolIn_, ProtocolOut_>, ctx->getProtoSeqId(), eb, tm, ctx);
375 iface_->async_tm_cppDoNothing(std::move(callback));
376 }
377
378 template <class ProtocolIn_, class ProtocolOut_>
return_cppDoNothing(apache::thrift::ContextStack * ctx)379 apache::thrift::SerializedResponse MyServiceAsyncProcessor::return_cppDoNothing(apache::thrift::ContextStack* ctx) {
380 ProtocolOut_ prot;
381 MyService_cppDoNothing_presult result;
382 return serializeResponse(&prot, ctx, result);
383 }
384
385 template <class ProtocolIn_, class ProtocolOut_>
throw_wrapped_cppDoNothing(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack * ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext * reqCtx)386 void MyServiceAsyncProcessor::throw_wrapped_cppDoNothing(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx) {
387 if (!ew) {
388 return;
389 }
390 {
391 (void)protoSeqId;
392 apache::thrift::detail::ap::process_throw_wrapped_handler_error<ProtocolOut_>(
393 ew, std::move(req), reqCtx, ctx, "doNothing");
394 return;
395 }
396 }
397
398
399 } // cpp2
400