|
1 #!/usr/bin/env python |
|
2 # |
|
3 # Copyright 2007 Google Inc. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 # |
|
17 |
|
18 from google.net.proto import ProtocolBuffer |
|
19 import array |
|
20 import dummy_thread as thread |
|
21 |
|
22 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit |
|
23 unusednames=printElemNumber,debug_strs no-special""" |
|
24 |
|
25 class TaskQueueServiceError(ProtocolBuffer.ProtocolMessage): |
|
26 |
|
27 OK = 0 |
|
28 UNKNOWN_QUEUE = 1 |
|
29 TRANSIENT_ERROR = 2 |
|
30 INTERNAL_ERROR = 3 |
|
31 TASK_TOO_LARGE = 4 |
|
32 INVALID_TASK_NAME = 5 |
|
33 INVALID_QUEUE_NAME = 6 |
|
34 INVALID_URL = 7 |
|
35 INVALID_QUEUE_RATE = 8 |
|
36 PERMISSION_DENIED = 9 |
|
37 TASK_ALREADY_EXISTS = 10 |
|
38 TOMBSTONED_TASK = 11 |
|
39 INVALID_ETA = 12 |
|
40 |
|
41 _ErrorCode_NAMES = { |
|
42 0: "OK", |
|
43 1: "UNKNOWN_QUEUE", |
|
44 2: "TRANSIENT_ERROR", |
|
45 3: "INTERNAL_ERROR", |
|
46 4: "TASK_TOO_LARGE", |
|
47 5: "INVALID_TASK_NAME", |
|
48 6: "INVALID_QUEUE_NAME", |
|
49 7: "INVALID_URL", |
|
50 8: "INVALID_QUEUE_RATE", |
|
51 9: "PERMISSION_DENIED", |
|
52 10: "TASK_ALREADY_EXISTS", |
|
53 11: "TOMBSTONED_TASK", |
|
54 12: "INVALID_ETA", |
|
55 } |
|
56 |
|
57 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "") |
|
58 ErrorCode_Name = classmethod(ErrorCode_Name) |
|
59 |
|
60 |
|
61 def __init__(self, contents=None): |
|
62 pass |
|
63 if contents is not None: self.MergeFromString(contents) |
|
64 |
|
65 |
|
66 def MergeFrom(self, x): |
|
67 assert x is not self |
|
68 |
|
69 def Equals(self, x): |
|
70 if x is self: return 1 |
|
71 return 1 |
|
72 |
|
73 def IsInitialized(self, debug_strs=None): |
|
74 initialized = 1 |
|
75 return initialized |
|
76 |
|
77 def ByteSize(self): |
|
78 n = 0 |
|
79 return n + 0 |
|
80 |
|
81 def Clear(self): |
|
82 pass |
|
83 |
|
84 def OutputUnchecked(self, out): |
|
85 pass |
|
86 |
|
87 def TryMerge(self, d): |
|
88 while d.avail() > 0: |
|
89 tt = d.getVarInt32() |
|
90 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
91 d.skipData(tt) |
|
92 |
|
93 |
|
94 def __str__(self, prefix="", printElemNumber=0): |
|
95 res="" |
|
96 return res |
|
97 |
|
98 |
|
99 _TEXT = ( |
|
100 "ErrorCode", |
|
101 ) |
|
102 |
|
103 _TYPES = ( |
|
104 ProtocolBuffer.Encoder.NUMERIC, |
|
105 ) |
|
106 |
|
107 _STYLE = """""" |
|
108 _STYLE_CONTENT_TYPE = """""" |
|
109 class TaskQueueAddRequest_Header(ProtocolBuffer.ProtocolMessage): |
|
110 has_key_ = 0 |
|
111 key_ = "" |
|
112 has_value_ = 0 |
|
113 value_ = "" |
|
114 |
|
115 def __init__(self, contents=None): |
|
116 if contents is not None: self.MergeFromString(contents) |
|
117 |
|
118 def key(self): return self.key_ |
|
119 |
|
120 def set_key(self, x): |
|
121 self.has_key_ = 1 |
|
122 self.key_ = x |
|
123 |
|
124 def clear_key(self): |
|
125 if self.has_key_: |
|
126 self.has_key_ = 0 |
|
127 self.key_ = "" |
|
128 |
|
129 def has_key(self): return self.has_key_ |
|
130 |
|
131 def value(self): return self.value_ |
|
132 |
|
133 def set_value(self, x): |
|
134 self.has_value_ = 1 |
|
135 self.value_ = x |
|
136 |
|
137 def clear_value(self): |
|
138 if self.has_value_: |
|
139 self.has_value_ = 0 |
|
140 self.value_ = "" |
|
141 |
|
142 def has_value(self): return self.has_value_ |
|
143 |
|
144 |
|
145 def MergeFrom(self, x): |
|
146 assert x is not self |
|
147 if (x.has_key()): self.set_key(x.key()) |
|
148 if (x.has_value()): self.set_value(x.value()) |
|
149 |
|
150 def Equals(self, x): |
|
151 if x is self: return 1 |
|
152 if self.has_key_ != x.has_key_: return 0 |
|
153 if self.has_key_ and self.key_ != x.key_: return 0 |
|
154 if self.has_value_ != x.has_value_: return 0 |
|
155 if self.has_value_ and self.value_ != x.value_: return 0 |
|
156 return 1 |
|
157 |
|
158 def IsInitialized(self, debug_strs=None): |
|
159 initialized = 1 |
|
160 if (not self.has_key_): |
|
161 initialized = 0 |
|
162 if debug_strs is not None: |
|
163 debug_strs.append('Required field: key not set.') |
|
164 if (not self.has_value_): |
|
165 initialized = 0 |
|
166 if debug_strs is not None: |
|
167 debug_strs.append('Required field: value not set.') |
|
168 return initialized |
|
169 |
|
170 def ByteSize(self): |
|
171 n = 0 |
|
172 n += self.lengthString(len(self.key_)) |
|
173 n += self.lengthString(len(self.value_)) |
|
174 return n + 2 |
|
175 |
|
176 def Clear(self): |
|
177 self.clear_key() |
|
178 self.clear_value() |
|
179 |
|
180 def OutputUnchecked(self, out): |
|
181 out.putVarInt32(58) |
|
182 out.putPrefixedString(self.key_) |
|
183 out.putVarInt32(66) |
|
184 out.putPrefixedString(self.value_) |
|
185 |
|
186 def TryMerge(self, d): |
|
187 while 1: |
|
188 tt = d.getVarInt32() |
|
189 if tt == 52: break |
|
190 if tt == 58: |
|
191 self.set_key(d.getPrefixedString()) |
|
192 continue |
|
193 if tt == 66: |
|
194 self.set_value(d.getPrefixedString()) |
|
195 continue |
|
196 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
197 d.skipData(tt) |
|
198 |
|
199 |
|
200 def __str__(self, prefix="", printElemNumber=0): |
|
201 res="" |
|
202 if self.has_key_: res+=prefix+("key: %s\n" % self.DebugFormatString(self.key_)) |
|
203 if self.has_value_: res+=prefix+("value: %s\n" % self.DebugFormatString(self.value_)) |
|
204 return res |
|
205 |
|
206 class TaskQueueAddRequest(ProtocolBuffer.ProtocolMessage): |
|
207 |
|
208 GET = 1 |
|
209 POST = 2 |
|
210 HEAD = 3 |
|
211 PUT = 4 |
|
212 DELETE = 5 |
|
213 |
|
214 _RequestMethod_NAMES = { |
|
215 1: "GET", |
|
216 2: "POST", |
|
217 3: "HEAD", |
|
218 4: "PUT", |
|
219 5: "DELETE", |
|
220 } |
|
221 |
|
222 def RequestMethod_Name(cls, x): return cls._RequestMethod_NAMES.get(x, "") |
|
223 RequestMethod_Name = classmethod(RequestMethod_Name) |
|
224 |
|
225 has_queue_name_ = 0 |
|
226 queue_name_ = "" |
|
227 has_task_name_ = 0 |
|
228 task_name_ = "" |
|
229 has_eta_usec_ = 0 |
|
230 eta_usec_ = 0 |
|
231 has_method_ = 0 |
|
232 method_ = 2 |
|
233 has_url_ = 0 |
|
234 url_ = "" |
|
235 has_body_ = 0 |
|
236 body_ = "" |
|
237 |
|
238 def __init__(self, contents=None): |
|
239 self.header_ = [] |
|
240 if contents is not None: self.MergeFromString(contents) |
|
241 |
|
242 def queue_name(self): return self.queue_name_ |
|
243 |
|
244 def set_queue_name(self, x): |
|
245 self.has_queue_name_ = 1 |
|
246 self.queue_name_ = x |
|
247 |
|
248 def clear_queue_name(self): |
|
249 if self.has_queue_name_: |
|
250 self.has_queue_name_ = 0 |
|
251 self.queue_name_ = "" |
|
252 |
|
253 def has_queue_name(self): return self.has_queue_name_ |
|
254 |
|
255 def task_name(self): return self.task_name_ |
|
256 |
|
257 def set_task_name(self, x): |
|
258 self.has_task_name_ = 1 |
|
259 self.task_name_ = x |
|
260 |
|
261 def clear_task_name(self): |
|
262 if self.has_task_name_: |
|
263 self.has_task_name_ = 0 |
|
264 self.task_name_ = "" |
|
265 |
|
266 def has_task_name(self): return self.has_task_name_ |
|
267 |
|
268 def eta_usec(self): return self.eta_usec_ |
|
269 |
|
270 def set_eta_usec(self, x): |
|
271 self.has_eta_usec_ = 1 |
|
272 self.eta_usec_ = x |
|
273 |
|
274 def clear_eta_usec(self): |
|
275 if self.has_eta_usec_: |
|
276 self.has_eta_usec_ = 0 |
|
277 self.eta_usec_ = 0 |
|
278 |
|
279 def has_eta_usec(self): return self.has_eta_usec_ |
|
280 |
|
281 def method(self): return self.method_ |
|
282 |
|
283 def set_method(self, x): |
|
284 self.has_method_ = 1 |
|
285 self.method_ = x |
|
286 |
|
287 def clear_method(self): |
|
288 if self.has_method_: |
|
289 self.has_method_ = 0 |
|
290 self.method_ = 2 |
|
291 |
|
292 def has_method(self): return self.has_method_ |
|
293 |
|
294 def url(self): return self.url_ |
|
295 |
|
296 def set_url(self, x): |
|
297 self.has_url_ = 1 |
|
298 self.url_ = x |
|
299 |
|
300 def clear_url(self): |
|
301 if self.has_url_: |
|
302 self.has_url_ = 0 |
|
303 self.url_ = "" |
|
304 |
|
305 def has_url(self): return self.has_url_ |
|
306 |
|
307 def header_size(self): return len(self.header_) |
|
308 def header_list(self): return self.header_ |
|
309 |
|
310 def header(self, i): |
|
311 return self.header_[i] |
|
312 |
|
313 def mutable_header(self, i): |
|
314 return self.header_[i] |
|
315 |
|
316 def add_header(self): |
|
317 x = TaskQueueAddRequest_Header() |
|
318 self.header_.append(x) |
|
319 return x |
|
320 |
|
321 def clear_header(self): |
|
322 self.header_ = [] |
|
323 def body(self): return self.body_ |
|
324 |
|
325 def set_body(self, x): |
|
326 self.has_body_ = 1 |
|
327 self.body_ = x |
|
328 |
|
329 def clear_body(self): |
|
330 if self.has_body_: |
|
331 self.has_body_ = 0 |
|
332 self.body_ = "" |
|
333 |
|
334 def has_body(self): return self.has_body_ |
|
335 |
|
336 |
|
337 def MergeFrom(self, x): |
|
338 assert x is not self |
|
339 if (x.has_queue_name()): self.set_queue_name(x.queue_name()) |
|
340 if (x.has_task_name()): self.set_task_name(x.task_name()) |
|
341 if (x.has_eta_usec()): self.set_eta_usec(x.eta_usec()) |
|
342 if (x.has_method()): self.set_method(x.method()) |
|
343 if (x.has_url()): self.set_url(x.url()) |
|
344 for i in xrange(x.header_size()): self.add_header().CopyFrom(x.header(i)) |
|
345 if (x.has_body()): self.set_body(x.body()) |
|
346 |
|
347 def Equals(self, x): |
|
348 if x is self: return 1 |
|
349 if self.has_queue_name_ != x.has_queue_name_: return 0 |
|
350 if self.has_queue_name_ and self.queue_name_ != x.queue_name_: return 0 |
|
351 if self.has_task_name_ != x.has_task_name_: return 0 |
|
352 if self.has_task_name_ and self.task_name_ != x.task_name_: return 0 |
|
353 if self.has_eta_usec_ != x.has_eta_usec_: return 0 |
|
354 if self.has_eta_usec_ and self.eta_usec_ != x.eta_usec_: return 0 |
|
355 if self.has_method_ != x.has_method_: return 0 |
|
356 if self.has_method_ and self.method_ != x.method_: return 0 |
|
357 if self.has_url_ != x.has_url_: return 0 |
|
358 if self.has_url_ and self.url_ != x.url_: return 0 |
|
359 if len(self.header_) != len(x.header_): return 0 |
|
360 for e1, e2 in zip(self.header_, x.header_): |
|
361 if e1 != e2: return 0 |
|
362 if self.has_body_ != x.has_body_: return 0 |
|
363 if self.has_body_ and self.body_ != x.body_: return 0 |
|
364 return 1 |
|
365 |
|
366 def IsInitialized(self, debug_strs=None): |
|
367 initialized = 1 |
|
368 if (not self.has_queue_name_): |
|
369 initialized = 0 |
|
370 if debug_strs is not None: |
|
371 debug_strs.append('Required field: queue_name not set.') |
|
372 if (not self.has_task_name_): |
|
373 initialized = 0 |
|
374 if debug_strs is not None: |
|
375 debug_strs.append('Required field: task_name not set.') |
|
376 if (not self.has_eta_usec_): |
|
377 initialized = 0 |
|
378 if debug_strs is not None: |
|
379 debug_strs.append('Required field: eta_usec not set.') |
|
380 if (not self.has_url_): |
|
381 initialized = 0 |
|
382 if debug_strs is not None: |
|
383 debug_strs.append('Required field: url not set.') |
|
384 for p in self.header_: |
|
385 if not p.IsInitialized(debug_strs): initialized=0 |
|
386 return initialized |
|
387 |
|
388 def ByteSize(self): |
|
389 n = 0 |
|
390 n += self.lengthString(len(self.queue_name_)) |
|
391 n += self.lengthString(len(self.task_name_)) |
|
392 n += self.lengthVarInt64(self.eta_usec_) |
|
393 if (self.has_method_): n += 1 + self.lengthVarInt64(self.method_) |
|
394 n += self.lengthString(len(self.url_)) |
|
395 n += 2 * len(self.header_) |
|
396 for i in xrange(len(self.header_)): n += self.header_[i].ByteSize() |
|
397 if (self.has_body_): n += 1 + self.lengthString(len(self.body_)) |
|
398 return n + 4 |
|
399 |
|
400 def Clear(self): |
|
401 self.clear_queue_name() |
|
402 self.clear_task_name() |
|
403 self.clear_eta_usec() |
|
404 self.clear_method() |
|
405 self.clear_url() |
|
406 self.clear_header() |
|
407 self.clear_body() |
|
408 |
|
409 def OutputUnchecked(self, out): |
|
410 out.putVarInt32(10) |
|
411 out.putPrefixedString(self.queue_name_) |
|
412 out.putVarInt32(18) |
|
413 out.putPrefixedString(self.task_name_) |
|
414 out.putVarInt32(24) |
|
415 out.putVarInt64(self.eta_usec_) |
|
416 out.putVarInt32(34) |
|
417 out.putPrefixedString(self.url_) |
|
418 if (self.has_method_): |
|
419 out.putVarInt32(40) |
|
420 out.putVarInt32(self.method_) |
|
421 for i in xrange(len(self.header_)): |
|
422 out.putVarInt32(51) |
|
423 self.header_[i].OutputUnchecked(out) |
|
424 out.putVarInt32(52) |
|
425 if (self.has_body_): |
|
426 out.putVarInt32(74) |
|
427 out.putPrefixedString(self.body_) |
|
428 |
|
429 def TryMerge(self, d): |
|
430 while d.avail() > 0: |
|
431 tt = d.getVarInt32() |
|
432 if tt == 10: |
|
433 self.set_queue_name(d.getPrefixedString()) |
|
434 continue |
|
435 if tt == 18: |
|
436 self.set_task_name(d.getPrefixedString()) |
|
437 continue |
|
438 if tt == 24: |
|
439 self.set_eta_usec(d.getVarInt64()) |
|
440 continue |
|
441 if tt == 34: |
|
442 self.set_url(d.getPrefixedString()) |
|
443 continue |
|
444 if tt == 40: |
|
445 self.set_method(d.getVarInt32()) |
|
446 continue |
|
447 if tt == 51: |
|
448 self.add_header().TryMerge(d) |
|
449 continue |
|
450 if tt == 74: |
|
451 self.set_body(d.getPrefixedString()) |
|
452 continue |
|
453 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
454 d.skipData(tt) |
|
455 |
|
456 |
|
457 def __str__(self, prefix="", printElemNumber=0): |
|
458 res="" |
|
459 if self.has_queue_name_: res+=prefix+("queue_name: %s\n" % self.DebugFormatString(self.queue_name_)) |
|
460 if self.has_task_name_: res+=prefix+("task_name: %s\n" % self.DebugFormatString(self.task_name_)) |
|
461 if self.has_eta_usec_: res+=prefix+("eta_usec: %s\n" % self.DebugFormatInt64(self.eta_usec_)) |
|
462 if self.has_method_: res+=prefix+("method: %s\n" % self.DebugFormatInt32(self.method_)) |
|
463 if self.has_url_: res+=prefix+("url: %s\n" % self.DebugFormatString(self.url_)) |
|
464 cnt=0 |
|
465 for e in self.header_: |
|
466 elm="" |
|
467 if printElemNumber: elm="(%d)" % cnt |
|
468 res+=prefix+("Header%s {\n" % elm) |
|
469 res+=e.__str__(prefix + " ", printElemNumber) |
|
470 res+=prefix+"}\n" |
|
471 cnt+=1 |
|
472 if self.has_body_: res+=prefix+("body: %s\n" % self.DebugFormatString(self.body_)) |
|
473 return res |
|
474 |
|
475 kqueue_name = 1 |
|
476 ktask_name = 2 |
|
477 keta_usec = 3 |
|
478 kmethod = 5 |
|
479 kurl = 4 |
|
480 kHeaderGroup = 6 |
|
481 kHeaderkey = 7 |
|
482 kHeadervalue = 8 |
|
483 kbody = 9 |
|
484 |
|
485 _TEXT = ( |
|
486 "ErrorCode", |
|
487 "queue_name", |
|
488 "task_name", |
|
489 "eta_usec", |
|
490 "url", |
|
491 "method", |
|
492 "Header", |
|
493 "key", |
|
494 "value", |
|
495 "body", |
|
496 ) |
|
497 |
|
498 _TYPES = ( |
|
499 ProtocolBuffer.Encoder.NUMERIC, |
|
500 ProtocolBuffer.Encoder.STRING, |
|
501 |
|
502 ProtocolBuffer.Encoder.STRING, |
|
503 |
|
504 ProtocolBuffer.Encoder.NUMERIC, |
|
505 |
|
506 ProtocolBuffer.Encoder.STRING, |
|
507 |
|
508 ProtocolBuffer.Encoder.NUMERIC, |
|
509 |
|
510 ProtocolBuffer.Encoder.STARTGROUP, |
|
511 |
|
512 ProtocolBuffer.Encoder.STRING, |
|
513 |
|
514 ProtocolBuffer.Encoder.STRING, |
|
515 |
|
516 ProtocolBuffer.Encoder.STRING, |
|
517 |
|
518 ) |
|
519 |
|
520 _STYLE = """""" |
|
521 _STYLE_CONTENT_TYPE = """""" |
|
522 class TaskQueueAddResponse(ProtocolBuffer.ProtocolMessage): |
|
523 has_chosen_task_name_ = 0 |
|
524 chosen_task_name_ = "" |
|
525 |
|
526 def __init__(self, contents=None): |
|
527 if contents is not None: self.MergeFromString(contents) |
|
528 |
|
529 def chosen_task_name(self): return self.chosen_task_name_ |
|
530 |
|
531 def set_chosen_task_name(self, x): |
|
532 self.has_chosen_task_name_ = 1 |
|
533 self.chosen_task_name_ = x |
|
534 |
|
535 def clear_chosen_task_name(self): |
|
536 if self.has_chosen_task_name_: |
|
537 self.has_chosen_task_name_ = 0 |
|
538 self.chosen_task_name_ = "" |
|
539 |
|
540 def has_chosen_task_name(self): return self.has_chosen_task_name_ |
|
541 |
|
542 |
|
543 def MergeFrom(self, x): |
|
544 assert x is not self |
|
545 if (x.has_chosen_task_name()): self.set_chosen_task_name(x.chosen_task_name()) |
|
546 |
|
547 def Equals(self, x): |
|
548 if x is self: return 1 |
|
549 if self.has_chosen_task_name_ != x.has_chosen_task_name_: return 0 |
|
550 if self.has_chosen_task_name_ and self.chosen_task_name_ != x.chosen_task_name_: return 0 |
|
551 return 1 |
|
552 |
|
553 def IsInitialized(self, debug_strs=None): |
|
554 initialized = 1 |
|
555 return initialized |
|
556 |
|
557 def ByteSize(self): |
|
558 n = 0 |
|
559 if (self.has_chosen_task_name_): n += 1 + self.lengthString(len(self.chosen_task_name_)) |
|
560 return n + 0 |
|
561 |
|
562 def Clear(self): |
|
563 self.clear_chosen_task_name() |
|
564 |
|
565 def OutputUnchecked(self, out): |
|
566 if (self.has_chosen_task_name_): |
|
567 out.putVarInt32(10) |
|
568 out.putPrefixedString(self.chosen_task_name_) |
|
569 |
|
570 def TryMerge(self, d): |
|
571 while d.avail() > 0: |
|
572 tt = d.getVarInt32() |
|
573 if tt == 10: |
|
574 self.set_chosen_task_name(d.getPrefixedString()) |
|
575 continue |
|
576 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
577 d.skipData(tt) |
|
578 |
|
579 |
|
580 def __str__(self, prefix="", printElemNumber=0): |
|
581 res="" |
|
582 if self.has_chosen_task_name_: res+=prefix+("chosen_task_name: %s\n" % self.DebugFormatString(self.chosen_task_name_)) |
|
583 return res |
|
584 |
|
585 kchosen_task_name = 1 |
|
586 |
|
587 _TEXT = ( |
|
588 "ErrorCode", |
|
589 "chosen_task_name", |
|
590 ) |
|
591 |
|
592 _TYPES = ( |
|
593 ProtocolBuffer.Encoder.NUMERIC, |
|
594 ProtocolBuffer.Encoder.STRING, |
|
595 |
|
596 ) |
|
597 |
|
598 _STYLE = """""" |
|
599 _STYLE_CONTENT_TYPE = """""" |
|
600 class TaskQueueUpdateQueueRequest(ProtocolBuffer.ProtocolMessage): |
|
601 has_app_id_ = 0 |
|
602 app_id_ = "" |
|
603 has_queue_name_ = 0 |
|
604 queue_name_ = "" |
|
605 has_bucket_refill_per_second_ = 0 |
|
606 bucket_refill_per_second_ = 0.0 |
|
607 has_bucket_capacity_ = 0 |
|
608 bucket_capacity_ = 0 |
|
609 has_user_specified_rate_ = 0 |
|
610 user_specified_rate_ = "" |
|
611 |
|
612 def __init__(self, contents=None): |
|
613 if contents is not None: self.MergeFromString(contents) |
|
614 |
|
615 def app_id(self): return self.app_id_ |
|
616 |
|
617 def set_app_id(self, x): |
|
618 self.has_app_id_ = 1 |
|
619 self.app_id_ = x |
|
620 |
|
621 def clear_app_id(self): |
|
622 if self.has_app_id_: |
|
623 self.has_app_id_ = 0 |
|
624 self.app_id_ = "" |
|
625 |
|
626 def has_app_id(self): return self.has_app_id_ |
|
627 |
|
628 def queue_name(self): return self.queue_name_ |
|
629 |
|
630 def set_queue_name(self, x): |
|
631 self.has_queue_name_ = 1 |
|
632 self.queue_name_ = x |
|
633 |
|
634 def clear_queue_name(self): |
|
635 if self.has_queue_name_: |
|
636 self.has_queue_name_ = 0 |
|
637 self.queue_name_ = "" |
|
638 |
|
639 def has_queue_name(self): return self.has_queue_name_ |
|
640 |
|
641 def bucket_refill_per_second(self): return self.bucket_refill_per_second_ |
|
642 |
|
643 def set_bucket_refill_per_second(self, x): |
|
644 self.has_bucket_refill_per_second_ = 1 |
|
645 self.bucket_refill_per_second_ = x |
|
646 |
|
647 def clear_bucket_refill_per_second(self): |
|
648 if self.has_bucket_refill_per_second_: |
|
649 self.has_bucket_refill_per_second_ = 0 |
|
650 self.bucket_refill_per_second_ = 0.0 |
|
651 |
|
652 def has_bucket_refill_per_second(self): return self.has_bucket_refill_per_second_ |
|
653 |
|
654 def bucket_capacity(self): return self.bucket_capacity_ |
|
655 |
|
656 def set_bucket_capacity(self, x): |
|
657 self.has_bucket_capacity_ = 1 |
|
658 self.bucket_capacity_ = x |
|
659 |
|
660 def clear_bucket_capacity(self): |
|
661 if self.has_bucket_capacity_: |
|
662 self.has_bucket_capacity_ = 0 |
|
663 self.bucket_capacity_ = 0 |
|
664 |
|
665 def has_bucket_capacity(self): return self.has_bucket_capacity_ |
|
666 |
|
667 def user_specified_rate(self): return self.user_specified_rate_ |
|
668 |
|
669 def set_user_specified_rate(self, x): |
|
670 self.has_user_specified_rate_ = 1 |
|
671 self.user_specified_rate_ = x |
|
672 |
|
673 def clear_user_specified_rate(self): |
|
674 if self.has_user_specified_rate_: |
|
675 self.has_user_specified_rate_ = 0 |
|
676 self.user_specified_rate_ = "" |
|
677 |
|
678 def has_user_specified_rate(self): return self.has_user_specified_rate_ |
|
679 |
|
680 |
|
681 def MergeFrom(self, x): |
|
682 assert x is not self |
|
683 if (x.has_app_id()): self.set_app_id(x.app_id()) |
|
684 if (x.has_queue_name()): self.set_queue_name(x.queue_name()) |
|
685 if (x.has_bucket_refill_per_second()): self.set_bucket_refill_per_second(x.bucket_refill_per_second()) |
|
686 if (x.has_bucket_capacity()): self.set_bucket_capacity(x.bucket_capacity()) |
|
687 if (x.has_user_specified_rate()): self.set_user_specified_rate(x.user_specified_rate()) |
|
688 |
|
689 def Equals(self, x): |
|
690 if x is self: return 1 |
|
691 if self.has_app_id_ != x.has_app_id_: return 0 |
|
692 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0 |
|
693 if self.has_queue_name_ != x.has_queue_name_: return 0 |
|
694 if self.has_queue_name_ and self.queue_name_ != x.queue_name_: return 0 |
|
695 if self.has_bucket_refill_per_second_ != x.has_bucket_refill_per_second_: return 0 |
|
696 if self.has_bucket_refill_per_second_ and self.bucket_refill_per_second_ != x.bucket_refill_per_second_: return 0 |
|
697 if self.has_bucket_capacity_ != x.has_bucket_capacity_: return 0 |
|
698 if self.has_bucket_capacity_ and self.bucket_capacity_ != x.bucket_capacity_: return 0 |
|
699 if self.has_user_specified_rate_ != x.has_user_specified_rate_: return 0 |
|
700 if self.has_user_specified_rate_ and self.user_specified_rate_ != x.user_specified_rate_: return 0 |
|
701 return 1 |
|
702 |
|
703 def IsInitialized(self, debug_strs=None): |
|
704 initialized = 1 |
|
705 if (not self.has_app_id_): |
|
706 initialized = 0 |
|
707 if debug_strs is not None: |
|
708 debug_strs.append('Required field: app_id not set.') |
|
709 if (not self.has_queue_name_): |
|
710 initialized = 0 |
|
711 if debug_strs is not None: |
|
712 debug_strs.append('Required field: queue_name not set.') |
|
713 if (not self.has_bucket_refill_per_second_): |
|
714 initialized = 0 |
|
715 if debug_strs is not None: |
|
716 debug_strs.append('Required field: bucket_refill_per_second not set.') |
|
717 if (not self.has_bucket_capacity_): |
|
718 initialized = 0 |
|
719 if debug_strs is not None: |
|
720 debug_strs.append('Required field: bucket_capacity not set.') |
|
721 return initialized |
|
722 |
|
723 def ByteSize(self): |
|
724 n = 0 |
|
725 n += self.lengthString(len(self.app_id_)) |
|
726 n += self.lengthString(len(self.queue_name_)) |
|
727 n += self.lengthVarInt64(self.bucket_capacity_) |
|
728 if (self.has_user_specified_rate_): n += 1 + self.lengthString(len(self.user_specified_rate_)) |
|
729 return n + 12 |
|
730 |
|
731 def Clear(self): |
|
732 self.clear_app_id() |
|
733 self.clear_queue_name() |
|
734 self.clear_bucket_refill_per_second() |
|
735 self.clear_bucket_capacity() |
|
736 self.clear_user_specified_rate() |
|
737 |
|
738 def OutputUnchecked(self, out): |
|
739 out.putVarInt32(10) |
|
740 out.putPrefixedString(self.app_id_) |
|
741 out.putVarInt32(18) |
|
742 out.putPrefixedString(self.queue_name_) |
|
743 out.putVarInt32(25) |
|
744 out.putDouble(self.bucket_refill_per_second_) |
|
745 out.putVarInt32(32) |
|
746 out.putVarInt32(self.bucket_capacity_) |
|
747 if (self.has_user_specified_rate_): |
|
748 out.putVarInt32(42) |
|
749 out.putPrefixedString(self.user_specified_rate_) |
|
750 |
|
751 def TryMerge(self, d): |
|
752 while d.avail() > 0: |
|
753 tt = d.getVarInt32() |
|
754 if tt == 10: |
|
755 self.set_app_id(d.getPrefixedString()) |
|
756 continue |
|
757 if tt == 18: |
|
758 self.set_queue_name(d.getPrefixedString()) |
|
759 continue |
|
760 if tt == 25: |
|
761 self.set_bucket_refill_per_second(d.getDouble()) |
|
762 continue |
|
763 if tt == 32: |
|
764 self.set_bucket_capacity(d.getVarInt32()) |
|
765 continue |
|
766 if tt == 42: |
|
767 self.set_user_specified_rate(d.getPrefixedString()) |
|
768 continue |
|
769 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
770 d.skipData(tt) |
|
771 |
|
772 |
|
773 def __str__(self, prefix="", printElemNumber=0): |
|
774 res="" |
|
775 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_)) |
|
776 if self.has_queue_name_: res+=prefix+("queue_name: %s\n" % self.DebugFormatString(self.queue_name_)) |
|
777 if self.has_bucket_refill_per_second_: res+=prefix+("bucket_refill_per_second: %s\n" % self.DebugFormat(self.bucket_refill_per_second_)) |
|
778 if self.has_bucket_capacity_: res+=prefix+("bucket_capacity: %s\n" % self.DebugFormatInt32(self.bucket_capacity_)) |
|
779 if self.has_user_specified_rate_: res+=prefix+("user_specified_rate: %s\n" % self.DebugFormatString(self.user_specified_rate_)) |
|
780 return res |
|
781 |
|
782 kapp_id = 1 |
|
783 kqueue_name = 2 |
|
784 kbucket_refill_per_second = 3 |
|
785 kbucket_capacity = 4 |
|
786 kuser_specified_rate = 5 |
|
787 |
|
788 _TEXT = ( |
|
789 "ErrorCode", |
|
790 "app_id", |
|
791 "queue_name", |
|
792 "bucket_refill_per_second", |
|
793 "bucket_capacity", |
|
794 "user_specified_rate", |
|
795 ) |
|
796 |
|
797 _TYPES = ( |
|
798 ProtocolBuffer.Encoder.NUMERIC, |
|
799 ProtocolBuffer.Encoder.STRING, |
|
800 |
|
801 ProtocolBuffer.Encoder.STRING, |
|
802 |
|
803 ProtocolBuffer.Encoder.DOUBLE, |
|
804 |
|
805 ProtocolBuffer.Encoder.NUMERIC, |
|
806 |
|
807 ProtocolBuffer.Encoder.STRING, |
|
808 |
|
809 ) |
|
810 |
|
811 _STYLE = """""" |
|
812 _STYLE_CONTENT_TYPE = """""" |
|
813 class TaskQueueUpdateQueueResponse(ProtocolBuffer.ProtocolMessage): |
|
814 |
|
815 def __init__(self, contents=None): |
|
816 pass |
|
817 if contents is not None: self.MergeFromString(contents) |
|
818 |
|
819 |
|
820 def MergeFrom(self, x): |
|
821 assert x is not self |
|
822 |
|
823 def Equals(self, x): |
|
824 if x is self: return 1 |
|
825 return 1 |
|
826 |
|
827 def IsInitialized(self, debug_strs=None): |
|
828 initialized = 1 |
|
829 return initialized |
|
830 |
|
831 def ByteSize(self): |
|
832 n = 0 |
|
833 return n + 0 |
|
834 |
|
835 def Clear(self): |
|
836 pass |
|
837 |
|
838 def OutputUnchecked(self, out): |
|
839 pass |
|
840 |
|
841 def TryMerge(self, d): |
|
842 while d.avail() > 0: |
|
843 tt = d.getVarInt32() |
|
844 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
845 d.skipData(tt) |
|
846 |
|
847 |
|
848 def __str__(self, prefix="", printElemNumber=0): |
|
849 res="" |
|
850 return res |
|
851 |
|
852 |
|
853 _TEXT = ( |
|
854 "ErrorCode", |
|
855 ) |
|
856 |
|
857 _TYPES = ( |
|
858 ProtocolBuffer.Encoder.NUMERIC, |
|
859 ) |
|
860 |
|
861 _STYLE = """""" |
|
862 _STYLE_CONTENT_TYPE = """""" |
|
863 class TaskQueueFetchQueuesRequest(ProtocolBuffer.ProtocolMessage): |
|
864 has_app_id_ = 0 |
|
865 app_id_ = "" |
|
866 has_max_rows_ = 0 |
|
867 max_rows_ = 0 |
|
868 |
|
869 def __init__(self, contents=None): |
|
870 if contents is not None: self.MergeFromString(contents) |
|
871 |
|
872 def app_id(self): return self.app_id_ |
|
873 |
|
874 def set_app_id(self, x): |
|
875 self.has_app_id_ = 1 |
|
876 self.app_id_ = x |
|
877 |
|
878 def clear_app_id(self): |
|
879 if self.has_app_id_: |
|
880 self.has_app_id_ = 0 |
|
881 self.app_id_ = "" |
|
882 |
|
883 def has_app_id(self): return self.has_app_id_ |
|
884 |
|
885 def max_rows(self): return self.max_rows_ |
|
886 |
|
887 def set_max_rows(self, x): |
|
888 self.has_max_rows_ = 1 |
|
889 self.max_rows_ = x |
|
890 |
|
891 def clear_max_rows(self): |
|
892 if self.has_max_rows_: |
|
893 self.has_max_rows_ = 0 |
|
894 self.max_rows_ = 0 |
|
895 |
|
896 def has_max_rows(self): return self.has_max_rows_ |
|
897 |
|
898 |
|
899 def MergeFrom(self, x): |
|
900 assert x is not self |
|
901 if (x.has_app_id()): self.set_app_id(x.app_id()) |
|
902 if (x.has_max_rows()): self.set_max_rows(x.max_rows()) |
|
903 |
|
904 def Equals(self, x): |
|
905 if x is self: return 1 |
|
906 if self.has_app_id_ != x.has_app_id_: return 0 |
|
907 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0 |
|
908 if self.has_max_rows_ != x.has_max_rows_: return 0 |
|
909 if self.has_max_rows_ and self.max_rows_ != x.max_rows_: return 0 |
|
910 return 1 |
|
911 |
|
912 def IsInitialized(self, debug_strs=None): |
|
913 initialized = 1 |
|
914 if (not self.has_app_id_): |
|
915 initialized = 0 |
|
916 if debug_strs is not None: |
|
917 debug_strs.append('Required field: app_id not set.') |
|
918 if (not self.has_max_rows_): |
|
919 initialized = 0 |
|
920 if debug_strs is not None: |
|
921 debug_strs.append('Required field: max_rows not set.') |
|
922 return initialized |
|
923 |
|
924 def ByteSize(self): |
|
925 n = 0 |
|
926 n += self.lengthString(len(self.app_id_)) |
|
927 n += self.lengthVarInt64(self.max_rows_) |
|
928 return n + 2 |
|
929 |
|
930 def Clear(self): |
|
931 self.clear_app_id() |
|
932 self.clear_max_rows() |
|
933 |
|
934 def OutputUnchecked(self, out): |
|
935 out.putVarInt32(10) |
|
936 out.putPrefixedString(self.app_id_) |
|
937 out.putVarInt32(16) |
|
938 out.putVarInt32(self.max_rows_) |
|
939 |
|
940 def TryMerge(self, d): |
|
941 while d.avail() > 0: |
|
942 tt = d.getVarInt32() |
|
943 if tt == 10: |
|
944 self.set_app_id(d.getPrefixedString()) |
|
945 continue |
|
946 if tt == 16: |
|
947 self.set_max_rows(d.getVarInt32()) |
|
948 continue |
|
949 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
950 d.skipData(tt) |
|
951 |
|
952 |
|
953 def __str__(self, prefix="", printElemNumber=0): |
|
954 res="" |
|
955 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_)) |
|
956 if self.has_max_rows_: res+=prefix+("max_rows: %s\n" % self.DebugFormatInt32(self.max_rows_)) |
|
957 return res |
|
958 |
|
959 kapp_id = 1 |
|
960 kmax_rows = 2 |
|
961 |
|
962 _TEXT = ( |
|
963 "ErrorCode", |
|
964 "app_id", |
|
965 "max_rows", |
|
966 ) |
|
967 |
|
968 _TYPES = ( |
|
969 ProtocolBuffer.Encoder.NUMERIC, |
|
970 ProtocolBuffer.Encoder.STRING, |
|
971 |
|
972 ProtocolBuffer.Encoder.NUMERIC, |
|
973 |
|
974 ) |
|
975 |
|
976 _STYLE = """""" |
|
977 _STYLE_CONTENT_TYPE = """""" |
|
978 class TaskQueueFetchQueuesResponse_Queue(ProtocolBuffer.ProtocolMessage): |
|
979 has_queue_name_ = 0 |
|
980 queue_name_ = "" |
|
981 has_bucket_refill_per_second_ = 0 |
|
982 bucket_refill_per_second_ = 0.0 |
|
983 has_bucket_capacity_ = 0 |
|
984 bucket_capacity_ = 0.0 |
|
985 has_user_specified_rate_ = 0 |
|
986 user_specified_rate_ = "" |
|
987 |
|
988 def __init__(self, contents=None): |
|
989 if contents is not None: self.MergeFromString(contents) |
|
990 |
|
991 def queue_name(self): return self.queue_name_ |
|
992 |
|
993 def set_queue_name(self, x): |
|
994 self.has_queue_name_ = 1 |
|
995 self.queue_name_ = x |
|
996 |
|
997 def clear_queue_name(self): |
|
998 if self.has_queue_name_: |
|
999 self.has_queue_name_ = 0 |
|
1000 self.queue_name_ = "" |
|
1001 |
|
1002 def has_queue_name(self): return self.has_queue_name_ |
|
1003 |
|
1004 def bucket_refill_per_second(self): return self.bucket_refill_per_second_ |
|
1005 |
|
1006 def set_bucket_refill_per_second(self, x): |
|
1007 self.has_bucket_refill_per_second_ = 1 |
|
1008 self.bucket_refill_per_second_ = x |
|
1009 |
|
1010 def clear_bucket_refill_per_second(self): |
|
1011 if self.has_bucket_refill_per_second_: |
|
1012 self.has_bucket_refill_per_second_ = 0 |
|
1013 self.bucket_refill_per_second_ = 0.0 |
|
1014 |
|
1015 def has_bucket_refill_per_second(self): return self.has_bucket_refill_per_second_ |
|
1016 |
|
1017 def bucket_capacity(self): return self.bucket_capacity_ |
|
1018 |
|
1019 def set_bucket_capacity(self, x): |
|
1020 self.has_bucket_capacity_ = 1 |
|
1021 self.bucket_capacity_ = x |
|
1022 |
|
1023 def clear_bucket_capacity(self): |
|
1024 if self.has_bucket_capacity_: |
|
1025 self.has_bucket_capacity_ = 0 |
|
1026 self.bucket_capacity_ = 0.0 |
|
1027 |
|
1028 def has_bucket_capacity(self): return self.has_bucket_capacity_ |
|
1029 |
|
1030 def user_specified_rate(self): return self.user_specified_rate_ |
|
1031 |
|
1032 def set_user_specified_rate(self, x): |
|
1033 self.has_user_specified_rate_ = 1 |
|
1034 self.user_specified_rate_ = x |
|
1035 |
|
1036 def clear_user_specified_rate(self): |
|
1037 if self.has_user_specified_rate_: |
|
1038 self.has_user_specified_rate_ = 0 |
|
1039 self.user_specified_rate_ = "" |
|
1040 |
|
1041 def has_user_specified_rate(self): return self.has_user_specified_rate_ |
|
1042 |
|
1043 |
|
1044 def MergeFrom(self, x): |
|
1045 assert x is not self |
|
1046 if (x.has_queue_name()): self.set_queue_name(x.queue_name()) |
|
1047 if (x.has_bucket_refill_per_second()): self.set_bucket_refill_per_second(x.bucket_refill_per_second()) |
|
1048 if (x.has_bucket_capacity()): self.set_bucket_capacity(x.bucket_capacity()) |
|
1049 if (x.has_user_specified_rate()): self.set_user_specified_rate(x.user_specified_rate()) |
|
1050 |
|
1051 def Equals(self, x): |
|
1052 if x is self: return 1 |
|
1053 if self.has_queue_name_ != x.has_queue_name_: return 0 |
|
1054 if self.has_queue_name_ and self.queue_name_ != x.queue_name_: return 0 |
|
1055 if self.has_bucket_refill_per_second_ != x.has_bucket_refill_per_second_: return 0 |
|
1056 if self.has_bucket_refill_per_second_ and self.bucket_refill_per_second_ != x.bucket_refill_per_second_: return 0 |
|
1057 if self.has_bucket_capacity_ != x.has_bucket_capacity_: return 0 |
|
1058 if self.has_bucket_capacity_ and self.bucket_capacity_ != x.bucket_capacity_: return 0 |
|
1059 if self.has_user_specified_rate_ != x.has_user_specified_rate_: return 0 |
|
1060 if self.has_user_specified_rate_ and self.user_specified_rate_ != x.user_specified_rate_: return 0 |
|
1061 return 1 |
|
1062 |
|
1063 def IsInitialized(self, debug_strs=None): |
|
1064 initialized = 1 |
|
1065 if (not self.has_queue_name_): |
|
1066 initialized = 0 |
|
1067 if debug_strs is not None: |
|
1068 debug_strs.append('Required field: queue_name not set.') |
|
1069 if (not self.has_bucket_refill_per_second_): |
|
1070 initialized = 0 |
|
1071 if debug_strs is not None: |
|
1072 debug_strs.append('Required field: bucket_refill_per_second not set.') |
|
1073 if (not self.has_bucket_capacity_): |
|
1074 initialized = 0 |
|
1075 if debug_strs is not None: |
|
1076 debug_strs.append('Required field: bucket_capacity not set.') |
|
1077 return initialized |
|
1078 |
|
1079 def ByteSize(self): |
|
1080 n = 0 |
|
1081 n += self.lengthString(len(self.queue_name_)) |
|
1082 if (self.has_user_specified_rate_): n += 1 + self.lengthString(len(self.user_specified_rate_)) |
|
1083 return n + 19 |
|
1084 |
|
1085 def Clear(self): |
|
1086 self.clear_queue_name() |
|
1087 self.clear_bucket_refill_per_second() |
|
1088 self.clear_bucket_capacity() |
|
1089 self.clear_user_specified_rate() |
|
1090 |
|
1091 def OutputUnchecked(self, out): |
|
1092 out.putVarInt32(18) |
|
1093 out.putPrefixedString(self.queue_name_) |
|
1094 out.putVarInt32(25) |
|
1095 out.putDouble(self.bucket_refill_per_second_) |
|
1096 out.putVarInt32(33) |
|
1097 out.putDouble(self.bucket_capacity_) |
|
1098 if (self.has_user_specified_rate_): |
|
1099 out.putVarInt32(42) |
|
1100 out.putPrefixedString(self.user_specified_rate_) |
|
1101 |
|
1102 def TryMerge(self, d): |
|
1103 while 1: |
|
1104 tt = d.getVarInt32() |
|
1105 if tt == 12: break |
|
1106 if tt == 18: |
|
1107 self.set_queue_name(d.getPrefixedString()) |
|
1108 continue |
|
1109 if tt == 25: |
|
1110 self.set_bucket_refill_per_second(d.getDouble()) |
|
1111 continue |
|
1112 if tt == 33: |
|
1113 self.set_bucket_capacity(d.getDouble()) |
|
1114 continue |
|
1115 if tt == 42: |
|
1116 self.set_user_specified_rate(d.getPrefixedString()) |
|
1117 continue |
|
1118 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1119 d.skipData(tt) |
|
1120 |
|
1121 |
|
1122 def __str__(self, prefix="", printElemNumber=0): |
|
1123 res="" |
|
1124 if self.has_queue_name_: res+=prefix+("queue_name: %s\n" % self.DebugFormatString(self.queue_name_)) |
|
1125 if self.has_bucket_refill_per_second_: res+=prefix+("bucket_refill_per_second: %s\n" % self.DebugFormat(self.bucket_refill_per_second_)) |
|
1126 if self.has_bucket_capacity_: res+=prefix+("bucket_capacity: %s\n" % self.DebugFormat(self.bucket_capacity_)) |
|
1127 if self.has_user_specified_rate_: res+=prefix+("user_specified_rate: %s\n" % self.DebugFormatString(self.user_specified_rate_)) |
|
1128 return res |
|
1129 |
|
1130 class TaskQueueFetchQueuesResponse(ProtocolBuffer.ProtocolMessage): |
|
1131 |
|
1132 def __init__(self, contents=None): |
|
1133 self.queue_ = [] |
|
1134 if contents is not None: self.MergeFromString(contents) |
|
1135 |
|
1136 def queue_size(self): return len(self.queue_) |
|
1137 def queue_list(self): return self.queue_ |
|
1138 |
|
1139 def queue(self, i): |
|
1140 return self.queue_[i] |
|
1141 |
|
1142 def mutable_queue(self, i): |
|
1143 return self.queue_[i] |
|
1144 |
|
1145 def add_queue(self): |
|
1146 x = TaskQueueFetchQueuesResponse_Queue() |
|
1147 self.queue_.append(x) |
|
1148 return x |
|
1149 |
|
1150 def clear_queue(self): |
|
1151 self.queue_ = [] |
|
1152 |
|
1153 def MergeFrom(self, x): |
|
1154 assert x is not self |
|
1155 for i in xrange(x.queue_size()): self.add_queue().CopyFrom(x.queue(i)) |
|
1156 |
|
1157 def Equals(self, x): |
|
1158 if x is self: return 1 |
|
1159 if len(self.queue_) != len(x.queue_): return 0 |
|
1160 for e1, e2 in zip(self.queue_, x.queue_): |
|
1161 if e1 != e2: return 0 |
|
1162 return 1 |
|
1163 |
|
1164 def IsInitialized(self, debug_strs=None): |
|
1165 initialized = 1 |
|
1166 for p in self.queue_: |
|
1167 if not p.IsInitialized(debug_strs): initialized=0 |
|
1168 return initialized |
|
1169 |
|
1170 def ByteSize(self): |
|
1171 n = 0 |
|
1172 n += 2 * len(self.queue_) |
|
1173 for i in xrange(len(self.queue_)): n += self.queue_[i].ByteSize() |
|
1174 return n + 0 |
|
1175 |
|
1176 def Clear(self): |
|
1177 self.clear_queue() |
|
1178 |
|
1179 def OutputUnchecked(self, out): |
|
1180 for i in xrange(len(self.queue_)): |
|
1181 out.putVarInt32(11) |
|
1182 self.queue_[i].OutputUnchecked(out) |
|
1183 out.putVarInt32(12) |
|
1184 |
|
1185 def TryMerge(self, d): |
|
1186 while d.avail() > 0: |
|
1187 tt = d.getVarInt32() |
|
1188 if tt == 11: |
|
1189 self.add_queue().TryMerge(d) |
|
1190 continue |
|
1191 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1192 d.skipData(tt) |
|
1193 |
|
1194 |
|
1195 def __str__(self, prefix="", printElemNumber=0): |
|
1196 res="" |
|
1197 cnt=0 |
|
1198 for e in self.queue_: |
|
1199 elm="" |
|
1200 if printElemNumber: elm="(%d)" % cnt |
|
1201 res+=prefix+("Queue%s {\n" % elm) |
|
1202 res+=e.__str__(prefix + " ", printElemNumber) |
|
1203 res+=prefix+"}\n" |
|
1204 cnt+=1 |
|
1205 return res |
|
1206 |
|
1207 kQueueGroup = 1 |
|
1208 kQueuequeue_name = 2 |
|
1209 kQueuebucket_refill_per_second = 3 |
|
1210 kQueuebucket_capacity = 4 |
|
1211 kQueueuser_specified_rate = 5 |
|
1212 |
|
1213 _TEXT = ( |
|
1214 "ErrorCode", |
|
1215 "Queue", |
|
1216 "queue_name", |
|
1217 "bucket_refill_per_second", |
|
1218 "bucket_capacity", |
|
1219 "user_specified_rate", |
|
1220 ) |
|
1221 |
|
1222 _TYPES = ( |
|
1223 ProtocolBuffer.Encoder.NUMERIC, |
|
1224 ProtocolBuffer.Encoder.STARTGROUP, |
|
1225 |
|
1226 ProtocolBuffer.Encoder.STRING, |
|
1227 |
|
1228 ProtocolBuffer.Encoder.DOUBLE, |
|
1229 |
|
1230 ProtocolBuffer.Encoder.DOUBLE, |
|
1231 |
|
1232 ProtocolBuffer.Encoder.STRING, |
|
1233 |
|
1234 ) |
|
1235 |
|
1236 _STYLE = """""" |
|
1237 _STYLE_CONTENT_TYPE = """""" |
|
1238 class TaskQueueFetchQueueStatsRequest(ProtocolBuffer.ProtocolMessage): |
|
1239 has_app_id_ = 0 |
|
1240 app_id_ = "" |
|
1241 has_max_num_tasks_ = 0 |
|
1242 max_num_tasks_ = 0 |
|
1243 |
|
1244 def __init__(self, contents=None): |
|
1245 self.queue_name_ = [] |
|
1246 if contents is not None: self.MergeFromString(contents) |
|
1247 |
|
1248 def app_id(self): return self.app_id_ |
|
1249 |
|
1250 def set_app_id(self, x): |
|
1251 self.has_app_id_ = 1 |
|
1252 self.app_id_ = x |
|
1253 |
|
1254 def clear_app_id(self): |
|
1255 if self.has_app_id_: |
|
1256 self.has_app_id_ = 0 |
|
1257 self.app_id_ = "" |
|
1258 |
|
1259 def has_app_id(self): return self.has_app_id_ |
|
1260 |
|
1261 def queue_name_size(self): return len(self.queue_name_) |
|
1262 def queue_name_list(self): return self.queue_name_ |
|
1263 |
|
1264 def queue_name(self, i): |
|
1265 return self.queue_name_[i] |
|
1266 |
|
1267 def set_queue_name(self, i, x): |
|
1268 self.queue_name_[i] = x |
|
1269 |
|
1270 def add_queue_name(self, x): |
|
1271 self.queue_name_.append(x) |
|
1272 |
|
1273 def clear_queue_name(self): |
|
1274 self.queue_name_ = [] |
|
1275 |
|
1276 def max_num_tasks(self): return self.max_num_tasks_ |
|
1277 |
|
1278 def set_max_num_tasks(self, x): |
|
1279 self.has_max_num_tasks_ = 1 |
|
1280 self.max_num_tasks_ = x |
|
1281 |
|
1282 def clear_max_num_tasks(self): |
|
1283 if self.has_max_num_tasks_: |
|
1284 self.has_max_num_tasks_ = 0 |
|
1285 self.max_num_tasks_ = 0 |
|
1286 |
|
1287 def has_max_num_tasks(self): return self.has_max_num_tasks_ |
|
1288 |
|
1289 |
|
1290 def MergeFrom(self, x): |
|
1291 assert x is not self |
|
1292 if (x.has_app_id()): self.set_app_id(x.app_id()) |
|
1293 for i in xrange(x.queue_name_size()): self.add_queue_name(x.queue_name(i)) |
|
1294 if (x.has_max_num_tasks()): self.set_max_num_tasks(x.max_num_tasks()) |
|
1295 |
|
1296 def Equals(self, x): |
|
1297 if x is self: return 1 |
|
1298 if self.has_app_id_ != x.has_app_id_: return 0 |
|
1299 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0 |
|
1300 if len(self.queue_name_) != len(x.queue_name_): return 0 |
|
1301 for e1, e2 in zip(self.queue_name_, x.queue_name_): |
|
1302 if e1 != e2: return 0 |
|
1303 if self.has_max_num_tasks_ != x.has_max_num_tasks_: return 0 |
|
1304 if self.has_max_num_tasks_ and self.max_num_tasks_ != x.max_num_tasks_: return 0 |
|
1305 return 1 |
|
1306 |
|
1307 def IsInitialized(self, debug_strs=None): |
|
1308 initialized = 1 |
|
1309 if (not self.has_app_id_): |
|
1310 initialized = 0 |
|
1311 if debug_strs is not None: |
|
1312 debug_strs.append('Required field: app_id not set.') |
|
1313 if (not self.has_max_num_tasks_): |
|
1314 initialized = 0 |
|
1315 if debug_strs is not None: |
|
1316 debug_strs.append('Required field: max_num_tasks not set.') |
|
1317 return initialized |
|
1318 |
|
1319 def ByteSize(self): |
|
1320 n = 0 |
|
1321 n += self.lengthString(len(self.app_id_)) |
|
1322 n += 1 * len(self.queue_name_) |
|
1323 for i in xrange(len(self.queue_name_)): n += self.lengthString(len(self.queue_name_[i])) |
|
1324 n += self.lengthVarInt64(self.max_num_tasks_) |
|
1325 return n + 2 |
|
1326 |
|
1327 def Clear(self): |
|
1328 self.clear_app_id() |
|
1329 self.clear_queue_name() |
|
1330 self.clear_max_num_tasks() |
|
1331 |
|
1332 def OutputUnchecked(self, out): |
|
1333 out.putVarInt32(10) |
|
1334 out.putPrefixedString(self.app_id_) |
|
1335 for i in xrange(len(self.queue_name_)): |
|
1336 out.putVarInt32(18) |
|
1337 out.putPrefixedString(self.queue_name_[i]) |
|
1338 out.putVarInt32(24) |
|
1339 out.putVarInt32(self.max_num_tasks_) |
|
1340 |
|
1341 def TryMerge(self, d): |
|
1342 while d.avail() > 0: |
|
1343 tt = d.getVarInt32() |
|
1344 if tt == 10: |
|
1345 self.set_app_id(d.getPrefixedString()) |
|
1346 continue |
|
1347 if tt == 18: |
|
1348 self.add_queue_name(d.getPrefixedString()) |
|
1349 continue |
|
1350 if tt == 24: |
|
1351 self.set_max_num_tasks(d.getVarInt32()) |
|
1352 continue |
|
1353 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1354 d.skipData(tt) |
|
1355 |
|
1356 |
|
1357 def __str__(self, prefix="", printElemNumber=0): |
|
1358 res="" |
|
1359 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_)) |
|
1360 cnt=0 |
|
1361 for e in self.queue_name_: |
|
1362 elm="" |
|
1363 if printElemNumber: elm="(%d)" % cnt |
|
1364 res+=prefix+("queue_name%s: %s\n" % (elm, self.DebugFormatString(e))) |
|
1365 cnt+=1 |
|
1366 if self.has_max_num_tasks_: res+=prefix+("max_num_tasks: %s\n" % self.DebugFormatInt32(self.max_num_tasks_)) |
|
1367 return res |
|
1368 |
|
1369 kapp_id = 1 |
|
1370 kqueue_name = 2 |
|
1371 kmax_num_tasks = 3 |
|
1372 |
|
1373 _TEXT = ( |
|
1374 "ErrorCode", |
|
1375 "app_id", |
|
1376 "queue_name", |
|
1377 "max_num_tasks", |
|
1378 ) |
|
1379 |
|
1380 _TYPES = ( |
|
1381 ProtocolBuffer.Encoder.NUMERIC, |
|
1382 ProtocolBuffer.Encoder.STRING, |
|
1383 |
|
1384 ProtocolBuffer.Encoder.STRING, |
|
1385 |
|
1386 ProtocolBuffer.Encoder.NUMERIC, |
|
1387 |
|
1388 ) |
|
1389 |
|
1390 _STYLE = """""" |
|
1391 _STYLE_CONTENT_TYPE = """""" |
|
1392 class TaskQueueFetchQueueStatsResponse_QueueStats(ProtocolBuffer.ProtocolMessage): |
|
1393 has_num_tasks_ = 0 |
|
1394 num_tasks_ = 0 |
|
1395 has_oldest_eta_usec_ = 0 |
|
1396 oldest_eta_usec_ = 0 |
|
1397 |
|
1398 def __init__(self, contents=None): |
|
1399 if contents is not None: self.MergeFromString(contents) |
|
1400 |
|
1401 def num_tasks(self): return self.num_tasks_ |
|
1402 |
|
1403 def set_num_tasks(self, x): |
|
1404 self.has_num_tasks_ = 1 |
|
1405 self.num_tasks_ = x |
|
1406 |
|
1407 def clear_num_tasks(self): |
|
1408 if self.has_num_tasks_: |
|
1409 self.has_num_tasks_ = 0 |
|
1410 self.num_tasks_ = 0 |
|
1411 |
|
1412 def has_num_tasks(self): return self.has_num_tasks_ |
|
1413 |
|
1414 def oldest_eta_usec(self): return self.oldest_eta_usec_ |
|
1415 |
|
1416 def set_oldest_eta_usec(self, x): |
|
1417 self.has_oldest_eta_usec_ = 1 |
|
1418 self.oldest_eta_usec_ = x |
|
1419 |
|
1420 def clear_oldest_eta_usec(self): |
|
1421 if self.has_oldest_eta_usec_: |
|
1422 self.has_oldest_eta_usec_ = 0 |
|
1423 self.oldest_eta_usec_ = 0 |
|
1424 |
|
1425 def has_oldest_eta_usec(self): return self.has_oldest_eta_usec_ |
|
1426 |
|
1427 |
|
1428 def MergeFrom(self, x): |
|
1429 assert x is not self |
|
1430 if (x.has_num_tasks()): self.set_num_tasks(x.num_tasks()) |
|
1431 if (x.has_oldest_eta_usec()): self.set_oldest_eta_usec(x.oldest_eta_usec()) |
|
1432 |
|
1433 def Equals(self, x): |
|
1434 if x is self: return 1 |
|
1435 if self.has_num_tasks_ != x.has_num_tasks_: return 0 |
|
1436 if self.has_num_tasks_ and self.num_tasks_ != x.num_tasks_: return 0 |
|
1437 if self.has_oldest_eta_usec_ != x.has_oldest_eta_usec_: return 0 |
|
1438 if self.has_oldest_eta_usec_ and self.oldest_eta_usec_ != x.oldest_eta_usec_: return 0 |
|
1439 return 1 |
|
1440 |
|
1441 def IsInitialized(self, debug_strs=None): |
|
1442 initialized = 1 |
|
1443 if (not self.has_num_tasks_): |
|
1444 initialized = 0 |
|
1445 if debug_strs is not None: |
|
1446 debug_strs.append('Required field: num_tasks not set.') |
|
1447 if (not self.has_oldest_eta_usec_): |
|
1448 initialized = 0 |
|
1449 if debug_strs is not None: |
|
1450 debug_strs.append('Required field: oldest_eta_usec not set.') |
|
1451 return initialized |
|
1452 |
|
1453 def ByteSize(self): |
|
1454 n = 0 |
|
1455 n += self.lengthVarInt64(self.num_tasks_) |
|
1456 n += self.lengthVarInt64(self.oldest_eta_usec_) |
|
1457 return n + 2 |
|
1458 |
|
1459 def Clear(self): |
|
1460 self.clear_num_tasks() |
|
1461 self.clear_oldest_eta_usec() |
|
1462 |
|
1463 def OutputUnchecked(self, out): |
|
1464 out.putVarInt32(16) |
|
1465 out.putVarInt32(self.num_tasks_) |
|
1466 out.putVarInt32(24) |
|
1467 out.putVarInt64(self.oldest_eta_usec_) |
|
1468 |
|
1469 def TryMerge(self, d): |
|
1470 while 1: |
|
1471 tt = d.getVarInt32() |
|
1472 if tt == 12: break |
|
1473 if tt == 16: |
|
1474 self.set_num_tasks(d.getVarInt32()) |
|
1475 continue |
|
1476 if tt == 24: |
|
1477 self.set_oldest_eta_usec(d.getVarInt64()) |
|
1478 continue |
|
1479 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1480 d.skipData(tt) |
|
1481 |
|
1482 |
|
1483 def __str__(self, prefix="", printElemNumber=0): |
|
1484 res="" |
|
1485 if self.has_num_tasks_: res+=prefix+("num_tasks: %s\n" % self.DebugFormatInt32(self.num_tasks_)) |
|
1486 if self.has_oldest_eta_usec_: res+=prefix+("oldest_eta_usec: %s\n" % self.DebugFormatInt64(self.oldest_eta_usec_)) |
|
1487 return res |
|
1488 |
|
1489 class TaskQueueFetchQueueStatsResponse(ProtocolBuffer.ProtocolMessage): |
|
1490 |
|
1491 def __init__(self, contents=None): |
|
1492 self.queuestats_ = [] |
|
1493 if contents is not None: self.MergeFromString(contents) |
|
1494 |
|
1495 def queuestats_size(self): return len(self.queuestats_) |
|
1496 def queuestats_list(self): return self.queuestats_ |
|
1497 |
|
1498 def queuestats(self, i): |
|
1499 return self.queuestats_[i] |
|
1500 |
|
1501 def mutable_queuestats(self, i): |
|
1502 return self.queuestats_[i] |
|
1503 |
|
1504 def add_queuestats(self): |
|
1505 x = TaskQueueFetchQueueStatsResponse_QueueStats() |
|
1506 self.queuestats_.append(x) |
|
1507 return x |
|
1508 |
|
1509 def clear_queuestats(self): |
|
1510 self.queuestats_ = [] |
|
1511 |
|
1512 def MergeFrom(self, x): |
|
1513 assert x is not self |
|
1514 for i in xrange(x.queuestats_size()): self.add_queuestats().CopyFrom(x.queuestats(i)) |
|
1515 |
|
1516 def Equals(self, x): |
|
1517 if x is self: return 1 |
|
1518 if len(self.queuestats_) != len(x.queuestats_): return 0 |
|
1519 for e1, e2 in zip(self.queuestats_, x.queuestats_): |
|
1520 if e1 != e2: return 0 |
|
1521 return 1 |
|
1522 |
|
1523 def IsInitialized(self, debug_strs=None): |
|
1524 initialized = 1 |
|
1525 for p in self.queuestats_: |
|
1526 if not p.IsInitialized(debug_strs): initialized=0 |
|
1527 return initialized |
|
1528 |
|
1529 def ByteSize(self): |
|
1530 n = 0 |
|
1531 n += 2 * len(self.queuestats_) |
|
1532 for i in xrange(len(self.queuestats_)): n += self.queuestats_[i].ByteSize() |
|
1533 return n + 0 |
|
1534 |
|
1535 def Clear(self): |
|
1536 self.clear_queuestats() |
|
1537 |
|
1538 def OutputUnchecked(self, out): |
|
1539 for i in xrange(len(self.queuestats_)): |
|
1540 out.putVarInt32(11) |
|
1541 self.queuestats_[i].OutputUnchecked(out) |
|
1542 out.putVarInt32(12) |
|
1543 |
|
1544 def TryMerge(self, d): |
|
1545 while d.avail() > 0: |
|
1546 tt = d.getVarInt32() |
|
1547 if tt == 11: |
|
1548 self.add_queuestats().TryMerge(d) |
|
1549 continue |
|
1550 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError |
|
1551 d.skipData(tt) |
|
1552 |
|
1553 |
|
1554 def __str__(self, prefix="", printElemNumber=0): |
|
1555 res="" |
|
1556 cnt=0 |
|
1557 for e in self.queuestats_: |
|
1558 elm="" |
|
1559 if printElemNumber: elm="(%d)" % cnt |
|
1560 res+=prefix+("QueueStats%s {\n" % elm) |
|
1561 res+=e.__str__(prefix + " ", printElemNumber) |
|
1562 res+=prefix+"}\n" |
|
1563 cnt+=1 |
|
1564 return res |
|
1565 |
|
1566 kQueueStatsGroup = 1 |
|
1567 kQueueStatsnum_tasks = 2 |
|
1568 kQueueStatsoldest_eta_usec = 3 |
|
1569 |
|
1570 _TEXT = ( |
|
1571 "ErrorCode", |
|
1572 "QueueStats", |
|
1573 "num_tasks", |
|
1574 "oldest_eta_usec", |
|
1575 ) |
|
1576 |
|
1577 _TYPES = ( |
|
1578 ProtocolBuffer.Encoder.NUMERIC, |
|
1579 ProtocolBuffer.Encoder.STARTGROUP, |
|
1580 |
|
1581 ProtocolBuffer.Encoder.NUMERIC, |
|
1582 |
|
1583 ProtocolBuffer.Encoder.NUMERIC, |
|
1584 |
|
1585 ) |
|
1586 |
|
1587 _STYLE = """""" |
|
1588 _STYLE_CONTENT_TYPE = """""" |
|
1589 |
|
1590 __all__ = ['TaskQueueServiceError','TaskQueueAddRequest','TaskQueueAddRequest_Header','TaskQueueAddResponse','TaskQueueUpdateQueueRequest','TaskQueueUpdateQueueResponse','TaskQueueFetchQueuesRequest','TaskQueueFetchQueuesResponse','TaskQueueFetchQueuesResponse_Queue','TaskQueueFetchQueueStatsRequest','TaskQueueFetchQueueStatsResponse','TaskQueueFetchQueueStatsResponse_QueueStats'] |