]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | /** |
2 | * Autogenerated by Thrift Compiler (0.11.0) | |
3 | * | |
4 | * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
5 | * @generated | |
6 | */ | |
7 | #include "AggregationValidator.h" | |
8 | ||
9 | namespace jaegertracing { namespace thrift { | |
10 | ||
11 | ||
12 | AggregationValidator_validateTrace_args::~AggregationValidator_validateTrace_args() throw() { | |
13 | } | |
14 | ||
15 | ||
16 | uint32_t AggregationValidator_validateTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { | |
17 | ||
18 | ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); | |
19 | uint32_t xfer = 0; | |
20 | std::string fname; | |
21 | ::apache::thrift::protocol::TType ftype; | |
22 | int16_t fid; | |
23 | ||
24 | xfer += iprot->readStructBegin(fname); | |
25 | ||
26 | using ::apache::thrift::protocol::TProtocolException; | |
27 | ||
28 | bool isset_traceId = false; | |
29 | ||
30 | while (true) | |
31 | { | |
32 | xfer += iprot->readFieldBegin(fname, ftype, fid); | |
33 | if (ftype == ::apache::thrift::protocol::T_STOP) { | |
34 | break; | |
35 | } | |
36 | switch (fid) | |
37 | { | |
38 | case 1: | |
39 | if (ftype == ::apache::thrift::protocol::T_STRING) { | |
40 | xfer += iprot->readString(this->traceId); | |
41 | isset_traceId = true; | |
42 | } else { | |
43 | xfer += iprot->skip(ftype); | |
44 | } | |
45 | break; | |
46 | default: | |
47 | xfer += iprot->skip(ftype); | |
48 | break; | |
49 | } | |
50 | xfer += iprot->readFieldEnd(); | |
51 | } | |
52 | ||
53 | xfer += iprot->readStructEnd(); | |
54 | ||
55 | if (!isset_traceId) | |
56 | throw TProtocolException(TProtocolException::INVALID_DATA); | |
57 | return xfer; | |
58 | } | |
59 | ||
60 | uint32_t AggregationValidator_validateTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { | |
61 | uint32_t xfer = 0; | |
62 | ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); | |
63 | xfer += oprot->writeStructBegin("AggregationValidator_validateTrace_args"); | |
64 | ||
65 | xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); | |
66 | xfer += oprot->writeString(this->traceId); | |
67 | xfer += oprot->writeFieldEnd(); | |
68 | ||
69 | xfer += oprot->writeFieldStop(); | |
70 | xfer += oprot->writeStructEnd(); | |
71 | return xfer; | |
72 | } | |
73 | ||
74 | ||
75 | AggregationValidator_validateTrace_pargs::~AggregationValidator_validateTrace_pargs() throw() { | |
76 | } | |
77 | ||
78 | ||
79 | uint32_t AggregationValidator_validateTrace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { | |
80 | uint32_t xfer = 0; | |
81 | ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); | |
82 | xfer += oprot->writeStructBegin("AggregationValidator_validateTrace_pargs"); | |
83 | ||
84 | xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); | |
85 | xfer += oprot->writeString((*(this->traceId))); | |
86 | xfer += oprot->writeFieldEnd(); | |
87 | ||
88 | xfer += oprot->writeFieldStop(); | |
89 | xfer += oprot->writeStructEnd(); | |
90 | return xfer; | |
91 | } | |
92 | ||
93 | ||
94 | AggregationValidator_validateTrace_result::~AggregationValidator_validateTrace_result() throw() { | |
95 | } | |
96 | ||
97 | ||
98 | uint32_t AggregationValidator_validateTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { | |
99 | ||
100 | ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); | |
101 | uint32_t xfer = 0; | |
102 | std::string fname; | |
103 | ::apache::thrift::protocol::TType ftype; | |
104 | int16_t fid; | |
105 | ||
106 | xfer += iprot->readStructBegin(fname); | |
107 | ||
108 | using ::apache::thrift::protocol::TProtocolException; | |
109 | ||
110 | ||
111 | while (true) | |
112 | { | |
113 | xfer += iprot->readFieldBegin(fname, ftype, fid); | |
114 | if (ftype == ::apache::thrift::protocol::T_STOP) { | |
115 | break; | |
116 | } | |
117 | switch (fid) | |
118 | { | |
119 | case 0: | |
120 | if (ftype == ::apache::thrift::protocol::T_STRUCT) { | |
121 | xfer += this->success.read(iprot); | |
122 | this->__isset.success = true; | |
123 | } else { | |
124 | xfer += iprot->skip(ftype); | |
125 | } | |
126 | break; | |
127 | default: | |
128 | xfer += iprot->skip(ftype); | |
129 | break; | |
130 | } | |
131 | xfer += iprot->readFieldEnd(); | |
132 | } | |
133 | ||
134 | xfer += iprot->readStructEnd(); | |
135 | ||
136 | return xfer; | |
137 | } | |
138 | ||
139 | uint32_t AggregationValidator_validateTrace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { | |
140 | ||
141 | uint32_t xfer = 0; | |
142 | ||
143 | xfer += oprot->writeStructBegin("AggregationValidator_validateTrace_result"); | |
144 | ||
145 | if (this->__isset.success) { | |
146 | xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); | |
147 | xfer += this->success.write(oprot); | |
148 | xfer += oprot->writeFieldEnd(); | |
149 | } | |
150 | xfer += oprot->writeFieldStop(); | |
151 | xfer += oprot->writeStructEnd(); | |
152 | return xfer; | |
153 | } | |
154 | ||
155 | ||
156 | AggregationValidator_validateTrace_presult::~AggregationValidator_validateTrace_presult() throw() { | |
157 | } | |
158 | ||
159 | ||
160 | uint32_t AggregationValidator_validateTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { | |
161 | ||
162 | ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); | |
163 | uint32_t xfer = 0; | |
164 | std::string fname; | |
165 | ::apache::thrift::protocol::TType ftype; | |
166 | int16_t fid; | |
167 | ||
168 | xfer += iprot->readStructBegin(fname); | |
169 | ||
170 | using ::apache::thrift::protocol::TProtocolException; | |
171 | ||
172 | ||
173 | while (true) | |
174 | { | |
175 | xfer += iprot->readFieldBegin(fname, ftype, fid); | |
176 | if (ftype == ::apache::thrift::protocol::T_STOP) { | |
177 | break; | |
178 | } | |
179 | switch (fid) | |
180 | { | |
181 | case 0: | |
182 | if (ftype == ::apache::thrift::protocol::T_STRUCT) { | |
183 | xfer += (*(this->success)).read(iprot); | |
184 | this->__isset.success = true; | |
185 | } else { | |
186 | xfer += iprot->skip(ftype); | |
187 | } | |
188 | break; | |
189 | default: | |
190 | xfer += iprot->skip(ftype); | |
191 | break; | |
192 | } | |
193 | xfer += iprot->readFieldEnd(); | |
194 | } | |
195 | ||
196 | xfer += iprot->readStructEnd(); | |
197 | ||
198 | return xfer; | |
199 | } | |
200 | ||
201 | void AggregationValidatorClient::validateTrace(ValidateTraceResponse& _return, const std::string& traceId) | |
202 | { | |
203 | send_validateTrace(traceId); | |
204 | recv_validateTrace(_return); | |
205 | } | |
206 | ||
207 | void AggregationValidatorClient::send_validateTrace(const std::string& traceId) | |
208 | { | |
209 | int32_t cseqid = 0; | |
210 | oprot_->writeMessageBegin("validateTrace", ::apache::thrift::protocol::T_CALL, cseqid); | |
211 | ||
212 | AggregationValidator_validateTrace_pargs args; | |
213 | args.traceId = &traceId; | |
214 | args.write(oprot_); | |
215 | ||
216 | oprot_->writeMessageEnd(); | |
217 | oprot_->getTransport()->writeEnd(); | |
218 | oprot_->getTransport()->flush(); | |
219 | } | |
220 | ||
221 | void AggregationValidatorClient::recv_validateTrace(ValidateTraceResponse& _return) | |
222 | { | |
223 | ||
224 | int32_t rseqid = 0; | |
225 | std::string fname; | |
226 | ::apache::thrift::protocol::TMessageType mtype; | |
227 | ||
228 | iprot_->readMessageBegin(fname, mtype, rseqid); | |
229 | if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { | |
230 | ::apache::thrift::TApplicationException x; | |
231 | x.read(iprot_); | |
232 | iprot_->readMessageEnd(); | |
233 | iprot_->getTransport()->readEnd(); | |
234 | throw x; | |
235 | } | |
236 | if (mtype != ::apache::thrift::protocol::T_REPLY) { | |
237 | iprot_->skip(::apache::thrift::protocol::T_STRUCT); | |
238 | iprot_->readMessageEnd(); | |
239 | iprot_->getTransport()->readEnd(); | |
240 | } | |
241 | if (fname.compare("validateTrace") != 0) { | |
242 | iprot_->skip(::apache::thrift::protocol::T_STRUCT); | |
243 | iprot_->readMessageEnd(); | |
244 | iprot_->getTransport()->readEnd(); | |
245 | } | |
246 | AggregationValidator_validateTrace_presult result; | |
247 | result.success = &_return; | |
248 | result.read(iprot_); | |
249 | iprot_->readMessageEnd(); | |
250 | iprot_->getTransport()->readEnd(); | |
251 | ||
252 | if (result.__isset.success) { | |
253 | // _return pointer has now been filled | |
254 | return; | |
255 | } | |
256 | throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "validateTrace failed: unknown result"); | |
257 | } | |
258 | ||
259 | bool AggregationValidatorProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { | |
260 | ProcessMap::iterator pfn; | |
261 | pfn = processMap_.find(fname); | |
262 | if (pfn == processMap_.end()) { | |
263 | iprot->skip(::apache::thrift::protocol::T_STRUCT); | |
264 | iprot->readMessageEnd(); | |
265 | iprot->getTransport()->readEnd(); | |
266 | ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); | |
267 | oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); | |
268 | x.write(oprot); | |
269 | oprot->writeMessageEnd(); | |
270 | oprot->getTransport()->writeEnd(); | |
271 | oprot->getTransport()->flush(); | |
272 | return true; | |
273 | } | |
274 | (this->*(pfn->second))(seqid, iprot, oprot, callContext); | |
275 | return true; | |
276 | } | |
277 | ||
278 | void AggregationValidatorProcessor::process_validateTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) | |
279 | { | |
280 | void* ctx = NULL; | |
281 | if (this->eventHandler_.get() != NULL) { | |
282 | ctx = this->eventHandler_->getContext("AggregationValidator.validateTrace", callContext); | |
283 | } | |
284 | ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "AggregationValidator.validateTrace"); | |
285 | ||
286 | if (this->eventHandler_.get() != NULL) { | |
287 | this->eventHandler_->preRead(ctx, "AggregationValidator.validateTrace"); | |
288 | } | |
289 | ||
290 | AggregationValidator_validateTrace_args args; | |
291 | args.read(iprot); | |
292 | iprot->readMessageEnd(); | |
293 | uint32_t bytes = iprot->getTransport()->readEnd(); | |
294 | ||
295 | if (this->eventHandler_.get() != NULL) { | |
296 | this->eventHandler_->postRead(ctx, "AggregationValidator.validateTrace", bytes); | |
297 | } | |
298 | ||
299 | AggregationValidator_validateTrace_result result; | |
300 | try { | |
301 | iface_->validateTrace(result.success, args.traceId); | |
302 | result.__isset.success = true; | |
303 | } catch (const std::exception& e) { | |
304 | if (this->eventHandler_.get() != NULL) { | |
305 | this->eventHandler_->handlerError(ctx, "AggregationValidator.validateTrace"); | |
306 | } | |
307 | ||
308 | ::apache::thrift::TApplicationException x(e.what()); | |
309 | oprot->writeMessageBegin("validateTrace", ::apache::thrift::protocol::T_EXCEPTION, seqid); | |
310 | x.write(oprot); | |
311 | oprot->writeMessageEnd(); | |
312 | oprot->getTransport()->writeEnd(); | |
313 | oprot->getTransport()->flush(); | |
314 | return; | |
315 | } | |
316 | ||
317 | if (this->eventHandler_.get() != NULL) { | |
318 | this->eventHandler_->preWrite(ctx, "AggregationValidator.validateTrace"); | |
319 | } | |
320 | ||
321 | oprot->writeMessageBegin("validateTrace", ::apache::thrift::protocol::T_REPLY, seqid); | |
322 | result.write(oprot); | |
323 | oprot->writeMessageEnd(); | |
324 | bytes = oprot->getTransport()->writeEnd(); | |
325 | oprot->getTransport()->flush(); | |
326 | ||
327 | if (this->eventHandler_.get() != NULL) { | |
328 | this->eventHandler_->postWrite(ctx, "AggregationValidator.validateTrace", bytes); | |
329 | } | |
330 | } | |
331 | ||
332 | ::std::shared_ptr< ::apache::thrift::TProcessor > AggregationValidatorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { | |
333 | ::apache::thrift::ReleaseHandler< AggregationValidatorIfFactory > cleanup(handlerFactory_); | |
334 | ::std::shared_ptr< AggregationValidatorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); | |
335 | ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new AggregationValidatorProcessor(handler)); | |
336 | return processor; | |
337 | } | |
338 | ||
339 | void AggregationValidatorConcurrentClient::validateTrace(ValidateTraceResponse& _return, const std::string& traceId) | |
340 | { | |
341 | int32_t seqid = send_validateTrace(traceId); | |
342 | recv_validateTrace(_return, seqid); | |
343 | } | |
344 | ||
345 | int32_t AggregationValidatorConcurrentClient::send_validateTrace(const std::string& traceId) | |
346 | { | |
347 | int32_t cseqid = this->sync_.generateSeqId(); | |
348 | ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); | |
349 | oprot_->writeMessageBegin("validateTrace", ::apache::thrift::protocol::T_CALL, cseqid); | |
350 | ||
351 | AggregationValidator_validateTrace_pargs args; | |
352 | args.traceId = &traceId; | |
353 | args.write(oprot_); | |
354 | ||
355 | oprot_->writeMessageEnd(); | |
356 | oprot_->getTransport()->writeEnd(); | |
357 | oprot_->getTransport()->flush(); | |
358 | ||
359 | sentry.commit(); | |
360 | return cseqid; | |
361 | } | |
362 | ||
363 | void AggregationValidatorConcurrentClient::recv_validateTrace(ValidateTraceResponse& _return, const int32_t seqid) | |
364 | { | |
365 | ||
366 | int32_t rseqid = 0; | |
367 | std::string fname; | |
368 | ::apache::thrift::protocol::TMessageType mtype; | |
369 | ||
370 | // the read mutex gets dropped and reacquired as part of waitForWork() | |
371 | // The destructor of this sentry wakes up other clients | |
372 | ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); | |
373 | ||
374 | while(true) { | |
375 | if(!this->sync_.getPending(fname, mtype, rseqid)) { | |
376 | iprot_->readMessageBegin(fname, mtype, rseqid); | |
377 | } | |
378 | if(seqid == rseqid) { | |
379 | if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { | |
380 | ::apache::thrift::TApplicationException x; | |
381 | x.read(iprot_); | |
382 | iprot_->readMessageEnd(); | |
383 | iprot_->getTransport()->readEnd(); | |
384 | sentry.commit(); | |
385 | throw x; | |
386 | } | |
387 | if (mtype != ::apache::thrift::protocol::T_REPLY) { | |
388 | iprot_->skip(::apache::thrift::protocol::T_STRUCT); | |
389 | iprot_->readMessageEnd(); | |
390 | iprot_->getTransport()->readEnd(); | |
391 | } | |
392 | if (fname.compare("validateTrace") != 0) { | |
393 | iprot_->skip(::apache::thrift::protocol::T_STRUCT); | |
394 | iprot_->readMessageEnd(); | |
395 | iprot_->getTransport()->readEnd(); | |
396 | ||
397 | // in a bad state, don't commit | |
398 | using ::apache::thrift::protocol::TProtocolException; | |
399 | throw TProtocolException(TProtocolException::INVALID_DATA); | |
400 | } | |
401 | AggregationValidator_validateTrace_presult result; | |
402 | result.success = &_return; | |
403 | result.read(iprot_); | |
404 | iprot_->readMessageEnd(); | |
405 | iprot_->getTransport()->readEnd(); | |
406 | ||
407 | if (result.__isset.success) { | |
408 | // _return pointer has now been filled | |
409 | sentry.commit(); | |
410 | return; | |
411 | } | |
412 | // in a bad state, don't commit | |
413 | throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "validateTrace failed: unknown result"); | |
414 | } | |
415 | // seqid != rseqid | |
416 | this->sync_.updatePending(fname, mtype, rseqid); | |
417 | ||
418 | // this will temporarily unlock the readMutex, and let other clients get work done | |
419 | this->sync_.waitForWork(seqid); | |
420 | } // end while(true) | |
421 | } | |
422 | ||
423 | }} // namespace | |
424 |