]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / exporters / jaeger / thrift-gen / Collector.cpp
CommitLineData
1e59de90
TL
1/**
2 * Autogenerated by Thrift Compiler (0.14.0)
3 *
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 * @generated
6 */
7#include "Collector.h"
8
9namespace jaegertracing { namespace thrift {
10
11
12Collector_submitBatches_args::~Collector_submitBatches_args() noexcept {
13}
14
15
16uint32_t Collector_submitBatches_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
29 while (true)
30 {
31 xfer += iprot->readFieldBegin(fname, ftype, fid);
32 if (ftype == ::apache::thrift::protocol::T_STOP) {
33 break;
34 }
35 switch (fid)
36 {
37 case 1:
38 if (ftype == ::apache::thrift::protocol::T_LIST) {
39 {
40 this->batches.clear();
41 uint32_t _size52;
42 ::apache::thrift::protocol::TType _etype55;
43 xfer += iprot->readListBegin(_etype55, _size52);
44 this->batches.resize(_size52);
45 uint32_t _i56;
46 for (_i56 = 0; _i56 < _size52; ++_i56)
47 {
48 xfer += this->batches[_i56].read(iprot);
49 }
50 xfer += iprot->readListEnd();
51 }
52 this->__isset.batches = true;
53 } else {
54 xfer += iprot->skip(ftype);
55 }
56 break;
57 default:
58 xfer += iprot->skip(ftype);
59 break;
60 }
61 xfer += iprot->readFieldEnd();
62 }
63
64 xfer += iprot->readStructEnd();
65
66 return xfer;
67}
68
69uint32_t Collector_submitBatches_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
70 uint32_t xfer = 0;
71 ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
72 xfer += oprot->writeStructBegin("Collector_submitBatches_args");
73
74 xfer += oprot->writeFieldBegin("batches", ::apache::thrift::protocol::T_LIST, 1);
75 {
76 xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->batches.size()));
77 std::vector<Batch> ::const_iterator _iter57;
78 for (_iter57 = this->batches.begin(); _iter57 != this->batches.end(); ++_iter57)
79 {
80 xfer += (*_iter57).write(oprot);
81 }
82 xfer += oprot->writeListEnd();
83 }
84 xfer += oprot->writeFieldEnd();
85
86 xfer += oprot->writeFieldStop();
87 xfer += oprot->writeStructEnd();
88 return xfer;
89}
90
91
92Collector_submitBatches_pargs::~Collector_submitBatches_pargs() noexcept {
93}
94
95
96uint32_t Collector_submitBatches_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
97 uint32_t xfer = 0;
98 ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
99 xfer += oprot->writeStructBegin("Collector_submitBatches_pargs");
100
101 xfer += oprot->writeFieldBegin("batches", ::apache::thrift::protocol::T_LIST, 1);
102 {
103 xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->batches)).size()));
104 std::vector<Batch> ::const_iterator _iter58;
105 for (_iter58 = (*(this->batches)).begin(); _iter58 != (*(this->batches)).end(); ++_iter58)
106 {
107 xfer += (*_iter58).write(oprot);
108 }
109 xfer += oprot->writeListEnd();
110 }
111 xfer += oprot->writeFieldEnd();
112
113 xfer += oprot->writeFieldStop();
114 xfer += oprot->writeStructEnd();
115 return xfer;
116}
117
118
119Collector_submitBatches_result::~Collector_submitBatches_result() noexcept {
120}
121
122
123uint32_t Collector_submitBatches_result::read(::apache::thrift::protocol::TProtocol* iprot) {
124
125 ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
126 uint32_t xfer = 0;
127 std::string fname;
128 ::apache::thrift::protocol::TType ftype;
129 int16_t fid;
130
131 xfer += iprot->readStructBegin(fname);
132
133 using ::apache::thrift::protocol::TProtocolException;
134
135
136 while (true)
137 {
138 xfer += iprot->readFieldBegin(fname, ftype, fid);
139 if (ftype == ::apache::thrift::protocol::T_STOP) {
140 break;
141 }
142 switch (fid)
143 {
144 case 0:
145 if (ftype == ::apache::thrift::protocol::T_LIST) {
146 {
147 this->success.clear();
148 uint32_t _size59;
149 ::apache::thrift::protocol::TType _etype62;
150 xfer += iprot->readListBegin(_etype62, _size59);
151 this->success.resize(_size59);
152 uint32_t _i63;
153 for (_i63 = 0; _i63 < _size59; ++_i63)
154 {
155 xfer += this->success[_i63].read(iprot);
156 }
157 xfer += iprot->readListEnd();
158 }
159 this->__isset.success = true;
160 } else {
161 xfer += iprot->skip(ftype);
162 }
163 break;
164 default:
165 xfer += iprot->skip(ftype);
166 break;
167 }
168 xfer += iprot->readFieldEnd();
169 }
170
171 xfer += iprot->readStructEnd();
172
173 return xfer;
174}
175
176uint32_t Collector_submitBatches_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
177
178 uint32_t xfer = 0;
179
180 xfer += oprot->writeStructBegin("Collector_submitBatches_result");
181
182 if (this->__isset.success) {
183 xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0);
184 {
185 xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->success.size()));
186 std::vector<BatchSubmitResponse> ::const_iterator _iter64;
187 for (_iter64 = this->success.begin(); _iter64 != this->success.end(); ++_iter64)
188 {
189 xfer += (*_iter64).write(oprot);
190 }
191 xfer += oprot->writeListEnd();
192 }
193 xfer += oprot->writeFieldEnd();
194 }
195 xfer += oprot->writeFieldStop();
196 xfer += oprot->writeStructEnd();
197 return xfer;
198}
199
200
201Collector_submitBatches_presult::~Collector_submitBatches_presult() noexcept {
202}
203
204
205uint32_t Collector_submitBatches_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
206
207 ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
208 uint32_t xfer = 0;
209 std::string fname;
210 ::apache::thrift::protocol::TType ftype;
211 int16_t fid;
212
213 xfer += iprot->readStructBegin(fname);
214
215 using ::apache::thrift::protocol::TProtocolException;
216
217
218 while (true)
219 {
220 xfer += iprot->readFieldBegin(fname, ftype, fid);
221 if (ftype == ::apache::thrift::protocol::T_STOP) {
222 break;
223 }
224 switch (fid)
225 {
226 case 0:
227 if (ftype == ::apache::thrift::protocol::T_LIST) {
228 {
229 (*(this->success)).clear();
230 uint32_t _size65;
231 ::apache::thrift::protocol::TType _etype68;
232 xfer += iprot->readListBegin(_etype68, _size65);
233 (*(this->success)).resize(_size65);
234 uint32_t _i69;
235 for (_i69 = 0; _i69 < _size65; ++_i69)
236 {
237 xfer += (*(this->success))[_i69].read(iprot);
238 }
239 xfer += iprot->readListEnd();
240 }
241 this->__isset.success = true;
242 } else {
243 xfer += iprot->skip(ftype);
244 }
245 break;
246 default:
247 xfer += iprot->skip(ftype);
248 break;
249 }
250 xfer += iprot->readFieldEnd();
251 }
252
253 xfer += iprot->readStructEnd();
254
255 return xfer;
256}
257
258void CollectorClient::submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches)
259{
260 send_submitBatches(batches);
261 recv_submitBatches(_return);
262}
263
264void CollectorClient::send_submitBatches(const std::vector<Batch> & batches)
265{
266 int32_t cseqid = 0;
267 oprot_->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_CALL, cseqid);
268
269 Collector_submitBatches_pargs args;
270 args.batches = &batches;
271 args.write(oprot_);
272
273 oprot_->writeMessageEnd();
274 oprot_->getTransport()->writeEnd();
275 oprot_->getTransport()->flush();
276}
277
278void CollectorClient::recv_submitBatches(std::vector<BatchSubmitResponse> & _return)
279{
280
281 int32_t rseqid = 0;
282 std::string fname;
283 ::apache::thrift::protocol::TMessageType mtype;
284
285 iprot_->readMessageBegin(fname, mtype, rseqid);
286 if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
287 ::apache::thrift::TApplicationException x;
288 x.read(iprot_);
289 iprot_->readMessageEnd();
290 iprot_->getTransport()->readEnd();
291 throw x;
292 }
293 if (mtype != ::apache::thrift::protocol::T_REPLY) {
294 iprot_->skip(::apache::thrift::protocol::T_STRUCT);
295 iprot_->readMessageEnd();
296 iprot_->getTransport()->readEnd();
297 }
298 if (fname.compare("submitBatches") != 0) {
299 iprot_->skip(::apache::thrift::protocol::T_STRUCT);
300 iprot_->readMessageEnd();
301 iprot_->getTransport()->readEnd();
302 }
303 Collector_submitBatches_presult result;
304 result.success = &_return;
305 result.read(iprot_);
306 iprot_->readMessageEnd();
307 iprot_->getTransport()->readEnd();
308
309 if (result.__isset.success) {
310 // _return pointer has now been filled
311 return;
312 }
313 throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitBatches failed: unknown result");
314}
315
316bool CollectorProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) {
317 ProcessMap::iterator pfn;
318 pfn = processMap_.find(fname);
319 if (pfn == processMap_.end()) {
320 iprot->skip(::apache::thrift::protocol::T_STRUCT);
321 iprot->readMessageEnd();
322 iprot->getTransport()->readEnd();
323 ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'");
324 oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
325 x.write(oprot);
326 oprot->writeMessageEnd();
327 oprot->getTransport()->writeEnd();
328 oprot->getTransport()->flush();
329 return true;
330 }
331 (this->*(pfn->second))(seqid, iprot, oprot, callContext);
332 return true;
333}
334
335void CollectorProcessor::process_submitBatches(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
336{
337 void* ctx = nullptr;
338 if (this->eventHandler_.get() != nullptr) {
339 ctx = this->eventHandler_->getContext("Collector.submitBatches", callContext);
340 }
341 ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Collector.submitBatches");
342
343 if (this->eventHandler_.get() != nullptr) {
344 this->eventHandler_->preRead(ctx, "Collector.submitBatches");
345 }
346
347 Collector_submitBatches_args args;
348 args.read(iprot);
349 iprot->readMessageEnd();
350 uint32_t bytes = iprot->getTransport()->readEnd();
351
352 if (this->eventHandler_.get() != nullptr) {
353 this->eventHandler_->postRead(ctx, "Collector.submitBatches", bytes);
354 }
355
356 Collector_submitBatches_result result;
357 try {
358 iface_->submitBatches(result.success, args.batches);
359 result.__isset.success = true;
360 } catch (const std::exception& e) {
361 if (this->eventHandler_.get() != nullptr) {
362 this->eventHandler_->handlerError(ctx, "Collector.submitBatches");
363 }
364
365 ::apache::thrift::TApplicationException x(e.what());
366 oprot->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_EXCEPTION, seqid);
367 x.write(oprot);
368 oprot->writeMessageEnd();
369 oprot->getTransport()->writeEnd();
370 oprot->getTransport()->flush();
371 return;
372 }
373
374 if (this->eventHandler_.get() != nullptr) {
375 this->eventHandler_->preWrite(ctx, "Collector.submitBatches");
376 }
377
378 oprot->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_REPLY, seqid);
379 result.write(oprot);
380 oprot->writeMessageEnd();
381 bytes = oprot->getTransport()->writeEnd();
382 oprot->getTransport()->flush();
383
384 if (this->eventHandler_.get() != nullptr) {
385 this->eventHandler_->postWrite(ctx, "Collector.submitBatches", bytes);
386 }
387}
388
389::std::shared_ptr< ::apache::thrift::TProcessor > CollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
390 ::apache::thrift::ReleaseHandler< CollectorIfFactory > cleanup(handlerFactory_);
391 ::std::shared_ptr< CollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
392 ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new CollectorProcessor(handler));
393 return processor;
394}
395
396void CollectorConcurrentClient::submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches)
397{
398 int32_t seqid = send_submitBatches(batches);
399 recv_submitBatches(_return, seqid);
400}
401
402int32_t CollectorConcurrentClient::send_submitBatches(const std::vector<Batch> & batches)
403{
404 int32_t cseqid = this->sync_->generateSeqId();
405 ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get());
406 oprot_->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_CALL, cseqid);
407
408 Collector_submitBatches_pargs args;
409 args.batches = &batches;
410 args.write(oprot_);
411
412 oprot_->writeMessageEnd();
413 oprot_->getTransport()->writeEnd();
414 oprot_->getTransport()->flush();
415
416 sentry.commit();
417 return cseqid;
418}
419
420void CollectorConcurrentClient::recv_submitBatches(std::vector<BatchSubmitResponse> & _return, const int32_t seqid)
421{
422
423 int32_t rseqid = 0;
424 std::string fname;
425 ::apache::thrift::protocol::TMessageType mtype;
426
427 // the read mutex gets dropped and reacquired as part of waitForWork()
428 // The destructor of this sentry wakes up other clients
429 ::apache::thrift::async::TConcurrentRecvSentry sentry(this->sync_.get(), seqid);
430
431 while(true) {
432 if(!this->sync_->getPending(fname, mtype, rseqid)) {
433 iprot_->readMessageBegin(fname, mtype, rseqid);
434 }
435 if(seqid == rseqid) {
436 if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
437 ::apache::thrift::TApplicationException x;
438 x.read(iprot_);
439 iprot_->readMessageEnd();
440 iprot_->getTransport()->readEnd();
441 sentry.commit();
442 throw x;
443 }
444 if (mtype != ::apache::thrift::protocol::T_REPLY) {
445 iprot_->skip(::apache::thrift::protocol::T_STRUCT);
446 iprot_->readMessageEnd();
447 iprot_->getTransport()->readEnd();
448 }
449 if (fname.compare("submitBatches") != 0) {
450 iprot_->skip(::apache::thrift::protocol::T_STRUCT);
451 iprot_->readMessageEnd();
452 iprot_->getTransport()->readEnd();
453
454 // in a bad state, don't commit
455 using ::apache::thrift::protocol::TProtocolException;
456 throw TProtocolException(TProtocolException::INVALID_DATA);
457 }
458 Collector_submitBatches_presult result;
459 result.success = &_return;
460 result.read(iprot_);
461 iprot_->readMessageEnd();
462 iprot_->getTransport()->readEnd();
463
464 if (result.__isset.success) {
465 // _return pointer has now been filled
466 sentry.commit();
467 return;
468 }
469 // in a bad state, don't commit
470 throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitBatches failed: unknown result");
471 }
472 // seqid != rseqid
473 this->sync_->updatePending(fname, mtype, rseqid);
474
475 // this will temporarily unlock the readMutex, and let other clients get work done
476 this->sync_->waitForWork(seqid);
477 } // end while(true)
478}
479
480}} // namespace
481