Debian Codegraph @

crossdock/thrift_gen/tracetest/ttypes.py

raw
1 #
2 # Autogenerated by Thrift Compiler (0.9.3)
3 #
4 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 #
6 # options string: py:new_style,tornado
7 #
8
9 from thrift.Thrift import TType, TMessageType, TException, TApplicationException
10
11 from thrift.transport import TTransport
12 from thrift.protocol import TBinaryProtocol, TProtocol
13 try:
14 from thrift.protocol import fastbinary
15 except:
16 fastbinary = None
17
18
19 class Transport(object):
20 HTTP = 0
21 TCHANNEL = 1
22
23 _VALUES_TO_NAMES = {
24 0: "HTTP",
25 1: "TCHANNEL",
26 }
27
28 _NAMES_TO_VALUES = {
29 "HTTP": 0,
30 "TCHANNEL": 1,
31 }
32
33
34 class Downstream(object):
35 """
36 Attributes:
37 - serviceName
38 - serverRole
39 - host
40 - port
41 - transport
42 - downstream
43 """
44
45 #thrift_spec = (
46 #None, # 0
47 #(1, TType.STRING, 'serviceName', None, None, ), # 1
48 #(2, TType.STRING, 'serverRole', None, None, ), # 2
49 #(3, TType.STRING, 'host', None, None, ), # 3
50 #(4, TType.STRING, 'port', None, None, ), # 4
51 #(5, TType.I32, 'transport', None, None, ), # 5
52 #(6, TType.STRUCT, 'downstream', (Downstream, Downstream.thrift_spec), None, ), # 6
53 #)
54
55 def __init__(self, serviceName=None, serverRole=None, host=None, port=None, transport=None, downstream=None,):
56 self.serviceName = serviceName
57 self.serverRole = serverRole
58 self.host = host
59 self.port = port
60 self.transport = transport
61 self.downstream = downstream
62
63 def read(self, iprot):
64 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
65 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
66 return
67 iprot.readStructBegin()
68 while True:
69 (fname, ftype, fid) = iprot.readFieldBegin()
70 if ftype == TType.STOP:
71 break
72 if fid == 1:
73 if ftype == TType.STRING:
74 self.serviceName = iprot.readString()
75 else:
76 iprot.skip(ftype)
77 elif fid == 2:
78 if ftype == TType.STRING:
79 self.serverRole = iprot.readString()
80 else:
81 iprot.skip(ftype)
82 elif fid == 3:
83 if ftype == TType.STRING:
84 self.host = iprot.readString()
85 else:
86 iprot.skip(ftype)
87 elif fid == 4:
88 if ftype == TType.STRING:
89 self.port = iprot.readString()
90 else:
91 iprot.skip(ftype)
92 elif fid == 5:
93 if ftype == TType.I32:
94 self.transport = iprot.readI32()
95 else:
96 iprot.skip(ftype)
97 elif fid == 6:
98 if ftype == TType.STRUCT:
99 self.downstream = Downstream()
100 self.downstream.read(iprot)
101 else:
102 iprot.skip(ftype)
103 else:
104 iprot.skip(ftype)
105 iprot.readFieldEnd()
106 iprot.readStructEnd()
107
108 def write(self, oprot):
109 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
110 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
111 return
112 oprot.writeStructBegin('Downstream')
113 if self.serviceName is not None:
114 oprot.writeFieldBegin('serviceName', TType.STRING, 1)
115 oprot.writeString(self.serviceName)
116 oprot.writeFieldEnd()
117 if self.serverRole is not None:
118 oprot.writeFieldBegin('serverRole', TType.STRING, 2)
119 oprot.writeString(self.serverRole)
120 oprot.writeFieldEnd()
121 if self.host is not None:
122 oprot.writeFieldBegin('host', TType.STRING, 3)
123 oprot.writeString(self.host)
124 oprot.writeFieldEnd()
125 if self.port is not None:
126 oprot.writeFieldBegin('port', TType.STRING, 4)
127 oprot.writeString(self.port)
128 oprot.writeFieldEnd()
129 if self.transport is not None:
130 oprot.writeFieldBegin('transport', TType.I32, 5)
131 oprot.writeI32(self.transport)
132 oprot.writeFieldEnd()
133 if self.downstream is not None:
134 oprot.writeFieldBegin('downstream', TType.STRUCT, 6)
135 self.downstream.write(oprot)
136 oprot.writeFieldEnd()
137 oprot.writeFieldStop()
138 oprot.writeStructEnd()
139
140 def validate(self):
141 if self.serviceName is None:
142 raise TProtocol.TProtocolException(message='Required field serviceName is unset!')
143 if self.serverRole is None:
144 raise TProtocol.TProtocolException(message='Required field serverRole is unset!')
145 if self.host is None:
146 raise TProtocol.TProtocolException(message='Required field host is unset!')
147 if self.port is None:
148 raise TProtocol.TProtocolException(message='Required field port is unset!')
149 if self.transport is None:
150 raise TProtocol.TProtocolException(message='Required field transport is unset!')
151 return
152
153
154 def __hash__(self):
155 value = 17
156 value = (value * 31) ^ hash(self.serviceName)
157 value = (value * 31) ^ hash(self.serverRole)
158 value = (value * 31) ^ hash(self.host)
159 value = (value * 31) ^ hash(self.port)
160 value = (value * 31) ^ hash(self.transport)
161 value = (value * 31) ^ hash(self.downstream)
162 return value
163
164 def __repr__(self):
165 L = ['%s=%r' % (key, value)
166 for key, value in self.__dict__.iteritems()]
167 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
168
169 def __eq__(self, other):
170 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
171
172 def __ne__(self, other):
173 return not (self == other)
174
175 class StartTraceRequest(object):
176 """
177 Attributes:
178 - serverRole
179 - sampled
180 - baggage
181 - downstream
182 """
183
184 #thrift_spec = (
185 #None, # 0
186 #(1, TType.STRING, 'serverRole', None, None, ), # 1
187 #(2, TType.BOOL, 'sampled', None, None, ), # 2
188 #(3, TType.STRING, 'baggage', None, None, ), # 3
189 #(4, TType.STRUCT, 'downstream', (Downstream, Downstream.thrift_spec), None, ), # 4
190 #)
191
192 def __init__(self, serverRole=None, sampled=None, baggage=None, downstream=None,):
193 self.serverRole = serverRole
194 self.sampled = sampled
195 self.baggage = baggage
196 self.downstream = downstream
197
198 def read(self, iprot):
199 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
200 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
201 return
202 iprot.readStructBegin()
203 while True:
204 (fname, ftype, fid) = iprot.readFieldBegin()
205 if ftype == TType.STOP:
206 break
207 if fid == 1:
208 if ftype == TType.STRING:
209 self.serverRole = iprot.readString()
210 else:
211 iprot.skip(ftype)
212 elif fid == 2:
213 if ftype == TType.BOOL:
214 self.sampled = iprot.readBool()
215 else:
216 iprot.skip(ftype)
217 elif fid == 3:
218 if ftype == TType.STRING:
219 self.baggage = iprot.readString()
220 else:
221 iprot.skip(ftype)
222 elif fid == 4:
223 if ftype == TType.STRUCT:
224 self.downstream = Downstream()
225 self.downstream.read(iprot)
226 else:
227 iprot.skip(ftype)
228 else:
229 iprot.skip(ftype)
230 iprot.readFieldEnd()
231 iprot.readStructEnd()
232
233 def write(self, oprot):
234 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
235 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
236 return
237 oprot.writeStructBegin('StartTraceRequest')
238 if self.serverRole is not None:
239 oprot.writeFieldBegin('serverRole', TType.STRING, 1)
240 oprot.writeString(self.serverRole)
241 oprot.writeFieldEnd()
242 if self.sampled is not None:
243 oprot.writeFieldBegin('sampled', TType.BOOL, 2)
244 oprot.writeBool(self.sampled)
245 oprot.writeFieldEnd()
246 if self.baggage is not None:
247 oprot.writeFieldBegin('baggage', TType.STRING, 3)
248 oprot.writeString(self.baggage)
249 oprot.writeFieldEnd()
250 if self.downstream is not None:
251 oprot.writeFieldBegin('downstream', TType.STRUCT, 4)
252 self.downstream.write(oprot)
253 oprot.writeFieldEnd()
254 oprot.writeFieldStop()
255 oprot.writeStructEnd()
256
257 def validate(self):
258 if self.serverRole is None:
259 raise TProtocol.TProtocolException(message='Required field serverRole is unset!')
260 if self.sampled is None:
261 raise TProtocol.TProtocolException(message='Required field sampled is unset!')
262 if self.baggage is None:
263 raise TProtocol.TProtocolException(message='Required field baggage is unset!')
264 if self.downstream is None:
265 raise TProtocol.TProtocolException(message='Required field downstream is unset!')
266 return
267
268
269 def __hash__(self):
270 value = 17
271 value = (value * 31) ^ hash(self.serverRole)
272 value = (value * 31) ^ hash(self.sampled)
273 value = (value * 31) ^ hash(self.baggage)
274 value = (value * 31) ^ hash(self.downstream)
275 return value
276
277 def __repr__(self):
278 L = ['%s=%r' % (key, value)
279 for key, value in self.__dict__.iteritems()]
280 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
281
282 def __eq__(self, other):
283 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
284
285 def __ne__(self, other):
286 return not (self == other)
287
288 class JoinTraceRequest(object):
289 """
290 Attributes:
291 - serverRole
292 - downstream
293 """
294
295 #thrift_spec = (
296 #None, # 0
297 #(1, TType.STRING, 'serverRole', None, None, ), # 1
298 #(2, TType.STRUCT, 'downstream', (Downstream, Downstream.thrift_spec), None, ), # 2
299 #)
300
301 def __init__(self, serverRole=None, downstream=None,):
302 self.serverRole = serverRole
303 self.downstream = downstream
304
305 def read(self, iprot):
306 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
307 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
308 return
309 iprot.readStructBegin()
310 while True:
311 (fname, ftype, fid) = iprot.readFieldBegin()
312 if ftype == TType.STOP:
313 break
314 if fid == 1:
315 if ftype == TType.STRING:
316 self.serverRole = iprot.readString()
317 else:
318 iprot.skip(ftype)
319 elif fid == 2:
320 if ftype == TType.STRUCT:
321 self.downstream = Downstream()
322 self.downstream.read(iprot)
323 else:
324 iprot.skip(ftype)
325 else:
326 iprot.skip(ftype)
327 iprot.readFieldEnd()
328 iprot.readStructEnd()
329
330 def write(self, oprot):
331 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
332 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
333 return
334 oprot.writeStructBegin('JoinTraceRequest')
335 if self.serverRole is not None:
336 oprot.writeFieldBegin('serverRole', TType.STRING, 1)
337 oprot.writeString(self.serverRole)
338 oprot.writeFieldEnd()
339 if self.downstream is not None:
340 oprot.writeFieldBegin('downstream', TType.STRUCT, 2)
341 self.downstream.write(oprot)
342 oprot.writeFieldEnd()
343 oprot.writeFieldStop()
344 oprot.writeStructEnd()
345
346 def validate(self):
347 if self.serverRole is None:
348 raise TProtocol.TProtocolException(message='Required field serverRole is unset!')
349 return
350
351
352 def __hash__(self):
353 value = 17
354 value = (value * 31) ^ hash(self.serverRole)
355 value = (value * 31) ^ hash(self.downstream)
356 return value
357
358 def __repr__(self):
359 L = ['%s=%r' % (key, value)
360 for key, value in self.__dict__.iteritems()]
361 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
362
363 def __eq__(self, other):
364 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
365
366 def __ne__(self, other):
367 return not (self == other)
368
369 class ObservedSpan(object):
370 """
371 Attributes:
372 - traceId
373 - sampled
374 - baggage
375 """
376
377 #thrift_spec = (
378 #None, # 0
379 #(1, TType.STRING, 'traceId', None, None, ), # 1
380 #(2, TType.BOOL, 'sampled', None, None, ), # 2
381 #(3, TType.STRING, 'baggage', None, None, ), # 3
382 #)
383
384 def __init__(self, traceId=None, sampled=None, baggage=None,):
385 self.traceId = traceId
386 self.sampled = sampled
387 self.baggage = baggage
388
389 def read(self, iprot):
390 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
391 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
392 return
393 iprot.readStructBegin()
394 while True:
395 (fname, ftype, fid) = iprot.readFieldBegin()
396 if ftype == TType.STOP:
397 break
398 if fid == 1:
399 if ftype == TType.STRING:
400 self.traceId = iprot.readString()
401 else:
402 iprot.skip(ftype)
403 elif fid == 2:
404 if ftype == TType.BOOL:
405 self.sampled = iprot.readBool()
406 else:
407 iprot.skip(ftype)
408 elif fid == 3:
409 if ftype == TType.STRING:
410 self.baggage = iprot.readString()
411 else:
412 iprot.skip(ftype)
413 else:
414 iprot.skip(ftype)
415 iprot.readFieldEnd()
416 iprot.readStructEnd()
417
418 def write(self, oprot):
419 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
420 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
421 return
422 oprot.writeStructBegin('ObservedSpan')
423 if self.traceId is not None:
424 oprot.writeFieldBegin('traceId', TType.STRING, 1)
425 oprot.writeString(self.traceId)
426 oprot.writeFieldEnd()
427 if self.sampled is not None:
428 oprot.writeFieldBegin('sampled', TType.BOOL, 2)
429 oprot.writeBool(self.sampled)
430 oprot.writeFieldEnd()
431 if self.baggage is not None:
432 oprot.writeFieldBegin('baggage', TType.STRING, 3)
433 oprot.writeString(self.baggage)
434 oprot.writeFieldEnd()
435 oprot.writeFieldStop()
436 oprot.writeStructEnd()
437
438 def validate(self):
439 if self.traceId is None:
440 raise TProtocol.TProtocolException(message='Required field traceId is unset!')
441 if self.sampled is None:
442 raise TProtocol.TProtocolException(message='Required field sampled is unset!')
443 if self.baggage is None:
444 raise TProtocol.TProtocolException(message='Required field baggage is unset!')
445 return
446
447
448 def __hash__(self):
449 value = 17
450 value = (value * 31) ^ hash(self.traceId)
451 value = (value * 31) ^ hash(self.sampled)
452 value = (value * 31) ^ hash(self.baggage)
453 return value
454
455 def __repr__(self):
456 L = ['%s=%r' % (key, value)
457 for key, value in self.__dict__.iteritems()]
458 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
459
460 def __eq__(self, other):
461 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
462
463 def __ne__(self, other):
464 return not (self == other)
465
466 class TraceResponse(object):
467 """
468 Each server must include the information about the span it observed.
469 It can only be omitted from the response if notImplementedError field is not empty.
470 If the server was instructed to make a downstream call, it must embed the
471 downstream response in its own response.
472
473 Attributes:
474 - span
475 - downstream
476 - notImplementedError
477 """
478
479 #thrift_spec = (
480 #None, # 0
481 #(1, TType.STRUCT, 'span', (ObservedSpan, ObservedSpan.thrift_spec), None, ), # 1
482 #(2, TType.STRUCT, 'downstream', (TraceResponse, TraceResponse.thrift_spec), None, ), # 2
483 #(3, TType.STRING, 'notImplementedError', None, None, ), # 3
484 #)
485
486 def __init__(self, span=None, downstream=None, notImplementedError=None,):
487 self.span = span
488 self.downstream = downstream
489 self.notImplementedError = notImplementedError
490
491 def read(self, iprot):
492 if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
493 fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
494 return
495 iprot.readStructBegin()
496 while True:
497 (fname, ftype, fid) = iprot.readFieldBegin()
498 if ftype == TType.STOP:
499 break
500 if fid == 1:
501 if ftype == TType.STRUCT:
502 self.span = ObservedSpan()
503 self.span.read(iprot)
504 else:
505 iprot.skip(ftype)
506 elif fid == 2:
507 if ftype == TType.STRUCT:
508 self.downstream = TraceResponse()
509 self.downstream.read(iprot)
510 else:
511 iprot.skip(ftype)
512 elif fid == 3:
513 if ftype == TType.STRING:
514 self.notImplementedError = iprot.readString()
515 else:
516 iprot.skip(ftype)
517 else:
518 iprot.skip(ftype)
519 iprot.readFieldEnd()
520 iprot.readStructEnd()
521
522 def write(self, oprot):
523 if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
524 oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
525 return
526 oprot.writeStructBegin('TraceResponse')
527 if self.span is not None:
528 oprot.writeFieldBegin('span', TType.STRUCT, 1)
529 self.span.write(oprot)
530 oprot.writeFieldEnd()
531 if self.downstream is not None:
532 oprot.writeFieldBegin('downstream', TType.STRUCT, 2)
533 self.downstream.write(oprot)
534 oprot.writeFieldEnd()
535 if self.notImplementedError is not None:
536 oprot.writeFieldBegin('notImplementedError', TType.STRING, 3)
537 oprot.writeString(self.notImplementedError)
538 oprot.writeFieldEnd()
539 oprot.writeFieldStop()
540 oprot.writeStructEnd()
541
542 def validate(self):
543 if self.notImplementedError is None:
544 raise TProtocol.TProtocolException(message='Required field notImplementedError is unset!')
545 return
546
547
548 def __hash__(self):
549 value = 17
550 value = (value * 31) ^ hash(self.span)
551 value = (value * 31) ^ hash(self.downstream)
552 value = (value * 31) ^ hash(self.notImplementedError)
553 return value
554
555 def __repr__(self):
556 L = ['%s=%r' % (key, value)
557 for key, value in self.__dict__.iteritems()]
558 return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
559
560 def __eq__(self, other):
561 return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
562
563 def __ne__(self, other):
564 return not (self == other)