App Engine Python SDK version 1.8.9
[gae.git] / python / google / appengine / datastore / datastore_pb.py
blob5ba578f49d68a9805f19024f2b27558389a616ae
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
20 from google.net.proto import ProtocolBuffer
21 import array
22 import dummy_thread as thread
24 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
25 unusednames=printElemNumber,debug_strs no-special"""
27 if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
28 _extension_runtime = True
29 _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage
30 else:
31 _extension_runtime = False
32 _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage
34 from google.appengine.api.api_base_pb import Integer64Proto;
35 from google.appengine.api.api_base_pb import StringProto;
36 from google.appengine.api.api_base_pb import VoidProto;
37 from google.appengine.datastore.action_pb import Action
38 from google.appengine.datastore.entity_pb import CompositeIndex
39 from google.appengine.datastore.entity_pb import EntityProto
40 from google.appengine.datastore.entity_pb import Index
41 from google.appengine.datastore.entity_pb import Property
42 from google.appengine.datastore.entity_pb import PropertyValue
43 from google.appengine.datastore.entity_pb import Path
44 from google.appengine.datastore.entity_pb import Reference
45 from google.appengine.datastore.snapshot_pb import Snapshot
46 class Transaction(ProtocolBuffer.ProtocolMessage):
47 has_handle_ = 0
48 handle_ = 0
49 has_app_ = 0
50 app_ = ""
51 has_mark_changes_ = 0
52 mark_changes_ = 0
54 def __init__(self, contents=None):
55 if contents is not None: self.MergeFromString(contents)
57 def handle(self): return self.handle_
59 def set_handle(self, x):
60 self.has_handle_ = 1
61 self.handle_ = x
63 def clear_handle(self):
64 if self.has_handle_:
65 self.has_handle_ = 0
66 self.handle_ = 0
68 def has_handle(self): return self.has_handle_
70 def app(self): return self.app_
72 def set_app(self, x):
73 self.has_app_ = 1
74 self.app_ = x
76 def clear_app(self):
77 if self.has_app_:
78 self.has_app_ = 0
79 self.app_ = ""
81 def has_app(self): return self.has_app_
83 def mark_changes(self): return self.mark_changes_
85 def set_mark_changes(self, x):
86 self.has_mark_changes_ = 1
87 self.mark_changes_ = x
89 def clear_mark_changes(self):
90 if self.has_mark_changes_:
91 self.has_mark_changes_ = 0
92 self.mark_changes_ = 0
94 def has_mark_changes(self): return self.has_mark_changes_
97 def MergeFrom(self, x):
98 assert x is not self
99 if (x.has_handle()): self.set_handle(x.handle())
100 if (x.has_app()): self.set_app(x.app())
101 if (x.has_mark_changes()): self.set_mark_changes(x.mark_changes())
103 def Equals(self, x):
104 if x is self: return 1
105 if self.has_handle_ != x.has_handle_: return 0
106 if self.has_handle_ and self.handle_ != x.handle_: return 0
107 if self.has_app_ != x.has_app_: return 0
108 if self.has_app_ and self.app_ != x.app_: return 0
109 if self.has_mark_changes_ != x.has_mark_changes_: return 0
110 if self.has_mark_changes_ and self.mark_changes_ != x.mark_changes_: return 0
111 return 1
113 def IsInitialized(self, debug_strs=None):
114 initialized = 1
115 if (not self.has_handle_):
116 initialized = 0
117 if debug_strs is not None:
118 debug_strs.append('Required field: handle not set.')
119 if (not self.has_app_):
120 initialized = 0
121 if debug_strs is not None:
122 debug_strs.append('Required field: app not set.')
123 return initialized
125 def ByteSize(self):
126 n = 0
127 n += self.lengthString(len(self.app_))
128 if (self.has_mark_changes_): n += 2
129 return n + 10
131 def ByteSizePartial(self):
132 n = 0
133 if (self.has_handle_):
134 n += 9
135 if (self.has_app_):
136 n += 1
137 n += self.lengthString(len(self.app_))
138 if (self.has_mark_changes_): n += 2
139 return n
141 def Clear(self):
142 self.clear_handle()
143 self.clear_app()
144 self.clear_mark_changes()
146 def OutputUnchecked(self, out):
147 out.putVarInt32(9)
148 out.put64(self.handle_)
149 out.putVarInt32(18)
150 out.putPrefixedString(self.app_)
151 if (self.has_mark_changes_):
152 out.putVarInt32(24)
153 out.putBoolean(self.mark_changes_)
155 def OutputPartial(self, out):
156 if (self.has_handle_):
157 out.putVarInt32(9)
158 out.put64(self.handle_)
159 if (self.has_app_):
160 out.putVarInt32(18)
161 out.putPrefixedString(self.app_)
162 if (self.has_mark_changes_):
163 out.putVarInt32(24)
164 out.putBoolean(self.mark_changes_)
166 def TryMerge(self, d):
167 while d.avail() > 0:
168 tt = d.getVarInt32()
169 if tt == 9:
170 self.set_handle(d.get64())
171 continue
172 if tt == 18:
173 self.set_app(d.getPrefixedString())
174 continue
175 if tt == 24:
176 self.set_mark_changes(d.getBoolean())
177 continue
180 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
181 d.skipData(tt)
184 def __str__(self, prefix="", printElemNumber=0):
185 res=""
186 if self.has_handle_: res+=prefix+("handle: %s\n" % self.DebugFormatFixed64(self.handle_))
187 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_))
188 if self.has_mark_changes_: res+=prefix+("mark_changes: %s\n" % self.DebugFormatBool(self.mark_changes_))
189 return res
192 def _BuildTagLookupTable(sparse, maxtag, default=None):
193 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
195 khandle = 1
196 kapp = 2
197 kmark_changes = 3
199 _TEXT = _BuildTagLookupTable({
200 0: "ErrorCode",
201 1: "handle",
202 2: "app",
203 3: "mark_changes",
204 }, 3)
206 _TYPES = _BuildTagLookupTable({
207 0: ProtocolBuffer.Encoder.NUMERIC,
208 1: ProtocolBuffer.Encoder.DOUBLE,
209 2: ProtocolBuffer.Encoder.STRING,
210 3: ProtocolBuffer.Encoder.NUMERIC,
211 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
214 _STYLE = """"""
215 _STYLE_CONTENT_TYPE = """"""
216 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.Transaction'
217 class Query_Filter(ProtocolBuffer.ProtocolMessage):
220 LESS_THAN = 1
221 LESS_THAN_OR_EQUAL = 2
222 GREATER_THAN = 3
223 GREATER_THAN_OR_EQUAL = 4
224 EQUAL = 5
225 IN = 6
226 EXISTS = 7
228 _Operator_NAMES = {
229 1: "LESS_THAN",
230 2: "LESS_THAN_OR_EQUAL",
231 3: "GREATER_THAN",
232 4: "GREATER_THAN_OR_EQUAL",
233 5: "EQUAL",
234 6: "IN",
235 7: "EXISTS",
238 def Operator_Name(cls, x): return cls._Operator_NAMES.get(x, "")
239 Operator_Name = classmethod(Operator_Name)
241 has_op_ = 0
242 op_ = 0
244 def __init__(self, contents=None):
245 self.property_ = []
246 if contents is not None: self.MergeFromString(contents)
248 def op(self): return self.op_
250 def set_op(self, x):
251 self.has_op_ = 1
252 self.op_ = x
254 def clear_op(self):
255 if self.has_op_:
256 self.has_op_ = 0
257 self.op_ = 0
259 def has_op(self): return self.has_op_
261 def property_size(self): return len(self.property_)
262 def property_list(self): return self.property_
264 def property(self, i):
265 return self.property_[i]
267 def mutable_property(self, i):
268 return self.property_[i]
270 def add_property(self):
271 x = Property()
272 self.property_.append(x)
273 return x
275 def clear_property(self):
276 self.property_ = []
278 def MergeFrom(self, x):
279 assert x is not self
280 if (x.has_op()): self.set_op(x.op())
281 for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i))
283 def Equals(self, x):
284 if x is self: return 1
285 if self.has_op_ != x.has_op_: return 0
286 if self.has_op_ and self.op_ != x.op_: return 0
287 if len(self.property_) != len(x.property_): return 0
288 for e1, e2 in zip(self.property_, x.property_):
289 if e1 != e2: return 0
290 return 1
292 def IsInitialized(self, debug_strs=None):
293 initialized = 1
294 if (not self.has_op_):
295 initialized = 0
296 if debug_strs is not None:
297 debug_strs.append('Required field: op not set.')
298 for p in self.property_:
299 if not p.IsInitialized(debug_strs): initialized=0
300 return initialized
302 def ByteSize(self):
303 n = 0
304 n += self.lengthVarInt64(self.op_)
305 n += 1 * len(self.property_)
306 for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSize())
307 return n + 1
309 def ByteSizePartial(self):
310 n = 0
311 if (self.has_op_):
312 n += 1
313 n += self.lengthVarInt64(self.op_)
314 n += 1 * len(self.property_)
315 for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSizePartial())
316 return n
318 def Clear(self):
319 self.clear_op()
320 self.clear_property()
322 def OutputUnchecked(self, out):
323 out.putVarInt32(48)
324 out.putVarInt32(self.op_)
325 for i in xrange(len(self.property_)):
326 out.putVarInt32(114)
327 out.putVarInt32(self.property_[i].ByteSize())
328 self.property_[i].OutputUnchecked(out)
330 def OutputPartial(self, out):
331 if (self.has_op_):
332 out.putVarInt32(48)
333 out.putVarInt32(self.op_)
334 for i in xrange(len(self.property_)):
335 out.putVarInt32(114)
336 out.putVarInt32(self.property_[i].ByteSizePartial())
337 self.property_[i].OutputPartial(out)
339 def TryMerge(self, d):
340 while 1:
341 tt = d.getVarInt32()
342 if tt == 36: break
343 if tt == 48:
344 self.set_op(d.getVarInt32())
345 continue
346 if tt == 114:
347 length = d.getVarInt32()
348 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
349 d.skip(length)
350 self.add_property().TryMerge(tmp)
351 continue
354 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
355 d.skipData(tt)
358 def __str__(self, prefix="", printElemNumber=0):
359 res=""
360 if self.has_op_: res+=prefix+("op: %s\n" % self.DebugFormatInt32(self.op_))
361 cnt=0
362 for e in self.property_:
363 elm=""
364 if printElemNumber: elm="(%d)" % cnt
365 res+=prefix+("property%s <\n" % elm)
366 res+=e.__str__(prefix + " ", printElemNumber)
367 res+=prefix+">\n"
368 cnt+=1
369 return res
371 class Query_Order(ProtocolBuffer.ProtocolMessage):
374 ASCENDING = 1
375 DESCENDING = 2
377 _Direction_NAMES = {
378 1: "ASCENDING",
379 2: "DESCENDING",
382 def Direction_Name(cls, x): return cls._Direction_NAMES.get(x, "")
383 Direction_Name = classmethod(Direction_Name)
385 has_property_ = 0
386 property_ = ""
387 has_direction_ = 0
388 direction_ = 1
390 def __init__(self, contents=None):
391 if contents is not None: self.MergeFromString(contents)
393 def property(self): return self.property_
395 def set_property(self, x):
396 self.has_property_ = 1
397 self.property_ = x
399 def clear_property(self):
400 if self.has_property_:
401 self.has_property_ = 0
402 self.property_ = ""
404 def has_property(self): return self.has_property_
406 def direction(self): return self.direction_
408 def set_direction(self, x):
409 self.has_direction_ = 1
410 self.direction_ = x
412 def clear_direction(self):
413 if self.has_direction_:
414 self.has_direction_ = 0
415 self.direction_ = 1
417 def has_direction(self): return self.has_direction_
420 def MergeFrom(self, x):
421 assert x is not self
422 if (x.has_property()): self.set_property(x.property())
423 if (x.has_direction()): self.set_direction(x.direction())
425 def Equals(self, x):
426 if x is self: return 1
427 if self.has_property_ != x.has_property_: return 0
428 if self.has_property_ and self.property_ != x.property_: return 0
429 if self.has_direction_ != x.has_direction_: return 0
430 if self.has_direction_ and self.direction_ != x.direction_: return 0
431 return 1
433 def IsInitialized(self, debug_strs=None):
434 initialized = 1
435 if (not self.has_property_):
436 initialized = 0
437 if debug_strs is not None:
438 debug_strs.append('Required field: property not set.')
439 return initialized
441 def ByteSize(self):
442 n = 0
443 n += self.lengthString(len(self.property_))
444 if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_)
445 return n + 1
447 def ByteSizePartial(self):
448 n = 0
449 if (self.has_property_):
450 n += 1
451 n += self.lengthString(len(self.property_))
452 if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_)
453 return n
455 def Clear(self):
456 self.clear_property()
457 self.clear_direction()
459 def OutputUnchecked(self, out):
460 out.putVarInt32(82)
461 out.putPrefixedString(self.property_)
462 if (self.has_direction_):
463 out.putVarInt32(88)
464 out.putVarInt32(self.direction_)
466 def OutputPartial(self, out):
467 if (self.has_property_):
468 out.putVarInt32(82)
469 out.putPrefixedString(self.property_)
470 if (self.has_direction_):
471 out.putVarInt32(88)
472 out.putVarInt32(self.direction_)
474 def TryMerge(self, d):
475 while 1:
476 tt = d.getVarInt32()
477 if tt == 76: break
478 if tt == 82:
479 self.set_property(d.getPrefixedString())
480 continue
481 if tt == 88:
482 self.set_direction(d.getVarInt32())
483 continue
486 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
487 d.skipData(tt)
490 def __str__(self, prefix="", printElemNumber=0):
491 res=""
492 if self.has_property_: res+=prefix+("property: %s\n" % self.DebugFormatString(self.property_))
493 if self.has_direction_: res+=prefix+("direction: %s\n" % self.DebugFormatInt32(self.direction_))
494 return res
496 class Query(ProtocolBuffer.ProtocolMessage):
499 ORDER_FIRST = 1
500 ANCESTOR_FIRST = 2
501 FILTER_FIRST = 3
503 _Hint_NAMES = {
504 1: "ORDER_FIRST",
505 2: "ANCESTOR_FIRST",
506 3: "FILTER_FIRST",
509 def Hint_Name(cls, x): return cls._Hint_NAMES.get(x, "")
510 Hint_Name = classmethod(Hint_Name)
512 has_app_ = 0
513 app_ = ""
514 has_name_space_ = 0
515 name_space_ = ""
516 has_kind_ = 0
517 kind_ = ""
518 has_ancestor_ = 0
519 ancestor_ = None
520 has_search_query_ = 0
521 search_query_ = ""
522 has_hint_ = 0
523 hint_ = 0
524 has_count_ = 0
525 count_ = 0
526 has_offset_ = 0
527 offset_ = 0
528 has_limit_ = 0
529 limit_ = 0
530 has_compiled_cursor_ = 0
531 compiled_cursor_ = None
532 has_end_compiled_cursor_ = 0
533 end_compiled_cursor_ = None
534 has_require_perfect_plan_ = 0
535 require_perfect_plan_ = 0
536 has_keys_only_ = 0
537 keys_only_ = 0
538 has_transaction_ = 0
539 transaction_ = None
540 has_compile_ = 0
541 compile_ = 0
542 has_failover_ms_ = 0
543 failover_ms_ = 0
544 has_strong_ = 0
545 strong_ = 0
546 has_distinct_ = 0
547 distinct_ = 0
548 has_min_safe_time_seconds_ = 0
549 min_safe_time_seconds_ = 0
550 has_persist_offset_ = 0
551 persist_offset_ = 0
553 def __init__(self, contents=None):
554 self.filter_ = []
555 self.order_ = []
556 self.composite_index_ = []
557 self.property_name_ = []
558 self.group_by_property_name_ = []
559 self.safe_replica_name_ = []
560 self.lazy_init_lock_ = thread.allocate_lock()
561 if contents is not None: self.MergeFromString(contents)
563 def app(self): return self.app_
565 def set_app(self, x):
566 self.has_app_ = 1
567 self.app_ = x
569 def clear_app(self):
570 if self.has_app_:
571 self.has_app_ = 0
572 self.app_ = ""
574 def has_app(self): return self.has_app_
576 def name_space(self): return self.name_space_
578 def set_name_space(self, x):
579 self.has_name_space_ = 1
580 self.name_space_ = x
582 def clear_name_space(self):
583 if self.has_name_space_:
584 self.has_name_space_ = 0
585 self.name_space_ = ""
587 def has_name_space(self): return self.has_name_space_
589 def kind(self): return self.kind_
591 def set_kind(self, x):
592 self.has_kind_ = 1
593 self.kind_ = x
595 def clear_kind(self):
596 if self.has_kind_:
597 self.has_kind_ = 0
598 self.kind_ = ""
600 def has_kind(self): return self.has_kind_
602 def ancestor(self):
603 if self.ancestor_ is None:
604 self.lazy_init_lock_.acquire()
605 try:
606 if self.ancestor_ is None: self.ancestor_ = Reference()
607 finally:
608 self.lazy_init_lock_.release()
609 return self.ancestor_
611 def mutable_ancestor(self): self.has_ancestor_ = 1; return self.ancestor()
613 def clear_ancestor(self):
615 if self.has_ancestor_:
616 self.has_ancestor_ = 0;
617 if self.ancestor_ is not None: self.ancestor_.Clear()
619 def has_ancestor(self): return self.has_ancestor_
621 def filter_size(self): return len(self.filter_)
622 def filter_list(self): return self.filter_
624 def filter(self, i):
625 return self.filter_[i]
627 def mutable_filter(self, i):
628 return self.filter_[i]
630 def add_filter(self):
631 x = Query_Filter()
632 self.filter_.append(x)
633 return x
635 def clear_filter(self):
636 self.filter_ = []
637 def search_query(self): return self.search_query_
639 def set_search_query(self, x):
640 self.has_search_query_ = 1
641 self.search_query_ = x
643 def clear_search_query(self):
644 if self.has_search_query_:
645 self.has_search_query_ = 0
646 self.search_query_ = ""
648 def has_search_query(self): return self.has_search_query_
650 def order_size(self): return len(self.order_)
651 def order_list(self): return self.order_
653 def order(self, i):
654 return self.order_[i]
656 def mutable_order(self, i):
657 return self.order_[i]
659 def add_order(self):
660 x = Query_Order()
661 self.order_.append(x)
662 return x
664 def clear_order(self):
665 self.order_ = []
666 def hint(self): return self.hint_
668 def set_hint(self, x):
669 self.has_hint_ = 1
670 self.hint_ = x
672 def clear_hint(self):
673 if self.has_hint_:
674 self.has_hint_ = 0
675 self.hint_ = 0
677 def has_hint(self): return self.has_hint_
679 def count(self): return self.count_
681 def set_count(self, x):
682 self.has_count_ = 1
683 self.count_ = x
685 def clear_count(self):
686 if self.has_count_:
687 self.has_count_ = 0
688 self.count_ = 0
690 def has_count(self): return self.has_count_
692 def offset(self): return self.offset_
694 def set_offset(self, x):
695 self.has_offset_ = 1
696 self.offset_ = x
698 def clear_offset(self):
699 if self.has_offset_:
700 self.has_offset_ = 0
701 self.offset_ = 0
703 def has_offset(self): return self.has_offset_
705 def limit(self): return self.limit_
707 def set_limit(self, x):
708 self.has_limit_ = 1
709 self.limit_ = x
711 def clear_limit(self):
712 if self.has_limit_:
713 self.has_limit_ = 0
714 self.limit_ = 0
716 def has_limit(self): return self.has_limit_
718 def compiled_cursor(self):
719 if self.compiled_cursor_ is None:
720 self.lazy_init_lock_.acquire()
721 try:
722 if self.compiled_cursor_ is None: self.compiled_cursor_ = CompiledCursor()
723 finally:
724 self.lazy_init_lock_.release()
725 return self.compiled_cursor_
727 def mutable_compiled_cursor(self): self.has_compiled_cursor_ = 1; return self.compiled_cursor()
729 def clear_compiled_cursor(self):
731 if self.has_compiled_cursor_:
732 self.has_compiled_cursor_ = 0;
733 if self.compiled_cursor_ is not None: self.compiled_cursor_.Clear()
735 def has_compiled_cursor(self): return self.has_compiled_cursor_
737 def end_compiled_cursor(self):
738 if self.end_compiled_cursor_ is None:
739 self.lazy_init_lock_.acquire()
740 try:
741 if self.end_compiled_cursor_ is None: self.end_compiled_cursor_ = CompiledCursor()
742 finally:
743 self.lazy_init_lock_.release()
744 return self.end_compiled_cursor_
746 def mutable_end_compiled_cursor(self): self.has_end_compiled_cursor_ = 1; return self.end_compiled_cursor()
748 def clear_end_compiled_cursor(self):
750 if self.has_end_compiled_cursor_:
751 self.has_end_compiled_cursor_ = 0;
752 if self.end_compiled_cursor_ is not None: self.end_compiled_cursor_.Clear()
754 def has_end_compiled_cursor(self): return self.has_end_compiled_cursor_
756 def composite_index_size(self): return len(self.composite_index_)
757 def composite_index_list(self): return self.composite_index_
759 def composite_index(self, i):
760 return self.composite_index_[i]
762 def mutable_composite_index(self, i):
763 return self.composite_index_[i]
765 def add_composite_index(self):
766 x = CompositeIndex()
767 self.composite_index_.append(x)
768 return x
770 def clear_composite_index(self):
771 self.composite_index_ = []
772 def require_perfect_plan(self): return self.require_perfect_plan_
774 def set_require_perfect_plan(self, x):
775 self.has_require_perfect_plan_ = 1
776 self.require_perfect_plan_ = x
778 def clear_require_perfect_plan(self):
779 if self.has_require_perfect_plan_:
780 self.has_require_perfect_plan_ = 0
781 self.require_perfect_plan_ = 0
783 def has_require_perfect_plan(self): return self.has_require_perfect_plan_
785 def keys_only(self): return self.keys_only_
787 def set_keys_only(self, x):
788 self.has_keys_only_ = 1
789 self.keys_only_ = x
791 def clear_keys_only(self):
792 if self.has_keys_only_:
793 self.has_keys_only_ = 0
794 self.keys_only_ = 0
796 def has_keys_only(self): return self.has_keys_only_
798 def transaction(self):
799 if self.transaction_ is None:
800 self.lazy_init_lock_.acquire()
801 try:
802 if self.transaction_ is None: self.transaction_ = Transaction()
803 finally:
804 self.lazy_init_lock_.release()
805 return self.transaction_
807 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
809 def clear_transaction(self):
811 if self.has_transaction_:
812 self.has_transaction_ = 0;
813 if self.transaction_ is not None: self.transaction_.Clear()
815 def has_transaction(self): return self.has_transaction_
817 def compile(self): return self.compile_
819 def set_compile(self, x):
820 self.has_compile_ = 1
821 self.compile_ = x
823 def clear_compile(self):
824 if self.has_compile_:
825 self.has_compile_ = 0
826 self.compile_ = 0
828 def has_compile(self): return self.has_compile_
830 def failover_ms(self): return self.failover_ms_
832 def set_failover_ms(self, x):
833 self.has_failover_ms_ = 1
834 self.failover_ms_ = x
836 def clear_failover_ms(self):
837 if self.has_failover_ms_:
838 self.has_failover_ms_ = 0
839 self.failover_ms_ = 0
841 def has_failover_ms(self): return self.has_failover_ms_
843 def strong(self): return self.strong_
845 def set_strong(self, x):
846 self.has_strong_ = 1
847 self.strong_ = x
849 def clear_strong(self):
850 if self.has_strong_:
851 self.has_strong_ = 0
852 self.strong_ = 0
854 def has_strong(self): return self.has_strong_
856 def property_name_size(self): return len(self.property_name_)
857 def property_name_list(self): return self.property_name_
859 def property_name(self, i):
860 return self.property_name_[i]
862 def set_property_name(self, i, x):
863 self.property_name_[i] = x
865 def add_property_name(self, x):
866 self.property_name_.append(x)
868 def clear_property_name(self):
869 self.property_name_ = []
871 def group_by_property_name_size(self): return len(self.group_by_property_name_)
872 def group_by_property_name_list(self): return self.group_by_property_name_
874 def group_by_property_name(self, i):
875 return self.group_by_property_name_[i]
877 def set_group_by_property_name(self, i, x):
878 self.group_by_property_name_[i] = x
880 def add_group_by_property_name(self, x):
881 self.group_by_property_name_.append(x)
883 def clear_group_by_property_name(self):
884 self.group_by_property_name_ = []
886 def distinct(self): return self.distinct_
888 def set_distinct(self, x):
889 self.has_distinct_ = 1
890 self.distinct_ = x
892 def clear_distinct(self):
893 if self.has_distinct_:
894 self.has_distinct_ = 0
895 self.distinct_ = 0
897 def has_distinct(self): return self.has_distinct_
899 def min_safe_time_seconds(self): return self.min_safe_time_seconds_
901 def set_min_safe_time_seconds(self, x):
902 self.has_min_safe_time_seconds_ = 1
903 self.min_safe_time_seconds_ = x
905 def clear_min_safe_time_seconds(self):
906 if self.has_min_safe_time_seconds_:
907 self.has_min_safe_time_seconds_ = 0
908 self.min_safe_time_seconds_ = 0
910 def has_min_safe_time_seconds(self): return self.has_min_safe_time_seconds_
912 def safe_replica_name_size(self): return len(self.safe_replica_name_)
913 def safe_replica_name_list(self): return self.safe_replica_name_
915 def safe_replica_name(self, i):
916 return self.safe_replica_name_[i]
918 def set_safe_replica_name(self, i, x):
919 self.safe_replica_name_[i] = x
921 def add_safe_replica_name(self, x):
922 self.safe_replica_name_.append(x)
924 def clear_safe_replica_name(self):
925 self.safe_replica_name_ = []
927 def persist_offset(self): return self.persist_offset_
929 def set_persist_offset(self, x):
930 self.has_persist_offset_ = 1
931 self.persist_offset_ = x
933 def clear_persist_offset(self):
934 if self.has_persist_offset_:
935 self.has_persist_offset_ = 0
936 self.persist_offset_ = 0
938 def has_persist_offset(self): return self.has_persist_offset_
941 def MergeFrom(self, x):
942 assert x is not self
943 if (x.has_app()): self.set_app(x.app())
944 if (x.has_name_space()): self.set_name_space(x.name_space())
945 if (x.has_kind()): self.set_kind(x.kind())
946 if (x.has_ancestor()): self.mutable_ancestor().MergeFrom(x.ancestor())
947 for i in xrange(x.filter_size()): self.add_filter().CopyFrom(x.filter(i))
948 if (x.has_search_query()): self.set_search_query(x.search_query())
949 for i in xrange(x.order_size()): self.add_order().CopyFrom(x.order(i))
950 if (x.has_hint()): self.set_hint(x.hint())
951 if (x.has_count()): self.set_count(x.count())
952 if (x.has_offset()): self.set_offset(x.offset())
953 if (x.has_limit()): self.set_limit(x.limit())
954 if (x.has_compiled_cursor()): self.mutable_compiled_cursor().MergeFrom(x.compiled_cursor())
955 if (x.has_end_compiled_cursor()): self.mutable_end_compiled_cursor().MergeFrom(x.end_compiled_cursor())
956 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
957 if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan())
958 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
959 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
960 if (x.has_compile()): self.set_compile(x.compile())
961 if (x.has_failover_ms()): self.set_failover_ms(x.failover_ms())
962 if (x.has_strong()): self.set_strong(x.strong())
963 for i in xrange(x.property_name_size()): self.add_property_name(x.property_name(i))
964 for i in xrange(x.group_by_property_name_size()): self.add_group_by_property_name(x.group_by_property_name(i))
965 if (x.has_distinct()): self.set_distinct(x.distinct())
966 if (x.has_min_safe_time_seconds()): self.set_min_safe_time_seconds(x.min_safe_time_seconds())
967 for i in xrange(x.safe_replica_name_size()): self.add_safe_replica_name(x.safe_replica_name(i))
968 if (x.has_persist_offset()): self.set_persist_offset(x.persist_offset())
970 def Equals(self, x):
971 if x is self: return 1
972 if self.has_app_ != x.has_app_: return 0
973 if self.has_app_ and self.app_ != x.app_: return 0
974 if self.has_name_space_ != x.has_name_space_: return 0
975 if self.has_name_space_ and self.name_space_ != x.name_space_: return 0
976 if self.has_kind_ != x.has_kind_: return 0
977 if self.has_kind_ and self.kind_ != x.kind_: return 0
978 if self.has_ancestor_ != x.has_ancestor_: return 0
979 if self.has_ancestor_ and self.ancestor_ != x.ancestor_: return 0
980 if len(self.filter_) != len(x.filter_): return 0
981 for e1, e2 in zip(self.filter_, x.filter_):
982 if e1 != e2: return 0
983 if self.has_search_query_ != x.has_search_query_: return 0
984 if self.has_search_query_ and self.search_query_ != x.search_query_: return 0
985 if len(self.order_) != len(x.order_): return 0
986 for e1, e2 in zip(self.order_, x.order_):
987 if e1 != e2: return 0
988 if self.has_hint_ != x.has_hint_: return 0
989 if self.has_hint_ and self.hint_ != x.hint_: return 0
990 if self.has_count_ != x.has_count_: return 0
991 if self.has_count_ and self.count_ != x.count_: return 0
992 if self.has_offset_ != x.has_offset_: return 0
993 if self.has_offset_ and self.offset_ != x.offset_: return 0
994 if self.has_limit_ != x.has_limit_: return 0
995 if self.has_limit_ and self.limit_ != x.limit_: return 0
996 if self.has_compiled_cursor_ != x.has_compiled_cursor_: return 0
997 if self.has_compiled_cursor_ and self.compiled_cursor_ != x.compiled_cursor_: return 0
998 if self.has_end_compiled_cursor_ != x.has_end_compiled_cursor_: return 0
999 if self.has_end_compiled_cursor_ and self.end_compiled_cursor_ != x.end_compiled_cursor_: return 0
1000 if len(self.composite_index_) != len(x.composite_index_): return 0
1001 for e1, e2 in zip(self.composite_index_, x.composite_index_):
1002 if e1 != e2: return 0
1003 if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0
1004 if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0
1005 if self.has_keys_only_ != x.has_keys_only_: return 0
1006 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
1007 if self.has_transaction_ != x.has_transaction_: return 0
1008 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
1009 if self.has_compile_ != x.has_compile_: return 0
1010 if self.has_compile_ and self.compile_ != x.compile_: return 0
1011 if self.has_failover_ms_ != x.has_failover_ms_: return 0
1012 if self.has_failover_ms_ and self.failover_ms_ != x.failover_ms_: return 0
1013 if self.has_strong_ != x.has_strong_: return 0
1014 if self.has_strong_ and self.strong_ != x.strong_: return 0
1015 if len(self.property_name_) != len(x.property_name_): return 0
1016 for e1, e2 in zip(self.property_name_, x.property_name_):
1017 if e1 != e2: return 0
1018 if len(self.group_by_property_name_) != len(x.group_by_property_name_): return 0
1019 for e1, e2 in zip(self.group_by_property_name_, x.group_by_property_name_):
1020 if e1 != e2: return 0
1021 if self.has_distinct_ != x.has_distinct_: return 0
1022 if self.has_distinct_ and self.distinct_ != x.distinct_: return 0
1023 if self.has_min_safe_time_seconds_ != x.has_min_safe_time_seconds_: return 0
1024 if self.has_min_safe_time_seconds_ and self.min_safe_time_seconds_ != x.min_safe_time_seconds_: return 0
1025 if len(self.safe_replica_name_) != len(x.safe_replica_name_): return 0
1026 for e1, e2 in zip(self.safe_replica_name_, x.safe_replica_name_):
1027 if e1 != e2: return 0
1028 if self.has_persist_offset_ != x.has_persist_offset_: return 0
1029 if self.has_persist_offset_ and self.persist_offset_ != x.persist_offset_: return 0
1030 return 1
1032 def IsInitialized(self, debug_strs=None):
1033 initialized = 1
1034 if (not self.has_app_):
1035 initialized = 0
1036 if debug_strs is not None:
1037 debug_strs.append('Required field: app not set.')
1038 if (self.has_ancestor_ and not self.ancestor_.IsInitialized(debug_strs)): initialized = 0
1039 for p in self.filter_:
1040 if not p.IsInitialized(debug_strs): initialized=0
1041 for p in self.order_:
1042 if not p.IsInitialized(debug_strs): initialized=0
1043 if (self.has_compiled_cursor_ and not self.compiled_cursor_.IsInitialized(debug_strs)): initialized = 0
1044 if (self.has_end_compiled_cursor_ and not self.end_compiled_cursor_.IsInitialized(debug_strs)): initialized = 0
1045 for p in self.composite_index_:
1046 if not p.IsInitialized(debug_strs): initialized=0
1047 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
1048 return initialized
1050 def ByteSize(self):
1051 n = 0
1052 n += self.lengthString(len(self.app_))
1053 if (self.has_name_space_): n += 2 + self.lengthString(len(self.name_space_))
1054 if (self.has_kind_): n += 1 + self.lengthString(len(self.kind_))
1055 if (self.has_ancestor_): n += 2 + self.lengthString(self.ancestor_.ByteSize())
1056 n += 2 * len(self.filter_)
1057 for i in xrange(len(self.filter_)): n += self.filter_[i].ByteSize()
1058 if (self.has_search_query_): n += 1 + self.lengthString(len(self.search_query_))
1059 n += 2 * len(self.order_)
1060 for i in xrange(len(self.order_)): n += self.order_[i].ByteSize()
1061 if (self.has_hint_): n += 2 + self.lengthVarInt64(self.hint_)
1062 if (self.has_count_): n += 2 + self.lengthVarInt64(self.count_)
1063 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
1064 if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_)
1065 if (self.has_compiled_cursor_): n += 2 + self.lengthString(self.compiled_cursor_.ByteSize())
1066 if (self.has_end_compiled_cursor_): n += 2 + self.lengthString(self.end_compiled_cursor_.ByteSize())
1067 n += 2 * len(self.composite_index_)
1068 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
1069 if (self.has_require_perfect_plan_): n += 3
1070 if (self.has_keys_only_): n += 3
1071 if (self.has_transaction_): n += 2 + self.lengthString(self.transaction_.ByteSize())
1072 if (self.has_compile_): n += 3
1073 if (self.has_failover_ms_): n += 2 + self.lengthVarInt64(self.failover_ms_)
1074 if (self.has_strong_): n += 3
1075 n += 2 * len(self.property_name_)
1076 for i in xrange(len(self.property_name_)): n += self.lengthString(len(self.property_name_[i]))
1077 n += 2 * len(self.group_by_property_name_)
1078 for i in xrange(len(self.group_by_property_name_)): n += self.lengthString(len(self.group_by_property_name_[i]))
1079 if (self.has_distinct_): n += 3
1080 if (self.has_min_safe_time_seconds_): n += 2 + self.lengthVarInt64(self.min_safe_time_seconds_)
1081 n += 2 * len(self.safe_replica_name_)
1082 for i in xrange(len(self.safe_replica_name_)): n += self.lengthString(len(self.safe_replica_name_[i]))
1083 if (self.has_persist_offset_): n += 3
1084 return n + 1
1086 def ByteSizePartial(self):
1087 n = 0
1088 if (self.has_app_):
1089 n += 1
1090 n += self.lengthString(len(self.app_))
1091 if (self.has_name_space_): n += 2 + self.lengthString(len(self.name_space_))
1092 if (self.has_kind_): n += 1 + self.lengthString(len(self.kind_))
1093 if (self.has_ancestor_): n += 2 + self.lengthString(self.ancestor_.ByteSizePartial())
1094 n += 2 * len(self.filter_)
1095 for i in xrange(len(self.filter_)): n += self.filter_[i].ByteSizePartial()
1096 if (self.has_search_query_): n += 1 + self.lengthString(len(self.search_query_))
1097 n += 2 * len(self.order_)
1098 for i in xrange(len(self.order_)): n += self.order_[i].ByteSizePartial()
1099 if (self.has_hint_): n += 2 + self.lengthVarInt64(self.hint_)
1100 if (self.has_count_): n += 2 + self.lengthVarInt64(self.count_)
1101 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
1102 if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_)
1103 if (self.has_compiled_cursor_): n += 2 + self.lengthString(self.compiled_cursor_.ByteSizePartial())
1104 if (self.has_end_compiled_cursor_): n += 2 + self.lengthString(self.end_compiled_cursor_.ByteSizePartial())
1105 n += 2 * len(self.composite_index_)
1106 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSizePartial())
1107 if (self.has_require_perfect_plan_): n += 3
1108 if (self.has_keys_only_): n += 3
1109 if (self.has_transaction_): n += 2 + self.lengthString(self.transaction_.ByteSizePartial())
1110 if (self.has_compile_): n += 3
1111 if (self.has_failover_ms_): n += 2 + self.lengthVarInt64(self.failover_ms_)
1112 if (self.has_strong_): n += 3
1113 n += 2 * len(self.property_name_)
1114 for i in xrange(len(self.property_name_)): n += self.lengthString(len(self.property_name_[i]))
1115 n += 2 * len(self.group_by_property_name_)
1116 for i in xrange(len(self.group_by_property_name_)): n += self.lengthString(len(self.group_by_property_name_[i]))
1117 if (self.has_distinct_): n += 3
1118 if (self.has_min_safe_time_seconds_): n += 2 + self.lengthVarInt64(self.min_safe_time_seconds_)
1119 n += 2 * len(self.safe_replica_name_)
1120 for i in xrange(len(self.safe_replica_name_)): n += self.lengthString(len(self.safe_replica_name_[i]))
1121 if (self.has_persist_offset_): n += 3
1122 return n
1124 def Clear(self):
1125 self.clear_app()
1126 self.clear_name_space()
1127 self.clear_kind()
1128 self.clear_ancestor()
1129 self.clear_filter()
1130 self.clear_search_query()
1131 self.clear_order()
1132 self.clear_hint()
1133 self.clear_count()
1134 self.clear_offset()
1135 self.clear_limit()
1136 self.clear_compiled_cursor()
1137 self.clear_end_compiled_cursor()
1138 self.clear_composite_index()
1139 self.clear_require_perfect_plan()
1140 self.clear_keys_only()
1141 self.clear_transaction()
1142 self.clear_compile()
1143 self.clear_failover_ms()
1144 self.clear_strong()
1145 self.clear_property_name()
1146 self.clear_group_by_property_name()
1147 self.clear_distinct()
1148 self.clear_min_safe_time_seconds()
1149 self.clear_safe_replica_name()
1150 self.clear_persist_offset()
1152 def OutputUnchecked(self, out):
1153 out.putVarInt32(10)
1154 out.putPrefixedString(self.app_)
1155 if (self.has_kind_):
1156 out.putVarInt32(26)
1157 out.putPrefixedString(self.kind_)
1158 for i in xrange(len(self.filter_)):
1159 out.putVarInt32(35)
1160 self.filter_[i].OutputUnchecked(out)
1161 out.putVarInt32(36)
1162 if (self.has_search_query_):
1163 out.putVarInt32(66)
1164 out.putPrefixedString(self.search_query_)
1165 for i in xrange(len(self.order_)):
1166 out.putVarInt32(75)
1167 self.order_[i].OutputUnchecked(out)
1168 out.putVarInt32(76)
1169 if (self.has_offset_):
1170 out.putVarInt32(96)
1171 out.putVarInt32(self.offset_)
1172 if (self.has_limit_):
1173 out.putVarInt32(128)
1174 out.putVarInt32(self.limit_)
1175 if (self.has_ancestor_):
1176 out.putVarInt32(138)
1177 out.putVarInt32(self.ancestor_.ByteSize())
1178 self.ancestor_.OutputUnchecked(out)
1179 if (self.has_hint_):
1180 out.putVarInt32(144)
1181 out.putVarInt32(self.hint_)
1182 for i in xrange(len(self.composite_index_)):
1183 out.putVarInt32(154)
1184 out.putVarInt32(self.composite_index_[i].ByteSize())
1185 self.composite_index_[i].OutputUnchecked(out)
1186 if (self.has_require_perfect_plan_):
1187 out.putVarInt32(160)
1188 out.putBoolean(self.require_perfect_plan_)
1189 if (self.has_keys_only_):
1190 out.putVarInt32(168)
1191 out.putBoolean(self.keys_only_)
1192 if (self.has_transaction_):
1193 out.putVarInt32(178)
1194 out.putVarInt32(self.transaction_.ByteSize())
1195 self.transaction_.OutputUnchecked(out)
1196 if (self.has_count_):
1197 out.putVarInt32(184)
1198 out.putVarInt32(self.count_)
1199 if (self.has_distinct_):
1200 out.putVarInt32(192)
1201 out.putBoolean(self.distinct_)
1202 if (self.has_compile_):
1203 out.putVarInt32(200)
1204 out.putBoolean(self.compile_)
1205 if (self.has_failover_ms_):
1206 out.putVarInt32(208)
1207 out.putVarInt64(self.failover_ms_)
1208 if (self.has_name_space_):
1209 out.putVarInt32(234)
1210 out.putPrefixedString(self.name_space_)
1211 if (self.has_compiled_cursor_):
1212 out.putVarInt32(242)
1213 out.putVarInt32(self.compiled_cursor_.ByteSize())
1214 self.compiled_cursor_.OutputUnchecked(out)
1215 if (self.has_end_compiled_cursor_):
1216 out.putVarInt32(250)
1217 out.putVarInt32(self.end_compiled_cursor_.ByteSize())
1218 self.end_compiled_cursor_.OutputUnchecked(out)
1219 if (self.has_strong_):
1220 out.putVarInt32(256)
1221 out.putBoolean(self.strong_)
1222 for i in xrange(len(self.property_name_)):
1223 out.putVarInt32(266)
1224 out.putPrefixedString(self.property_name_[i])
1225 for i in xrange(len(self.group_by_property_name_)):
1226 out.putVarInt32(274)
1227 out.putPrefixedString(self.group_by_property_name_[i])
1228 if (self.has_min_safe_time_seconds_):
1229 out.putVarInt32(280)
1230 out.putVarInt64(self.min_safe_time_seconds_)
1231 for i in xrange(len(self.safe_replica_name_)):
1232 out.putVarInt32(290)
1233 out.putPrefixedString(self.safe_replica_name_[i])
1234 if (self.has_persist_offset_):
1235 out.putVarInt32(296)
1236 out.putBoolean(self.persist_offset_)
1238 def OutputPartial(self, out):
1239 if (self.has_app_):
1240 out.putVarInt32(10)
1241 out.putPrefixedString(self.app_)
1242 if (self.has_kind_):
1243 out.putVarInt32(26)
1244 out.putPrefixedString(self.kind_)
1245 for i in xrange(len(self.filter_)):
1246 out.putVarInt32(35)
1247 self.filter_[i].OutputPartial(out)
1248 out.putVarInt32(36)
1249 if (self.has_search_query_):
1250 out.putVarInt32(66)
1251 out.putPrefixedString(self.search_query_)
1252 for i in xrange(len(self.order_)):
1253 out.putVarInt32(75)
1254 self.order_[i].OutputPartial(out)
1255 out.putVarInt32(76)
1256 if (self.has_offset_):
1257 out.putVarInt32(96)
1258 out.putVarInt32(self.offset_)
1259 if (self.has_limit_):
1260 out.putVarInt32(128)
1261 out.putVarInt32(self.limit_)
1262 if (self.has_ancestor_):
1263 out.putVarInt32(138)
1264 out.putVarInt32(self.ancestor_.ByteSizePartial())
1265 self.ancestor_.OutputPartial(out)
1266 if (self.has_hint_):
1267 out.putVarInt32(144)
1268 out.putVarInt32(self.hint_)
1269 for i in xrange(len(self.composite_index_)):
1270 out.putVarInt32(154)
1271 out.putVarInt32(self.composite_index_[i].ByteSizePartial())
1272 self.composite_index_[i].OutputPartial(out)
1273 if (self.has_require_perfect_plan_):
1274 out.putVarInt32(160)
1275 out.putBoolean(self.require_perfect_plan_)
1276 if (self.has_keys_only_):
1277 out.putVarInt32(168)
1278 out.putBoolean(self.keys_only_)
1279 if (self.has_transaction_):
1280 out.putVarInt32(178)
1281 out.putVarInt32(self.transaction_.ByteSizePartial())
1282 self.transaction_.OutputPartial(out)
1283 if (self.has_count_):
1284 out.putVarInt32(184)
1285 out.putVarInt32(self.count_)
1286 if (self.has_distinct_):
1287 out.putVarInt32(192)
1288 out.putBoolean(self.distinct_)
1289 if (self.has_compile_):
1290 out.putVarInt32(200)
1291 out.putBoolean(self.compile_)
1292 if (self.has_failover_ms_):
1293 out.putVarInt32(208)
1294 out.putVarInt64(self.failover_ms_)
1295 if (self.has_name_space_):
1296 out.putVarInt32(234)
1297 out.putPrefixedString(self.name_space_)
1298 if (self.has_compiled_cursor_):
1299 out.putVarInt32(242)
1300 out.putVarInt32(self.compiled_cursor_.ByteSizePartial())
1301 self.compiled_cursor_.OutputPartial(out)
1302 if (self.has_end_compiled_cursor_):
1303 out.putVarInt32(250)
1304 out.putVarInt32(self.end_compiled_cursor_.ByteSizePartial())
1305 self.end_compiled_cursor_.OutputPartial(out)
1306 if (self.has_strong_):
1307 out.putVarInt32(256)
1308 out.putBoolean(self.strong_)
1309 for i in xrange(len(self.property_name_)):
1310 out.putVarInt32(266)
1311 out.putPrefixedString(self.property_name_[i])
1312 for i in xrange(len(self.group_by_property_name_)):
1313 out.putVarInt32(274)
1314 out.putPrefixedString(self.group_by_property_name_[i])
1315 if (self.has_min_safe_time_seconds_):
1316 out.putVarInt32(280)
1317 out.putVarInt64(self.min_safe_time_seconds_)
1318 for i in xrange(len(self.safe_replica_name_)):
1319 out.putVarInt32(290)
1320 out.putPrefixedString(self.safe_replica_name_[i])
1321 if (self.has_persist_offset_):
1322 out.putVarInt32(296)
1323 out.putBoolean(self.persist_offset_)
1325 def TryMerge(self, d):
1326 while d.avail() > 0:
1327 tt = d.getVarInt32()
1328 if tt == 10:
1329 self.set_app(d.getPrefixedString())
1330 continue
1331 if tt == 26:
1332 self.set_kind(d.getPrefixedString())
1333 continue
1334 if tt == 35:
1335 self.add_filter().TryMerge(d)
1336 continue
1337 if tt == 66:
1338 self.set_search_query(d.getPrefixedString())
1339 continue
1340 if tt == 75:
1341 self.add_order().TryMerge(d)
1342 continue
1343 if tt == 96:
1344 self.set_offset(d.getVarInt32())
1345 continue
1346 if tt == 128:
1347 self.set_limit(d.getVarInt32())
1348 continue
1349 if tt == 138:
1350 length = d.getVarInt32()
1351 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1352 d.skip(length)
1353 self.mutable_ancestor().TryMerge(tmp)
1354 continue
1355 if tt == 144:
1356 self.set_hint(d.getVarInt32())
1357 continue
1358 if tt == 154:
1359 length = d.getVarInt32()
1360 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1361 d.skip(length)
1362 self.add_composite_index().TryMerge(tmp)
1363 continue
1364 if tt == 160:
1365 self.set_require_perfect_plan(d.getBoolean())
1366 continue
1367 if tt == 168:
1368 self.set_keys_only(d.getBoolean())
1369 continue
1370 if tt == 178:
1371 length = d.getVarInt32()
1372 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1373 d.skip(length)
1374 self.mutable_transaction().TryMerge(tmp)
1375 continue
1376 if tt == 184:
1377 self.set_count(d.getVarInt32())
1378 continue
1379 if tt == 192:
1380 self.set_distinct(d.getBoolean())
1381 continue
1382 if tt == 200:
1383 self.set_compile(d.getBoolean())
1384 continue
1385 if tt == 208:
1386 self.set_failover_ms(d.getVarInt64())
1387 continue
1388 if tt == 234:
1389 self.set_name_space(d.getPrefixedString())
1390 continue
1391 if tt == 242:
1392 length = d.getVarInt32()
1393 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1394 d.skip(length)
1395 self.mutable_compiled_cursor().TryMerge(tmp)
1396 continue
1397 if tt == 250:
1398 length = d.getVarInt32()
1399 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1400 d.skip(length)
1401 self.mutable_end_compiled_cursor().TryMerge(tmp)
1402 continue
1403 if tt == 256:
1404 self.set_strong(d.getBoolean())
1405 continue
1406 if tt == 266:
1407 self.add_property_name(d.getPrefixedString())
1408 continue
1409 if tt == 274:
1410 self.add_group_by_property_name(d.getPrefixedString())
1411 continue
1412 if tt == 280:
1413 self.set_min_safe_time_seconds(d.getVarInt64())
1414 continue
1415 if tt == 290:
1416 self.add_safe_replica_name(d.getPrefixedString())
1417 continue
1418 if tt == 296:
1419 self.set_persist_offset(d.getBoolean())
1420 continue
1423 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1424 d.skipData(tt)
1427 def __str__(self, prefix="", printElemNumber=0):
1428 res=""
1429 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_))
1430 if self.has_name_space_: res+=prefix+("name_space: %s\n" % self.DebugFormatString(self.name_space_))
1431 if self.has_kind_: res+=prefix+("kind: %s\n" % self.DebugFormatString(self.kind_))
1432 if self.has_ancestor_:
1433 res+=prefix+"ancestor <\n"
1434 res+=self.ancestor_.__str__(prefix + " ", printElemNumber)
1435 res+=prefix+">\n"
1436 cnt=0
1437 for e in self.filter_:
1438 elm=""
1439 if printElemNumber: elm="(%d)" % cnt
1440 res+=prefix+("Filter%s {\n" % elm)
1441 res+=e.__str__(prefix + " ", printElemNumber)
1442 res+=prefix+"}\n"
1443 cnt+=1
1444 if self.has_search_query_: res+=prefix+("search_query: %s\n" % self.DebugFormatString(self.search_query_))
1445 cnt=0
1446 for e in self.order_:
1447 elm=""
1448 if printElemNumber: elm="(%d)" % cnt
1449 res+=prefix+("Order%s {\n" % elm)
1450 res+=e.__str__(prefix + " ", printElemNumber)
1451 res+=prefix+"}\n"
1452 cnt+=1
1453 if self.has_hint_: res+=prefix+("hint: %s\n" % self.DebugFormatInt32(self.hint_))
1454 if self.has_count_: res+=prefix+("count: %s\n" % self.DebugFormatInt32(self.count_))
1455 if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
1456 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
1457 if self.has_compiled_cursor_:
1458 res+=prefix+"compiled_cursor <\n"
1459 res+=self.compiled_cursor_.__str__(prefix + " ", printElemNumber)
1460 res+=prefix+">\n"
1461 if self.has_end_compiled_cursor_:
1462 res+=prefix+"end_compiled_cursor <\n"
1463 res+=self.end_compiled_cursor_.__str__(prefix + " ", printElemNumber)
1464 res+=prefix+">\n"
1465 cnt=0
1466 for e in self.composite_index_:
1467 elm=""
1468 if printElemNumber: elm="(%d)" % cnt
1469 res+=prefix+("composite_index%s <\n" % elm)
1470 res+=e.__str__(prefix + " ", printElemNumber)
1471 res+=prefix+">\n"
1472 cnt+=1
1473 if self.has_require_perfect_plan_: res+=prefix+("require_perfect_plan: %s\n" % self.DebugFormatBool(self.require_perfect_plan_))
1474 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
1475 if self.has_transaction_:
1476 res+=prefix+"transaction <\n"
1477 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
1478 res+=prefix+">\n"
1479 if self.has_compile_: res+=prefix+("compile: %s\n" % self.DebugFormatBool(self.compile_))
1480 if self.has_failover_ms_: res+=prefix+("failover_ms: %s\n" % self.DebugFormatInt64(self.failover_ms_))
1481 if self.has_strong_: res+=prefix+("strong: %s\n" % self.DebugFormatBool(self.strong_))
1482 cnt=0
1483 for e in self.property_name_:
1484 elm=""
1485 if printElemNumber: elm="(%d)" % cnt
1486 res+=prefix+("property_name%s: %s\n" % (elm, self.DebugFormatString(e)))
1487 cnt+=1
1488 cnt=0
1489 for e in self.group_by_property_name_:
1490 elm=""
1491 if printElemNumber: elm="(%d)" % cnt
1492 res+=prefix+("group_by_property_name%s: %s\n" % (elm, self.DebugFormatString(e)))
1493 cnt+=1
1494 if self.has_distinct_: res+=prefix+("distinct: %s\n" % self.DebugFormatBool(self.distinct_))
1495 if self.has_min_safe_time_seconds_: res+=prefix+("min_safe_time_seconds: %s\n" % self.DebugFormatInt64(self.min_safe_time_seconds_))
1496 cnt=0
1497 for e in self.safe_replica_name_:
1498 elm=""
1499 if printElemNumber: elm="(%d)" % cnt
1500 res+=prefix+("safe_replica_name%s: %s\n" % (elm, self.DebugFormatString(e)))
1501 cnt+=1
1502 if self.has_persist_offset_: res+=prefix+("persist_offset: %s\n" % self.DebugFormatBool(self.persist_offset_))
1503 return res
1506 def _BuildTagLookupTable(sparse, maxtag, default=None):
1507 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1509 kapp = 1
1510 kname_space = 29
1511 kkind = 3
1512 kancestor = 17
1513 kFilterGroup = 4
1514 kFilterop = 6
1515 kFilterproperty = 14
1516 ksearch_query = 8
1517 kOrderGroup = 9
1518 kOrderproperty = 10
1519 kOrderdirection = 11
1520 khint = 18
1521 kcount = 23
1522 koffset = 12
1523 klimit = 16
1524 kcompiled_cursor = 30
1525 kend_compiled_cursor = 31
1526 kcomposite_index = 19
1527 krequire_perfect_plan = 20
1528 kkeys_only = 21
1529 ktransaction = 22
1530 kcompile = 25
1531 kfailover_ms = 26
1532 kstrong = 32
1533 kproperty_name = 33
1534 kgroup_by_property_name = 34
1535 kdistinct = 24
1536 kmin_safe_time_seconds = 35
1537 ksafe_replica_name = 36
1538 kpersist_offset = 37
1540 _TEXT = _BuildTagLookupTable({
1541 0: "ErrorCode",
1542 1: "app",
1543 3: "kind",
1544 4: "Filter",
1545 6: "op",
1546 8: "search_query",
1547 9: "Order",
1548 10: "property",
1549 11: "direction",
1550 12: "offset",
1551 14: "property",
1552 16: "limit",
1553 17: "ancestor",
1554 18: "hint",
1555 19: "composite_index",
1556 20: "require_perfect_plan",
1557 21: "keys_only",
1558 22: "transaction",
1559 23: "count",
1560 24: "distinct",
1561 25: "compile",
1562 26: "failover_ms",
1563 29: "name_space",
1564 30: "compiled_cursor",
1565 31: "end_compiled_cursor",
1566 32: "strong",
1567 33: "property_name",
1568 34: "group_by_property_name",
1569 35: "min_safe_time_seconds",
1570 36: "safe_replica_name",
1571 37: "persist_offset",
1572 }, 37)
1574 _TYPES = _BuildTagLookupTable({
1575 0: ProtocolBuffer.Encoder.NUMERIC,
1576 1: ProtocolBuffer.Encoder.STRING,
1577 3: ProtocolBuffer.Encoder.STRING,
1578 4: ProtocolBuffer.Encoder.STARTGROUP,
1579 6: ProtocolBuffer.Encoder.NUMERIC,
1580 8: ProtocolBuffer.Encoder.STRING,
1581 9: ProtocolBuffer.Encoder.STARTGROUP,
1582 10: ProtocolBuffer.Encoder.STRING,
1583 11: ProtocolBuffer.Encoder.NUMERIC,
1584 12: ProtocolBuffer.Encoder.NUMERIC,
1585 14: ProtocolBuffer.Encoder.STRING,
1586 16: ProtocolBuffer.Encoder.NUMERIC,
1587 17: ProtocolBuffer.Encoder.STRING,
1588 18: ProtocolBuffer.Encoder.NUMERIC,
1589 19: ProtocolBuffer.Encoder.STRING,
1590 20: ProtocolBuffer.Encoder.NUMERIC,
1591 21: ProtocolBuffer.Encoder.NUMERIC,
1592 22: ProtocolBuffer.Encoder.STRING,
1593 23: ProtocolBuffer.Encoder.NUMERIC,
1594 24: ProtocolBuffer.Encoder.NUMERIC,
1595 25: ProtocolBuffer.Encoder.NUMERIC,
1596 26: ProtocolBuffer.Encoder.NUMERIC,
1597 29: ProtocolBuffer.Encoder.STRING,
1598 30: ProtocolBuffer.Encoder.STRING,
1599 31: ProtocolBuffer.Encoder.STRING,
1600 32: ProtocolBuffer.Encoder.NUMERIC,
1601 33: ProtocolBuffer.Encoder.STRING,
1602 34: ProtocolBuffer.Encoder.STRING,
1603 35: ProtocolBuffer.Encoder.NUMERIC,
1604 36: ProtocolBuffer.Encoder.STRING,
1605 37: ProtocolBuffer.Encoder.NUMERIC,
1606 }, 37, ProtocolBuffer.Encoder.MAX_TYPE)
1609 _STYLE = """"""
1610 _STYLE_CONTENT_TYPE = """"""
1611 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.Query'
1612 class CompiledQuery_PrimaryScan(ProtocolBuffer.ProtocolMessage):
1613 has_index_name_ = 0
1614 index_name_ = ""
1615 has_start_key_ = 0
1616 start_key_ = ""
1617 has_start_inclusive_ = 0
1618 start_inclusive_ = 0
1619 has_end_key_ = 0
1620 end_key_ = ""
1621 has_end_inclusive_ = 0
1622 end_inclusive_ = 0
1623 has_end_unapplied_log_timestamp_us_ = 0
1624 end_unapplied_log_timestamp_us_ = 0
1626 def __init__(self, contents=None):
1627 self.start_postfix_value_ = []
1628 self.end_postfix_value_ = []
1629 if contents is not None: self.MergeFromString(contents)
1631 def index_name(self): return self.index_name_
1633 def set_index_name(self, x):
1634 self.has_index_name_ = 1
1635 self.index_name_ = x
1637 def clear_index_name(self):
1638 if self.has_index_name_:
1639 self.has_index_name_ = 0
1640 self.index_name_ = ""
1642 def has_index_name(self): return self.has_index_name_
1644 def start_key(self): return self.start_key_
1646 def set_start_key(self, x):
1647 self.has_start_key_ = 1
1648 self.start_key_ = x
1650 def clear_start_key(self):
1651 if self.has_start_key_:
1652 self.has_start_key_ = 0
1653 self.start_key_ = ""
1655 def has_start_key(self): return self.has_start_key_
1657 def start_inclusive(self): return self.start_inclusive_
1659 def set_start_inclusive(self, x):
1660 self.has_start_inclusive_ = 1
1661 self.start_inclusive_ = x
1663 def clear_start_inclusive(self):
1664 if self.has_start_inclusive_:
1665 self.has_start_inclusive_ = 0
1666 self.start_inclusive_ = 0
1668 def has_start_inclusive(self): return self.has_start_inclusive_
1670 def end_key(self): return self.end_key_
1672 def set_end_key(self, x):
1673 self.has_end_key_ = 1
1674 self.end_key_ = x
1676 def clear_end_key(self):
1677 if self.has_end_key_:
1678 self.has_end_key_ = 0
1679 self.end_key_ = ""
1681 def has_end_key(self): return self.has_end_key_
1683 def end_inclusive(self): return self.end_inclusive_
1685 def set_end_inclusive(self, x):
1686 self.has_end_inclusive_ = 1
1687 self.end_inclusive_ = x
1689 def clear_end_inclusive(self):
1690 if self.has_end_inclusive_:
1691 self.has_end_inclusive_ = 0
1692 self.end_inclusive_ = 0
1694 def has_end_inclusive(self): return self.has_end_inclusive_
1696 def start_postfix_value_size(self): return len(self.start_postfix_value_)
1697 def start_postfix_value_list(self): return self.start_postfix_value_
1699 def start_postfix_value(self, i):
1700 return self.start_postfix_value_[i]
1702 def set_start_postfix_value(self, i, x):
1703 self.start_postfix_value_[i] = x
1705 def add_start_postfix_value(self, x):
1706 self.start_postfix_value_.append(x)
1708 def clear_start_postfix_value(self):
1709 self.start_postfix_value_ = []
1711 def end_postfix_value_size(self): return len(self.end_postfix_value_)
1712 def end_postfix_value_list(self): return self.end_postfix_value_
1714 def end_postfix_value(self, i):
1715 return self.end_postfix_value_[i]
1717 def set_end_postfix_value(self, i, x):
1718 self.end_postfix_value_[i] = x
1720 def add_end_postfix_value(self, x):
1721 self.end_postfix_value_.append(x)
1723 def clear_end_postfix_value(self):
1724 self.end_postfix_value_ = []
1726 def end_unapplied_log_timestamp_us(self): return self.end_unapplied_log_timestamp_us_
1728 def set_end_unapplied_log_timestamp_us(self, x):
1729 self.has_end_unapplied_log_timestamp_us_ = 1
1730 self.end_unapplied_log_timestamp_us_ = x
1732 def clear_end_unapplied_log_timestamp_us(self):
1733 if self.has_end_unapplied_log_timestamp_us_:
1734 self.has_end_unapplied_log_timestamp_us_ = 0
1735 self.end_unapplied_log_timestamp_us_ = 0
1737 def has_end_unapplied_log_timestamp_us(self): return self.has_end_unapplied_log_timestamp_us_
1740 def MergeFrom(self, x):
1741 assert x is not self
1742 if (x.has_index_name()): self.set_index_name(x.index_name())
1743 if (x.has_start_key()): self.set_start_key(x.start_key())
1744 if (x.has_start_inclusive()): self.set_start_inclusive(x.start_inclusive())
1745 if (x.has_end_key()): self.set_end_key(x.end_key())
1746 if (x.has_end_inclusive()): self.set_end_inclusive(x.end_inclusive())
1747 for i in xrange(x.start_postfix_value_size()): self.add_start_postfix_value(x.start_postfix_value(i))
1748 for i in xrange(x.end_postfix_value_size()): self.add_end_postfix_value(x.end_postfix_value(i))
1749 if (x.has_end_unapplied_log_timestamp_us()): self.set_end_unapplied_log_timestamp_us(x.end_unapplied_log_timestamp_us())
1751 def Equals(self, x):
1752 if x is self: return 1
1753 if self.has_index_name_ != x.has_index_name_: return 0
1754 if self.has_index_name_ and self.index_name_ != x.index_name_: return 0
1755 if self.has_start_key_ != x.has_start_key_: return 0
1756 if self.has_start_key_ and self.start_key_ != x.start_key_: return 0
1757 if self.has_start_inclusive_ != x.has_start_inclusive_: return 0
1758 if self.has_start_inclusive_ and self.start_inclusive_ != x.start_inclusive_: return 0
1759 if self.has_end_key_ != x.has_end_key_: return 0
1760 if self.has_end_key_ and self.end_key_ != x.end_key_: return 0
1761 if self.has_end_inclusive_ != x.has_end_inclusive_: return 0
1762 if self.has_end_inclusive_ and self.end_inclusive_ != x.end_inclusive_: return 0
1763 if len(self.start_postfix_value_) != len(x.start_postfix_value_): return 0
1764 for e1, e2 in zip(self.start_postfix_value_, x.start_postfix_value_):
1765 if e1 != e2: return 0
1766 if len(self.end_postfix_value_) != len(x.end_postfix_value_): return 0
1767 for e1, e2 in zip(self.end_postfix_value_, x.end_postfix_value_):
1768 if e1 != e2: return 0
1769 if self.has_end_unapplied_log_timestamp_us_ != x.has_end_unapplied_log_timestamp_us_: return 0
1770 if self.has_end_unapplied_log_timestamp_us_ and self.end_unapplied_log_timestamp_us_ != x.end_unapplied_log_timestamp_us_: return 0
1771 return 1
1773 def IsInitialized(self, debug_strs=None):
1774 initialized = 1
1775 return initialized
1777 def ByteSize(self):
1778 n = 0
1779 if (self.has_index_name_): n += 1 + self.lengthString(len(self.index_name_))
1780 if (self.has_start_key_): n += 1 + self.lengthString(len(self.start_key_))
1781 if (self.has_start_inclusive_): n += 2
1782 if (self.has_end_key_): n += 1 + self.lengthString(len(self.end_key_))
1783 if (self.has_end_inclusive_): n += 2
1784 n += 2 * len(self.start_postfix_value_)
1785 for i in xrange(len(self.start_postfix_value_)): n += self.lengthString(len(self.start_postfix_value_[i]))
1786 n += 2 * len(self.end_postfix_value_)
1787 for i in xrange(len(self.end_postfix_value_)): n += self.lengthString(len(self.end_postfix_value_[i]))
1788 if (self.has_end_unapplied_log_timestamp_us_): n += 2 + self.lengthVarInt64(self.end_unapplied_log_timestamp_us_)
1789 return n
1791 def ByteSizePartial(self):
1792 n = 0
1793 if (self.has_index_name_): n += 1 + self.lengthString(len(self.index_name_))
1794 if (self.has_start_key_): n += 1 + self.lengthString(len(self.start_key_))
1795 if (self.has_start_inclusive_): n += 2
1796 if (self.has_end_key_): n += 1 + self.lengthString(len(self.end_key_))
1797 if (self.has_end_inclusive_): n += 2
1798 n += 2 * len(self.start_postfix_value_)
1799 for i in xrange(len(self.start_postfix_value_)): n += self.lengthString(len(self.start_postfix_value_[i]))
1800 n += 2 * len(self.end_postfix_value_)
1801 for i in xrange(len(self.end_postfix_value_)): n += self.lengthString(len(self.end_postfix_value_[i]))
1802 if (self.has_end_unapplied_log_timestamp_us_): n += 2 + self.lengthVarInt64(self.end_unapplied_log_timestamp_us_)
1803 return n
1805 def Clear(self):
1806 self.clear_index_name()
1807 self.clear_start_key()
1808 self.clear_start_inclusive()
1809 self.clear_end_key()
1810 self.clear_end_inclusive()
1811 self.clear_start_postfix_value()
1812 self.clear_end_postfix_value()
1813 self.clear_end_unapplied_log_timestamp_us()
1815 def OutputUnchecked(self, out):
1816 if (self.has_index_name_):
1817 out.putVarInt32(18)
1818 out.putPrefixedString(self.index_name_)
1819 if (self.has_start_key_):
1820 out.putVarInt32(26)
1821 out.putPrefixedString(self.start_key_)
1822 if (self.has_start_inclusive_):
1823 out.putVarInt32(32)
1824 out.putBoolean(self.start_inclusive_)
1825 if (self.has_end_key_):
1826 out.putVarInt32(42)
1827 out.putPrefixedString(self.end_key_)
1828 if (self.has_end_inclusive_):
1829 out.putVarInt32(48)
1830 out.putBoolean(self.end_inclusive_)
1831 if (self.has_end_unapplied_log_timestamp_us_):
1832 out.putVarInt32(152)
1833 out.putVarInt64(self.end_unapplied_log_timestamp_us_)
1834 for i in xrange(len(self.start_postfix_value_)):
1835 out.putVarInt32(178)
1836 out.putPrefixedString(self.start_postfix_value_[i])
1837 for i in xrange(len(self.end_postfix_value_)):
1838 out.putVarInt32(186)
1839 out.putPrefixedString(self.end_postfix_value_[i])
1841 def OutputPartial(self, out):
1842 if (self.has_index_name_):
1843 out.putVarInt32(18)
1844 out.putPrefixedString(self.index_name_)
1845 if (self.has_start_key_):
1846 out.putVarInt32(26)
1847 out.putPrefixedString(self.start_key_)
1848 if (self.has_start_inclusive_):
1849 out.putVarInt32(32)
1850 out.putBoolean(self.start_inclusive_)
1851 if (self.has_end_key_):
1852 out.putVarInt32(42)
1853 out.putPrefixedString(self.end_key_)
1854 if (self.has_end_inclusive_):
1855 out.putVarInt32(48)
1856 out.putBoolean(self.end_inclusive_)
1857 if (self.has_end_unapplied_log_timestamp_us_):
1858 out.putVarInt32(152)
1859 out.putVarInt64(self.end_unapplied_log_timestamp_us_)
1860 for i in xrange(len(self.start_postfix_value_)):
1861 out.putVarInt32(178)
1862 out.putPrefixedString(self.start_postfix_value_[i])
1863 for i in xrange(len(self.end_postfix_value_)):
1864 out.putVarInt32(186)
1865 out.putPrefixedString(self.end_postfix_value_[i])
1867 def TryMerge(self, d):
1868 while 1:
1869 tt = d.getVarInt32()
1870 if tt == 12: break
1871 if tt == 18:
1872 self.set_index_name(d.getPrefixedString())
1873 continue
1874 if tt == 26:
1875 self.set_start_key(d.getPrefixedString())
1876 continue
1877 if tt == 32:
1878 self.set_start_inclusive(d.getBoolean())
1879 continue
1880 if tt == 42:
1881 self.set_end_key(d.getPrefixedString())
1882 continue
1883 if tt == 48:
1884 self.set_end_inclusive(d.getBoolean())
1885 continue
1886 if tt == 152:
1887 self.set_end_unapplied_log_timestamp_us(d.getVarInt64())
1888 continue
1889 if tt == 178:
1890 self.add_start_postfix_value(d.getPrefixedString())
1891 continue
1892 if tt == 186:
1893 self.add_end_postfix_value(d.getPrefixedString())
1894 continue
1897 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1898 d.skipData(tt)
1901 def __str__(self, prefix="", printElemNumber=0):
1902 res=""
1903 if self.has_index_name_: res+=prefix+("index_name: %s\n" % self.DebugFormatString(self.index_name_))
1904 if self.has_start_key_: res+=prefix+("start_key: %s\n" % self.DebugFormatString(self.start_key_))
1905 if self.has_start_inclusive_: res+=prefix+("start_inclusive: %s\n" % self.DebugFormatBool(self.start_inclusive_))
1906 if self.has_end_key_: res+=prefix+("end_key: %s\n" % self.DebugFormatString(self.end_key_))
1907 if self.has_end_inclusive_: res+=prefix+("end_inclusive: %s\n" % self.DebugFormatBool(self.end_inclusive_))
1908 cnt=0
1909 for e in self.start_postfix_value_:
1910 elm=""
1911 if printElemNumber: elm="(%d)" % cnt
1912 res+=prefix+("start_postfix_value%s: %s\n" % (elm, self.DebugFormatString(e)))
1913 cnt+=1
1914 cnt=0
1915 for e in self.end_postfix_value_:
1916 elm=""
1917 if printElemNumber: elm="(%d)" % cnt
1918 res+=prefix+("end_postfix_value%s: %s\n" % (elm, self.DebugFormatString(e)))
1919 cnt+=1
1920 if self.has_end_unapplied_log_timestamp_us_: res+=prefix+("end_unapplied_log_timestamp_us: %s\n" % self.DebugFormatInt64(self.end_unapplied_log_timestamp_us_))
1921 return res
1923 class CompiledQuery_MergeJoinScan(ProtocolBuffer.ProtocolMessage):
1924 has_index_name_ = 0
1925 index_name_ = ""
1926 has_value_prefix_ = 0
1927 value_prefix_ = 0
1929 def __init__(self, contents=None):
1930 self.prefix_value_ = []
1931 if contents is not None: self.MergeFromString(contents)
1933 def index_name(self): return self.index_name_
1935 def set_index_name(self, x):
1936 self.has_index_name_ = 1
1937 self.index_name_ = x
1939 def clear_index_name(self):
1940 if self.has_index_name_:
1941 self.has_index_name_ = 0
1942 self.index_name_ = ""
1944 def has_index_name(self): return self.has_index_name_
1946 def prefix_value_size(self): return len(self.prefix_value_)
1947 def prefix_value_list(self): return self.prefix_value_
1949 def prefix_value(self, i):
1950 return self.prefix_value_[i]
1952 def set_prefix_value(self, i, x):
1953 self.prefix_value_[i] = x
1955 def add_prefix_value(self, x):
1956 self.prefix_value_.append(x)
1958 def clear_prefix_value(self):
1959 self.prefix_value_ = []
1961 def value_prefix(self): return self.value_prefix_
1963 def set_value_prefix(self, x):
1964 self.has_value_prefix_ = 1
1965 self.value_prefix_ = x
1967 def clear_value_prefix(self):
1968 if self.has_value_prefix_:
1969 self.has_value_prefix_ = 0
1970 self.value_prefix_ = 0
1972 def has_value_prefix(self): return self.has_value_prefix_
1975 def MergeFrom(self, x):
1976 assert x is not self
1977 if (x.has_index_name()): self.set_index_name(x.index_name())
1978 for i in xrange(x.prefix_value_size()): self.add_prefix_value(x.prefix_value(i))
1979 if (x.has_value_prefix()): self.set_value_prefix(x.value_prefix())
1981 def Equals(self, x):
1982 if x is self: return 1
1983 if self.has_index_name_ != x.has_index_name_: return 0
1984 if self.has_index_name_ and self.index_name_ != x.index_name_: return 0
1985 if len(self.prefix_value_) != len(x.prefix_value_): return 0
1986 for e1, e2 in zip(self.prefix_value_, x.prefix_value_):
1987 if e1 != e2: return 0
1988 if self.has_value_prefix_ != x.has_value_prefix_: return 0
1989 if self.has_value_prefix_ and self.value_prefix_ != x.value_prefix_: return 0
1990 return 1
1992 def IsInitialized(self, debug_strs=None):
1993 initialized = 1
1994 if (not self.has_index_name_):
1995 initialized = 0
1996 if debug_strs is not None:
1997 debug_strs.append('Required field: index_name not set.')
1998 return initialized
2000 def ByteSize(self):
2001 n = 0
2002 n += self.lengthString(len(self.index_name_))
2003 n += 1 * len(self.prefix_value_)
2004 for i in xrange(len(self.prefix_value_)): n += self.lengthString(len(self.prefix_value_[i]))
2005 if (self.has_value_prefix_): n += 3
2006 return n + 1
2008 def ByteSizePartial(self):
2009 n = 0
2010 if (self.has_index_name_):
2011 n += 1
2012 n += self.lengthString(len(self.index_name_))
2013 n += 1 * len(self.prefix_value_)
2014 for i in xrange(len(self.prefix_value_)): n += self.lengthString(len(self.prefix_value_[i]))
2015 if (self.has_value_prefix_): n += 3
2016 return n
2018 def Clear(self):
2019 self.clear_index_name()
2020 self.clear_prefix_value()
2021 self.clear_value_prefix()
2023 def OutputUnchecked(self, out):
2024 out.putVarInt32(66)
2025 out.putPrefixedString(self.index_name_)
2026 for i in xrange(len(self.prefix_value_)):
2027 out.putVarInt32(74)
2028 out.putPrefixedString(self.prefix_value_[i])
2029 if (self.has_value_prefix_):
2030 out.putVarInt32(160)
2031 out.putBoolean(self.value_prefix_)
2033 def OutputPartial(self, out):
2034 if (self.has_index_name_):
2035 out.putVarInt32(66)
2036 out.putPrefixedString(self.index_name_)
2037 for i in xrange(len(self.prefix_value_)):
2038 out.putVarInt32(74)
2039 out.putPrefixedString(self.prefix_value_[i])
2040 if (self.has_value_prefix_):
2041 out.putVarInt32(160)
2042 out.putBoolean(self.value_prefix_)
2044 def TryMerge(self, d):
2045 while 1:
2046 tt = d.getVarInt32()
2047 if tt == 60: break
2048 if tt == 66:
2049 self.set_index_name(d.getPrefixedString())
2050 continue
2051 if tt == 74:
2052 self.add_prefix_value(d.getPrefixedString())
2053 continue
2054 if tt == 160:
2055 self.set_value_prefix(d.getBoolean())
2056 continue
2059 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2060 d.skipData(tt)
2063 def __str__(self, prefix="", printElemNumber=0):
2064 res=""
2065 if self.has_index_name_: res+=prefix+("index_name: %s\n" % self.DebugFormatString(self.index_name_))
2066 cnt=0
2067 for e in self.prefix_value_:
2068 elm=""
2069 if printElemNumber: elm="(%d)" % cnt
2070 res+=prefix+("prefix_value%s: %s\n" % (elm, self.DebugFormatString(e)))
2071 cnt+=1
2072 if self.has_value_prefix_: res+=prefix+("value_prefix: %s\n" % self.DebugFormatBool(self.value_prefix_))
2073 return res
2075 class CompiledQuery_EntityFilter(ProtocolBuffer.ProtocolMessage):
2076 has_distinct_ = 0
2077 distinct_ = 0
2078 has_kind_ = 0
2079 kind_ = ""
2080 has_ancestor_ = 0
2081 ancestor_ = None
2083 def __init__(self, contents=None):
2084 self.lazy_init_lock_ = thread.allocate_lock()
2085 if contents is not None: self.MergeFromString(contents)
2087 def distinct(self): return self.distinct_
2089 def set_distinct(self, x):
2090 self.has_distinct_ = 1
2091 self.distinct_ = x
2093 def clear_distinct(self):
2094 if self.has_distinct_:
2095 self.has_distinct_ = 0
2096 self.distinct_ = 0
2098 def has_distinct(self): return self.has_distinct_
2100 def kind(self): return self.kind_
2102 def set_kind(self, x):
2103 self.has_kind_ = 1
2104 self.kind_ = x
2106 def clear_kind(self):
2107 if self.has_kind_:
2108 self.has_kind_ = 0
2109 self.kind_ = ""
2111 def has_kind(self): return self.has_kind_
2113 def ancestor(self):
2114 if self.ancestor_ is None:
2115 self.lazy_init_lock_.acquire()
2116 try:
2117 if self.ancestor_ is None: self.ancestor_ = Reference()
2118 finally:
2119 self.lazy_init_lock_.release()
2120 return self.ancestor_
2122 def mutable_ancestor(self): self.has_ancestor_ = 1; return self.ancestor()
2124 def clear_ancestor(self):
2126 if self.has_ancestor_:
2127 self.has_ancestor_ = 0;
2128 if self.ancestor_ is not None: self.ancestor_.Clear()
2130 def has_ancestor(self): return self.has_ancestor_
2133 def MergeFrom(self, x):
2134 assert x is not self
2135 if (x.has_distinct()): self.set_distinct(x.distinct())
2136 if (x.has_kind()): self.set_kind(x.kind())
2137 if (x.has_ancestor()): self.mutable_ancestor().MergeFrom(x.ancestor())
2139 def Equals(self, x):
2140 if x is self: return 1
2141 if self.has_distinct_ != x.has_distinct_: return 0
2142 if self.has_distinct_ and self.distinct_ != x.distinct_: return 0
2143 if self.has_kind_ != x.has_kind_: return 0
2144 if self.has_kind_ and self.kind_ != x.kind_: return 0
2145 if self.has_ancestor_ != x.has_ancestor_: return 0
2146 if self.has_ancestor_ and self.ancestor_ != x.ancestor_: return 0
2147 return 1
2149 def IsInitialized(self, debug_strs=None):
2150 initialized = 1
2151 if (self.has_ancestor_ and not self.ancestor_.IsInitialized(debug_strs)): initialized = 0
2152 return initialized
2154 def ByteSize(self):
2155 n = 0
2156 if (self.has_distinct_): n += 2
2157 if (self.has_kind_): n += 2 + self.lengthString(len(self.kind_))
2158 if (self.has_ancestor_): n += 2 + self.lengthString(self.ancestor_.ByteSize())
2159 return n
2161 def ByteSizePartial(self):
2162 n = 0
2163 if (self.has_distinct_): n += 2
2164 if (self.has_kind_): n += 2 + self.lengthString(len(self.kind_))
2165 if (self.has_ancestor_): n += 2 + self.lengthString(self.ancestor_.ByteSizePartial())
2166 return n
2168 def Clear(self):
2169 self.clear_distinct()
2170 self.clear_kind()
2171 self.clear_ancestor()
2173 def OutputUnchecked(self, out):
2174 if (self.has_distinct_):
2175 out.putVarInt32(112)
2176 out.putBoolean(self.distinct_)
2177 if (self.has_kind_):
2178 out.putVarInt32(138)
2179 out.putPrefixedString(self.kind_)
2180 if (self.has_ancestor_):
2181 out.putVarInt32(146)
2182 out.putVarInt32(self.ancestor_.ByteSize())
2183 self.ancestor_.OutputUnchecked(out)
2185 def OutputPartial(self, out):
2186 if (self.has_distinct_):
2187 out.putVarInt32(112)
2188 out.putBoolean(self.distinct_)
2189 if (self.has_kind_):
2190 out.putVarInt32(138)
2191 out.putPrefixedString(self.kind_)
2192 if (self.has_ancestor_):
2193 out.putVarInt32(146)
2194 out.putVarInt32(self.ancestor_.ByteSizePartial())
2195 self.ancestor_.OutputPartial(out)
2197 def TryMerge(self, d):
2198 while 1:
2199 tt = d.getVarInt32()
2200 if tt == 108: break
2201 if tt == 112:
2202 self.set_distinct(d.getBoolean())
2203 continue
2204 if tt == 138:
2205 self.set_kind(d.getPrefixedString())
2206 continue
2207 if tt == 146:
2208 length = d.getVarInt32()
2209 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2210 d.skip(length)
2211 self.mutable_ancestor().TryMerge(tmp)
2212 continue
2215 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2216 d.skipData(tt)
2219 def __str__(self, prefix="", printElemNumber=0):
2220 res=""
2221 if self.has_distinct_: res+=prefix+("distinct: %s\n" % self.DebugFormatBool(self.distinct_))
2222 if self.has_kind_: res+=prefix+("kind: %s\n" % self.DebugFormatString(self.kind_))
2223 if self.has_ancestor_:
2224 res+=prefix+"ancestor <\n"
2225 res+=self.ancestor_.__str__(prefix + " ", printElemNumber)
2226 res+=prefix+">\n"
2227 return res
2229 class CompiledQuery(ProtocolBuffer.ProtocolMessage):
2230 has_primaryscan_ = 0
2231 has_index_def_ = 0
2232 index_def_ = None
2233 has_offset_ = 0
2234 offset_ = 0
2235 has_limit_ = 0
2236 limit_ = 0
2237 has_keys_only_ = 0
2238 keys_only_ = 0
2239 has_distinct_infix_size_ = 0
2240 distinct_infix_size_ = 0
2241 has_entityfilter_ = 0
2242 entityfilter_ = None
2244 def __init__(self, contents=None):
2245 self.primaryscan_ = CompiledQuery_PrimaryScan()
2246 self.mergejoinscan_ = []
2247 self.property_name_ = []
2248 self.lazy_init_lock_ = thread.allocate_lock()
2249 if contents is not None: self.MergeFromString(contents)
2251 def primaryscan(self): return self.primaryscan_
2253 def mutable_primaryscan(self): self.has_primaryscan_ = 1; return self.primaryscan_
2255 def clear_primaryscan(self):self.has_primaryscan_ = 0; self.primaryscan_.Clear()
2257 def has_primaryscan(self): return self.has_primaryscan_
2259 def mergejoinscan_size(self): return len(self.mergejoinscan_)
2260 def mergejoinscan_list(self): return self.mergejoinscan_
2262 def mergejoinscan(self, i):
2263 return self.mergejoinscan_[i]
2265 def mutable_mergejoinscan(self, i):
2266 return self.mergejoinscan_[i]
2268 def add_mergejoinscan(self):
2269 x = CompiledQuery_MergeJoinScan()
2270 self.mergejoinscan_.append(x)
2271 return x
2273 def clear_mergejoinscan(self):
2274 self.mergejoinscan_ = []
2275 def index_def(self):
2276 if self.index_def_ is None:
2277 self.lazy_init_lock_.acquire()
2278 try:
2279 if self.index_def_ is None: self.index_def_ = Index()
2280 finally:
2281 self.lazy_init_lock_.release()
2282 return self.index_def_
2284 def mutable_index_def(self): self.has_index_def_ = 1; return self.index_def()
2286 def clear_index_def(self):
2288 if self.has_index_def_:
2289 self.has_index_def_ = 0;
2290 if self.index_def_ is not None: self.index_def_.Clear()
2292 def has_index_def(self): return self.has_index_def_
2294 def offset(self): return self.offset_
2296 def set_offset(self, x):
2297 self.has_offset_ = 1
2298 self.offset_ = x
2300 def clear_offset(self):
2301 if self.has_offset_:
2302 self.has_offset_ = 0
2303 self.offset_ = 0
2305 def has_offset(self): return self.has_offset_
2307 def limit(self): return self.limit_
2309 def set_limit(self, x):
2310 self.has_limit_ = 1
2311 self.limit_ = x
2313 def clear_limit(self):
2314 if self.has_limit_:
2315 self.has_limit_ = 0
2316 self.limit_ = 0
2318 def has_limit(self): return self.has_limit_
2320 def keys_only(self): return self.keys_only_
2322 def set_keys_only(self, x):
2323 self.has_keys_only_ = 1
2324 self.keys_only_ = x
2326 def clear_keys_only(self):
2327 if self.has_keys_only_:
2328 self.has_keys_only_ = 0
2329 self.keys_only_ = 0
2331 def has_keys_only(self): return self.has_keys_only_
2333 def property_name_size(self): return len(self.property_name_)
2334 def property_name_list(self): return self.property_name_
2336 def property_name(self, i):
2337 return self.property_name_[i]
2339 def set_property_name(self, i, x):
2340 self.property_name_[i] = x
2342 def add_property_name(self, x):
2343 self.property_name_.append(x)
2345 def clear_property_name(self):
2346 self.property_name_ = []
2348 def distinct_infix_size(self): return self.distinct_infix_size_
2350 def set_distinct_infix_size(self, x):
2351 self.has_distinct_infix_size_ = 1
2352 self.distinct_infix_size_ = x
2354 def clear_distinct_infix_size(self):
2355 if self.has_distinct_infix_size_:
2356 self.has_distinct_infix_size_ = 0
2357 self.distinct_infix_size_ = 0
2359 def has_distinct_infix_size(self): return self.has_distinct_infix_size_
2361 def entityfilter(self):
2362 if self.entityfilter_ is None:
2363 self.lazy_init_lock_.acquire()
2364 try:
2365 if self.entityfilter_ is None: self.entityfilter_ = CompiledQuery_EntityFilter()
2366 finally:
2367 self.lazy_init_lock_.release()
2368 return self.entityfilter_
2370 def mutable_entityfilter(self): self.has_entityfilter_ = 1; return self.entityfilter()
2372 def clear_entityfilter(self):
2374 if self.has_entityfilter_:
2375 self.has_entityfilter_ = 0;
2376 if self.entityfilter_ is not None: self.entityfilter_.Clear()
2378 def has_entityfilter(self): return self.has_entityfilter_
2381 def MergeFrom(self, x):
2382 assert x is not self
2383 if (x.has_primaryscan()): self.mutable_primaryscan().MergeFrom(x.primaryscan())
2384 for i in xrange(x.mergejoinscan_size()): self.add_mergejoinscan().CopyFrom(x.mergejoinscan(i))
2385 if (x.has_index_def()): self.mutable_index_def().MergeFrom(x.index_def())
2386 if (x.has_offset()): self.set_offset(x.offset())
2387 if (x.has_limit()): self.set_limit(x.limit())
2388 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
2389 for i in xrange(x.property_name_size()): self.add_property_name(x.property_name(i))
2390 if (x.has_distinct_infix_size()): self.set_distinct_infix_size(x.distinct_infix_size())
2391 if (x.has_entityfilter()): self.mutable_entityfilter().MergeFrom(x.entityfilter())
2393 def Equals(self, x):
2394 if x is self: return 1
2395 if self.has_primaryscan_ != x.has_primaryscan_: return 0
2396 if self.has_primaryscan_ and self.primaryscan_ != x.primaryscan_: return 0
2397 if len(self.mergejoinscan_) != len(x.mergejoinscan_): return 0
2398 for e1, e2 in zip(self.mergejoinscan_, x.mergejoinscan_):
2399 if e1 != e2: return 0
2400 if self.has_index_def_ != x.has_index_def_: return 0
2401 if self.has_index_def_ and self.index_def_ != x.index_def_: return 0
2402 if self.has_offset_ != x.has_offset_: return 0
2403 if self.has_offset_ and self.offset_ != x.offset_: return 0
2404 if self.has_limit_ != x.has_limit_: return 0
2405 if self.has_limit_ and self.limit_ != x.limit_: return 0
2406 if self.has_keys_only_ != x.has_keys_only_: return 0
2407 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
2408 if len(self.property_name_) != len(x.property_name_): return 0
2409 for e1, e2 in zip(self.property_name_, x.property_name_):
2410 if e1 != e2: return 0
2411 if self.has_distinct_infix_size_ != x.has_distinct_infix_size_: return 0
2412 if self.has_distinct_infix_size_ and self.distinct_infix_size_ != x.distinct_infix_size_: return 0
2413 if self.has_entityfilter_ != x.has_entityfilter_: return 0
2414 if self.has_entityfilter_ and self.entityfilter_ != x.entityfilter_: return 0
2415 return 1
2417 def IsInitialized(self, debug_strs=None):
2418 initialized = 1
2419 if (not self.has_primaryscan_):
2420 initialized = 0
2421 if debug_strs is not None:
2422 debug_strs.append('Required field: primaryscan not set.')
2423 elif not self.primaryscan_.IsInitialized(debug_strs): initialized = 0
2424 for p in self.mergejoinscan_:
2425 if not p.IsInitialized(debug_strs): initialized=0
2426 if (self.has_index_def_ and not self.index_def_.IsInitialized(debug_strs)): initialized = 0
2427 if (not self.has_keys_only_):
2428 initialized = 0
2429 if debug_strs is not None:
2430 debug_strs.append('Required field: keys_only not set.')
2431 if (self.has_entityfilter_ and not self.entityfilter_.IsInitialized(debug_strs)): initialized = 0
2432 return initialized
2434 def ByteSize(self):
2435 n = 0
2436 n += self.primaryscan_.ByteSize()
2437 n += 2 * len(self.mergejoinscan_)
2438 for i in xrange(len(self.mergejoinscan_)): n += self.mergejoinscan_[i].ByteSize()
2439 if (self.has_index_def_): n += 2 + self.lengthString(self.index_def_.ByteSize())
2440 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
2441 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
2442 n += 2 * len(self.property_name_)
2443 for i in xrange(len(self.property_name_)): n += self.lengthString(len(self.property_name_[i]))
2444 if (self.has_distinct_infix_size_): n += 2 + self.lengthVarInt64(self.distinct_infix_size_)
2445 if (self.has_entityfilter_): n += 2 + self.entityfilter_.ByteSize()
2446 return n + 4
2448 def ByteSizePartial(self):
2449 n = 0
2450 if (self.has_primaryscan_):
2451 n += 2
2452 n += self.primaryscan_.ByteSizePartial()
2453 n += 2 * len(self.mergejoinscan_)
2454 for i in xrange(len(self.mergejoinscan_)): n += self.mergejoinscan_[i].ByteSizePartial()
2455 if (self.has_index_def_): n += 2 + self.lengthString(self.index_def_.ByteSizePartial())
2456 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
2457 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
2458 if (self.has_keys_only_):
2459 n += 2
2460 n += 2 * len(self.property_name_)
2461 for i in xrange(len(self.property_name_)): n += self.lengthString(len(self.property_name_[i]))
2462 if (self.has_distinct_infix_size_): n += 2 + self.lengthVarInt64(self.distinct_infix_size_)
2463 if (self.has_entityfilter_): n += 2 + self.entityfilter_.ByteSizePartial()
2464 return n
2466 def Clear(self):
2467 self.clear_primaryscan()
2468 self.clear_mergejoinscan()
2469 self.clear_index_def()
2470 self.clear_offset()
2471 self.clear_limit()
2472 self.clear_keys_only()
2473 self.clear_property_name()
2474 self.clear_distinct_infix_size()
2475 self.clear_entityfilter()
2477 def OutputUnchecked(self, out):
2478 out.putVarInt32(11)
2479 self.primaryscan_.OutputUnchecked(out)
2480 out.putVarInt32(12)
2481 for i in xrange(len(self.mergejoinscan_)):
2482 out.putVarInt32(59)
2483 self.mergejoinscan_[i].OutputUnchecked(out)
2484 out.putVarInt32(60)
2485 if (self.has_offset_):
2486 out.putVarInt32(80)
2487 out.putVarInt32(self.offset_)
2488 if (self.has_limit_):
2489 out.putVarInt32(88)
2490 out.putVarInt32(self.limit_)
2491 out.putVarInt32(96)
2492 out.putBoolean(self.keys_only_)
2493 if (self.has_entityfilter_):
2494 out.putVarInt32(107)
2495 self.entityfilter_.OutputUnchecked(out)
2496 out.putVarInt32(108)
2497 if (self.has_index_def_):
2498 out.putVarInt32(170)
2499 out.putVarInt32(self.index_def_.ByteSize())
2500 self.index_def_.OutputUnchecked(out)
2501 for i in xrange(len(self.property_name_)):
2502 out.putVarInt32(194)
2503 out.putPrefixedString(self.property_name_[i])
2504 if (self.has_distinct_infix_size_):
2505 out.putVarInt32(200)
2506 out.putVarInt32(self.distinct_infix_size_)
2508 def OutputPartial(self, out):
2509 if (self.has_primaryscan_):
2510 out.putVarInt32(11)
2511 self.primaryscan_.OutputPartial(out)
2512 out.putVarInt32(12)
2513 for i in xrange(len(self.mergejoinscan_)):
2514 out.putVarInt32(59)
2515 self.mergejoinscan_[i].OutputPartial(out)
2516 out.putVarInt32(60)
2517 if (self.has_offset_):
2518 out.putVarInt32(80)
2519 out.putVarInt32(self.offset_)
2520 if (self.has_limit_):
2521 out.putVarInt32(88)
2522 out.putVarInt32(self.limit_)
2523 if (self.has_keys_only_):
2524 out.putVarInt32(96)
2525 out.putBoolean(self.keys_only_)
2526 if (self.has_entityfilter_):
2527 out.putVarInt32(107)
2528 self.entityfilter_.OutputPartial(out)
2529 out.putVarInt32(108)
2530 if (self.has_index_def_):
2531 out.putVarInt32(170)
2532 out.putVarInt32(self.index_def_.ByteSizePartial())
2533 self.index_def_.OutputPartial(out)
2534 for i in xrange(len(self.property_name_)):
2535 out.putVarInt32(194)
2536 out.putPrefixedString(self.property_name_[i])
2537 if (self.has_distinct_infix_size_):
2538 out.putVarInt32(200)
2539 out.putVarInt32(self.distinct_infix_size_)
2541 def TryMerge(self, d):
2542 while d.avail() > 0:
2543 tt = d.getVarInt32()
2544 if tt == 11:
2545 self.mutable_primaryscan().TryMerge(d)
2546 continue
2547 if tt == 59:
2548 self.add_mergejoinscan().TryMerge(d)
2549 continue
2550 if tt == 80:
2551 self.set_offset(d.getVarInt32())
2552 continue
2553 if tt == 88:
2554 self.set_limit(d.getVarInt32())
2555 continue
2556 if tt == 96:
2557 self.set_keys_only(d.getBoolean())
2558 continue
2559 if tt == 107:
2560 self.mutable_entityfilter().TryMerge(d)
2561 continue
2562 if tt == 170:
2563 length = d.getVarInt32()
2564 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2565 d.skip(length)
2566 self.mutable_index_def().TryMerge(tmp)
2567 continue
2568 if tt == 194:
2569 self.add_property_name(d.getPrefixedString())
2570 continue
2571 if tt == 200:
2572 self.set_distinct_infix_size(d.getVarInt32())
2573 continue
2576 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2577 d.skipData(tt)
2580 def __str__(self, prefix="", printElemNumber=0):
2581 res=""
2582 if self.has_primaryscan_:
2583 res+=prefix+"PrimaryScan {\n"
2584 res+=self.primaryscan_.__str__(prefix + " ", printElemNumber)
2585 res+=prefix+"}\n"
2586 cnt=0
2587 for e in self.mergejoinscan_:
2588 elm=""
2589 if printElemNumber: elm="(%d)" % cnt
2590 res+=prefix+("MergeJoinScan%s {\n" % elm)
2591 res+=e.__str__(prefix + " ", printElemNumber)
2592 res+=prefix+"}\n"
2593 cnt+=1
2594 if self.has_index_def_:
2595 res+=prefix+"index_def <\n"
2596 res+=self.index_def_.__str__(prefix + " ", printElemNumber)
2597 res+=prefix+">\n"
2598 if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
2599 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
2600 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
2601 cnt=0
2602 for e in self.property_name_:
2603 elm=""
2604 if printElemNumber: elm="(%d)" % cnt
2605 res+=prefix+("property_name%s: %s\n" % (elm, self.DebugFormatString(e)))
2606 cnt+=1
2607 if self.has_distinct_infix_size_: res+=prefix+("distinct_infix_size: %s\n" % self.DebugFormatInt32(self.distinct_infix_size_))
2608 if self.has_entityfilter_:
2609 res+=prefix+"EntityFilter {\n"
2610 res+=self.entityfilter_.__str__(prefix + " ", printElemNumber)
2611 res+=prefix+"}\n"
2612 return res
2615 def _BuildTagLookupTable(sparse, maxtag, default=None):
2616 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
2618 kPrimaryScanGroup = 1
2619 kPrimaryScanindex_name = 2
2620 kPrimaryScanstart_key = 3
2621 kPrimaryScanstart_inclusive = 4
2622 kPrimaryScanend_key = 5
2623 kPrimaryScanend_inclusive = 6
2624 kPrimaryScanstart_postfix_value = 22
2625 kPrimaryScanend_postfix_value = 23
2626 kPrimaryScanend_unapplied_log_timestamp_us = 19
2627 kMergeJoinScanGroup = 7
2628 kMergeJoinScanindex_name = 8
2629 kMergeJoinScanprefix_value = 9
2630 kMergeJoinScanvalue_prefix = 20
2631 kindex_def = 21
2632 koffset = 10
2633 klimit = 11
2634 kkeys_only = 12
2635 kproperty_name = 24
2636 kdistinct_infix_size = 25
2637 kEntityFilterGroup = 13
2638 kEntityFilterdistinct = 14
2639 kEntityFilterkind = 17
2640 kEntityFilterancestor = 18
2642 _TEXT = _BuildTagLookupTable({
2643 0: "ErrorCode",
2644 1: "PrimaryScan",
2645 2: "index_name",
2646 3: "start_key",
2647 4: "start_inclusive",
2648 5: "end_key",
2649 6: "end_inclusive",
2650 7: "MergeJoinScan",
2651 8: "index_name",
2652 9: "prefix_value",
2653 10: "offset",
2654 11: "limit",
2655 12: "keys_only",
2656 13: "EntityFilter",
2657 14: "distinct",
2658 17: "kind",
2659 18: "ancestor",
2660 19: "end_unapplied_log_timestamp_us",
2661 20: "value_prefix",
2662 21: "index_def",
2663 22: "start_postfix_value",
2664 23: "end_postfix_value",
2665 24: "property_name",
2666 25: "distinct_infix_size",
2667 }, 25)
2669 _TYPES = _BuildTagLookupTable({
2670 0: ProtocolBuffer.Encoder.NUMERIC,
2671 1: ProtocolBuffer.Encoder.STARTGROUP,
2672 2: ProtocolBuffer.Encoder.STRING,
2673 3: ProtocolBuffer.Encoder.STRING,
2674 4: ProtocolBuffer.Encoder.NUMERIC,
2675 5: ProtocolBuffer.Encoder.STRING,
2676 6: ProtocolBuffer.Encoder.NUMERIC,
2677 7: ProtocolBuffer.Encoder.STARTGROUP,
2678 8: ProtocolBuffer.Encoder.STRING,
2679 9: ProtocolBuffer.Encoder.STRING,
2680 10: ProtocolBuffer.Encoder.NUMERIC,
2681 11: ProtocolBuffer.Encoder.NUMERIC,
2682 12: ProtocolBuffer.Encoder.NUMERIC,
2683 13: ProtocolBuffer.Encoder.STARTGROUP,
2684 14: ProtocolBuffer.Encoder.NUMERIC,
2685 17: ProtocolBuffer.Encoder.STRING,
2686 18: ProtocolBuffer.Encoder.STRING,
2687 19: ProtocolBuffer.Encoder.NUMERIC,
2688 20: ProtocolBuffer.Encoder.NUMERIC,
2689 21: ProtocolBuffer.Encoder.STRING,
2690 22: ProtocolBuffer.Encoder.STRING,
2691 23: ProtocolBuffer.Encoder.STRING,
2692 24: ProtocolBuffer.Encoder.STRING,
2693 25: ProtocolBuffer.Encoder.NUMERIC,
2694 }, 25, ProtocolBuffer.Encoder.MAX_TYPE)
2697 _STYLE = """"""
2698 _STYLE_CONTENT_TYPE = """"""
2699 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.CompiledQuery'
2700 class CompiledCursor_PositionIndexValue(ProtocolBuffer.ProtocolMessage):
2701 has_property_ = 0
2702 property_ = ""
2703 has_value_ = 0
2705 def __init__(self, contents=None):
2706 self.value_ = PropertyValue()
2707 if contents is not None: self.MergeFromString(contents)
2709 def property(self): return self.property_
2711 def set_property(self, x):
2712 self.has_property_ = 1
2713 self.property_ = x
2715 def clear_property(self):
2716 if self.has_property_:
2717 self.has_property_ = 0
2718 self.property_ = ""
2720 def has_property(self): return self.has_property_
2722 def value(self): return self.value_
2724 def mutable_value(self): self.has_value_ = 1; return self.value_
2726 def clear_value(self):self.has_value_ = 0; self.value_.Clear()
2728 def has_value(self): return self.has_value_
2731 def MergeFrom(self, x):
2732 assert x is not self
2733 if (x.has_property()): self.set_property(x.property())
2734 if (x.has_value()): self.mutable_value().MergeFrom(x.value())
2736 def Equals(self, x):
2737 if x is self: return 1
2738 if self.has_property_ != x.has_property_: return 0
2739 if self.has_property_ and self.property_ != x.property_: return 0
2740 if self.has_value_ != x.has_value_: return 0
2741 if self.has_value_ and self.value_ != x.value_: return 0
2742 return 1
2744 def IsInitialized(self, debug_strs=None):
2745 initialized = 1
2746 if (not self.has_value_):
2747 initialized = 0
2748 if debug_strs is not None:
2749 debug_strs.append('Required field: value not set.')
2750 elif not self.value_.IsInitialized(debug_strs): initialized = 0
2751 return initialized
2753 def ByteSize(self):
2754 n = 0
2755 if (self.has_property_): n += 2 + self.lengthString(len(self.property_))
2756 n += self.lengthString(self.value_.ByteSize())
2757 return n + 2
2759 def ByteSizePartial(self):
2760 n = 0
2761 if (self.has_property_): n += 2 + self.lengthString(len(self.property_))
2762 if (self.has_value_):
2763 n += 2
2764 n += self.lengthString(self.value_.ByteSizePartial())
2765 return n
2767 def Clear(self):
2768 self.clear_property()
2769 self.clear_value()
2771 def OutputUnchecked(self, out):
2772 if (self.has_property_):
2773 out.putVarInt32(242)
2774 out.putPrefixedString(self.property_)
2775 out.putVarInt32(250)
2776 out.putVarInt32(self.value_.ByteSize())
2777 self.value_.OutputUnchecked(out)
2779 def OutputPartial(self, out):
2780 if (self.has_property_):
2781 out.putVarInt32(242)
2782 out.putPrefixedString(self.property_)
2783 if (self.has_value_):
2784 out.putVarInt32(250)
2785 out.putVarInt32(self.value_.ByteSizePartial())
2786 self.value_.OutputPartial(out)
2788 def TryMerge(self, d):
2789 while 1:
2790 tt = d.getVarInt32()
2791 if tt == 236: break
2792 if tt == 242:
2793 self.set_property(d.getPrefixedString())
2794 continue
2795 if tt == 250:
2796 length = d.getVarInt32()
2797 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2798 d.skip(length)
2799 self.mutable_value().TryMerge(tmp)
2800 continue
2803 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2804 d.skipData(tt)
2807 def __str__(self, prefix="", printElemNumber=0):
2808 res=""
2809 if self.has_property_: res+=prefix+("property: %s\n" % self.DebugFormatString(self.property_))
2810 if self.has_value_:
2811 res+=prefix+"value <\n"
2812 res+=self.value_.__str__(prefix + " ", printElemNumber)
2813 res+=prefix+">\n"
2814 return res
2816 class CompiledCursor_Position(ProtocolBuffer.ProtocolMessage):
2817 has_start_key_ = 0
2818 start_key_ = ""
2819 has_key_ = 0
2820 key_ = None
2821 has_start_inclusive_ = 0
2822 start_inclusive_ = 1
2824 def __init__(self, contents=None):
2825 self.indexvalue_ = []
2826 self.lazy_init_lock_ = thread.allocate_lock()
2827 if contents is not None: self.MergeFromString(contents)
2829 def start_key(self): return self.start_key_
2831 def set_start_key(self, x):
2832 self.has_start_key_ = 1
2833 self.start_key_ = x
2835 def clear_start_key(self):
2836 if self.has_start_key_:
2837 self.has_start_key_ = 0
2838 self.start_key_ = ""
2840 def has_start_key(self): return self.has_start_key_
2842 def indexvalue_size(self): return len(self.indexvalue_)
2843 def indexvalue_list(self): return self.indexvalue_
2845 def indexvalue(self, i):
2846 return self.indexvalue_[i]
2848 def mutable_indexvalue(self, i):
2849 return self.indexvalue_[i]
2851 def add_indexvalue(self):
2852 x = CompiledCursor_PositionIndexValue()
2853 self.indexvalue_.append(x)
2854 return x
2856 def clear_indexvalue(self):
2857 self.indexvalue_ = []
2858 def key(self):
2859 if self.key_ is None:
2860 self.lazy_init_lock_.acquire()
2861 try:
2862 if self.key_ is None: self.key_ = Reference()
2863 finally:
2864 self.lazy_init_lock_.release()
2865 return self.key_
2867 def mutable_key(self): self.has_key_ = 1; return self.key()
2869 def clear_key(self):
2871 if self.has_key_:
2872 self.has_key_ = 0;
2873 if self.key_ is not None: self.key_.Clear()
2875 def has_key(self): return self.has_key_
2877 def start_inclusive(self): return self.start_inclusive_
2879 def set_start_inclusive(self, x):
2880 self.has_start_inclusive_ = 1
2881 self.start_inclusive_ = x
2883 def clear_start_inclusive(self):
2884 if self.has_start_inclusive_:
2885 self.has_start_inclusive_ = 0
2886 self.start_inclusive_ = 1
2888 def has_start_inclusive(self): return self.has_start_inclusive_
2891 def MergeFrom(self, x):
2892 assert x is not self
2893 if (x.has_start_key()): self.set_start_key(x.start_key())
2894 for i in xrange(x.indexvalue_size()): self.add_indexvalue().CopyFrom(x.indexvalue(i))
2895 if (x.has_key()): self.mutable_key().MergeFrom(x.key())
2896 if (x.has_start_inclusive()): self.set_start_inclusive(x.start_inclusive())
2898 def Equals(self, x):
2899 if x is self: return 1
2900 if self.has_start_key_ != x.has_start_key_: return 0
2901 if self.has_start_key_ and self.start_key_ != x.start_key_: return 0
2902 if len(self.indexvalue_) != len(x.indexvalue_): return 0
2903 for e1, e2 in zip(self.indexvalue_, x.indexvalue_):
2904 if e1 != e2: return 0
2905 if self.has_key_ != x.has_key_: return 0
2906 if self.has_key_ and self.key_ != x.key_: return 0
2907 if self.has_start_inclusive_ != x.has_start_inclusive_: return 0
2908 if self.has_start_inclusive_ and self.start_inclusive_ != x.start_inclusive_: return 0
2909 return 1
2911 def IsInitialized(self, debug_strs=None):
2912 initialized = 1
2913 for p in self.indexvalue_:
2914 if not p.IsInitialized(debug_strs): initialized=0
2915 if (self.has_key_ and not self.key_.IsInitialized(debug_strs)): initialized = 0
2916 return initialized
2918 def ByteSize(self):
2919 n = 0
2920 if (self.has_start_key_): n += 2 + self.lengthString(len(self.start_key_))
2921 n += 4 * len(self.indexvalue_)
2922 for i in xrange(len(self.indexvalue_)): n += self.indexvalue_[i].ByteSize()
2923 if (self.has_key_): n += 2 + self.lengthString(self.key_.ByteSize())
2924 if (self.has_start_inclusive_): n += 3
2925 return n
2927 def ByteSizePartial(self):
2928 n = 0
2929 if (self.has_start_key_): n += 2 + self.lengthString(len(self.start_key_))
2930 n += 4 * len(self.indexvalue_)
2931 for i in xrange(len(self.indexvalue_)): n += self.indexvalue_[i].ByteSizePartial()
2932 if (self.has_key_): n += 2 + self.lengthString(self.key_.ByteSizePartial())
2933 if (self.has_start_inclusive_): n += 3
2934 return n
2936 def Clear(self):
2937 self.clear_start_key()
2938 self.clear_indexvalue()
2939 self.clear_key()
2940 self.clear_start_inclusive()
2942 def OutputUnchecked(self, out):
2943 if (self.has_start_key_):
2944 out.putVarInt32(218)
2945 out.putPrefixedString(self.start_key_)
2946 if (self.has_start_inclusive_):
2947 out.putVarInt32(224)
2948 out.putBoolean(self.start_inclusive_)
2949 for i in xrange(len(self.indexvalue_)):
2950 out.putVarInt32(235)
2951 self.indexvalue_[i].OutputUnchecked(out)
2952 out.putVarInt32(236)
2953 if (self.has_key_):
2954 out.putVarInt32(258)
2955 out.putVarInt32(self.key_.ByteSize())
2956 self.key_.OutputUnchecked(out)
2958 def OutputPartial(self, out):
2959 if (self.has_start_key_):
2960 out.putVarInt32(218)
2961 out.putPrefixedString(self.start_key_)
2962 if (self.has_start_inclusive_):
2963 out.putVarInt32(224)
2964 out.putBoolean(self.start_inclusive_)
2965 for i in xrange(len(self.indexvalue_)):
2966 out.putVarInt32(235)
2967 self.indexvalue_[i].OutputPartial(out)
2968 out.putVarInt32(236)
2969 if (self.has_key_):
2970 out.putVarInt32(258)
2971 out.putVarInt32(self.key_.ByteSizePartial())
2972 self.key_.OutputPartial(out)
2974 def TryMerge(self, d):
2975 while 1:
2976 tt = d.getVarInt32()
2977 if tt == 20: break
2978 if tt == 218:
2979 self.set_start_key(d.getPrefixedString())
2980 continue
2981 if tt == 224:
2982 self.set_start_inclusive(d.getBoolean())
2983 continue
2984 if tt == 235:
2985 self.add_indexvalue().TryMerge(d)
2986 continue
2987 if tt == 258:
2988 length = d.getVarInt32()
2989 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2990 d.skip(length)
2991 self.mutable_key().TryMerge(tmp)
2992 continue
2995 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2996 d.skipData(tt)
2999 def __str__(self, prefix="", printElemNumber=0):
3000 res=""
3001 if self.has_start_key_: res+=prefix+("start_key: %s\n" % self.DebugFormatString(self.start_key_))
3002 cnt=0
3003 for e in self.indexvalue_:
3004 elm=""
3005 if printElemNumber: elm="(%d)" % cnt
3006 res+=prefix+("IndexValue%s {\n" % elm)
3007 res+=e.__str__(prefix + " ", printElemNumber)
3008 res+=prefix+"}\n"
3009 cnt+=1
3010 if self.has_key_:
3011 res+=prefix+"key <\n"
3012 res+=self.key_.__str__(prefix + " ", printElemNumber)
3013 res+=prefix+">\n"
3014 if self.has_start_inclusive_: res+=prefix+("start_inclusive: %s\n" % self.DebugFormatBool(self.start_inclusive_))
3015 return res
3017 class CompiledCursor(ProtocolBuffer.ProtocolMessage):
3018 has_multiquery_index_ = 0
3019 multiquery_index_ = 0
3021 def __init__(self, contents=None):
3022 self.position_ = []
3023 if contents is not None: self.MergeFromString(contents)
3025 def multiquery_index(self): return self.multiquery_index_
3027 def set_multiquery_index(self, x):
3028 self.has_multiquery_index_ = 1
3029 self.multiquery_index_ = x
3031 def clear_multiquery_index(self):
3032 if self.has_multiquery_index_:
3033 self.has_multiquery_index_ = 0
3034 self.multiquery_index_ = 0
3036 def has_multiquery_index(self): return self.has_multiquery_index_
3038 def position_size(self): return len(self.position_)
3039 def position_list(self): return self.position_
3041 def position(self, i):
3042 return self.position_[i]
3044 def mutable_position(self, i):
3045 return self.position_[i]
3047 def add_position(self):
3048 x = CompiledCursor_Position()
3049 self.position_.append(x)
3050 return x
3052 def clear_position(self):
3053 self.position_ = []
3055 def MergeFrom(self, x):
3056 assert x is not self
3057 if (x.has_multiquery_index()): self.set_multiquery_index(x.multiquery_index())
3058 for i in xrange(x.position_size()): self.add_position().CopyFrom(x.position(i))
3060 def Equals(self, x):
3061 if x is self: return 1
3062 if self.has_multiquery_index_ != x.has_multiquery_index_: return 0
3063 if self.has_multiquery_index_ and self.multiquery_index_ != x.multiquery_index_: return 0
3064 if len(self.position_) != len(x.position_): return 0
3065 for e1, e2 in zip(self.position_, x.position_):
3066 if e1 != e2: return 0
3067 return 1
3069 def IsInitialized(self, debug_strs=None):
3070 initialized = 1
3071 for p in self.position_:
3072 if not p.IsInitialized(debug_strs): initialized=0
3073 return initialized
3075 def ByteSize(self):
3076 n = 0
3077 if (self.has_multiquery_index_): n += 1 + self.lengthVarInt64(self.multiquery_index_)
3078 n += 2 * len(self.position_)
3079 for i in xrange(len(self.position_)): n += self.position_[i].ByteSize()
3080 return n
3082 def ByteSizePartial(self):
3083 n = 0
3084 if (self.has_multiquery_index_): n += 1 + self.lengthVarInt64(self.multiquery_index_)
3085 n += 2 * len(self.position_)
3086 for i in xrange(len(self.position_)): n += self.position_[i].ByteSizePartial()
3087 return n
3089 def Clear(self):
3090 self.clear_multiquery_index()
3091 self.clear_position()
3093 def OutputUnchecked(self, out):
3094 if (self.has_multiquery_index_):
3095 out.putVarInt32(8)
3096 out.putVarInt32(self.multiquery_index_)
3097 for i in xrange(len(self.position_)):
3098 out.putVarInt32(19)
3099 self.position_[i].OutputUnchecked(out)
3100 out.putVarInt32(20)
3102 def OutputPartial(self, out):
3103 if (self.has_multiquery_index_):
3104 out.putVarInt32(8)
3105 out.putVarInt32(self.multiquery_index_)
3106 for i in xrange(len(self.position_)):
3107 out.putVarInt32(19)
3108 self.position_[i].OutputPartial(out)
3109 out.putVarInt32(20)
3111 def TryMerge(self, d):
3112 while d.avail() > 0:
3113 tt = d.getVarInt32()
3114 if tt == 8:
3115 self.set_multiquery_index(d.getVarInt32())
3116 continue
3117 if tt == 19:
3118 self.add_position().TryMerge(d)
3119 continue
3122 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3123 d.skipData(tt)
3126 def __str__(self, prefix="", printElemNumber=0):
3127 res=""
3128 if self.has_multiquery_index_: res+=prefix+("multiquery_index: %s\n" % self.DebugFormatInt32(self.multiquery_index_))
3129 cnt=0
3130 for e in self.position_:
3131 elm=""
3132 if printElemNumber: elm="(%d)" % cnt
3133 res+=prefix+("Position%s {\n" % elm)
3134 res+=e.__str__(prefix + " ", printElemNumber)
3135 res+=prefix+"}\n"
3136 cnt+=1
3137 return res
3140 def _BuildTagLookupTable(sparse, maxtag, default=None):
3141 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3143 kmultiquery_index = 1
3144 kPositionGroup = 2
3145 kPositionstart_key = 27
3146 kPositionIndexValueGroup = 29
3147 kPositionIndexValueproperty = 30
3148 kPositionIndexValuevalue = 31
3149 kPositionkey = 32
3150 kPositionstart_inclusive = 28
3152 _TEXT = _BuildTagLookupTable({
3153 0: "ErrorCode",
3154 1: "multiquery_index",
3155 2: "Position",
3156 27: "start_key",
3157 28: "start_inclusive",
3158 29: "IndexValue",
3159 30: "property",
3160 31: "value",
3161 32: "key",
3162 }, 32)
3164 _TYPES = _BuildTagLookupTable({
3165 0: ProtocolBuffer.Encoder.NUMERIC,
3166 1: ProtocolBuffer.Encoder.NUMERIC,
3167 2: ProtocolBuffer.Encoder.STARTGROUP,
3168 27: ProtocolBuffer.Encoder.STRING,
3169 28: ProtocolBuffer.Encoder.NUMERIC,
3170 29: ProtocolBuffer.Encoder.STARTGROUP,
3171 30: ProtocolBuffer.Encoder.STRING,
3172 31: ProtocolBuffer.Encoder.STRING,
3173 32: ProtocolBuffer.Encoder.STRING,
3174 }, 32, ProtocolBuffer.Encoder.MAX_TYPE)
3177 _STYLE = """"""
3178 _STYLE_CONTENT_TYPE = """"""
3179 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.CompiledCursor'
3180 class Cursor(ProtocolBuffer.ProtocolMessage):
3181 has_cursor_ = 0
3182 cursor_ = 0
3183 has_app_ = 0
3184 app_ = ""
3186 def __init__(self, contents=None):
3187 if contents is not None: self.MergeFromString(contents)
3189 def cursor(self): return self.cursor_
3191 def set_cursor(self, x):
3192 self.has_cursor_ = 1
3193 self.cursor_ = x
3195 def clear_cursor(self):
3196 if self.has_cursor_:
3197 self.has_cursor_ = 0
3198 self.cursor_ = 0
3200 def has_cursor(self): return self.has_cursor_
3202 def app(self): return self.app_
3204 def set_app(self, x):
3205 self.has_app_ = 1
3206 self.app_ = x
3208 def clear_app(self):
3209 if self.has_app_:
3210 self.has_app_ = 0
3211 self.app_ = ""
3213 def has_app(self): return self.has_app_
3216 def MergeFrom(self, x):
3217 assert x is not self
3218 if (x.has_cursor()): self.set_cursor(x.cursor())
3219 if (x.has_app()): self.set_app(x.app())
3221 def Equals(self, x):
3222 if x is self: return 1
3223 if self.has_cursor_ != x.has_cursor_: return 0
3224 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
3225 if self.has_app_ != x.has_app_: return 0
3226 if self.has_app_ and self.app_ != x.app_: return 0
3227 return 1
3229 def IsInitialized(self, debug_strs=None):
3230 initialized = 1
3231 if (not self.has_cursor_):
3232 initialized = 0
3233 if debug_strs is not None:
3234 debug_strs.append('Required field: cursor not set.')
3235 return initialized
3237 def ByteSize(self):
3238 n = 0
3239 if (self.has_app_): n += 1 + self.lengthString(len(self.app_))
3240 return n + 9
3242 def ByteSizePartial(self):
3243 n = 0
3244 if (self.has_cursor_):
3245 n += 9
3246 if (self.has_app_): n += 1 + self.lengthString(len(self.app_))
3247 return n
3249 def Clear(self):
3250 self.clear_cursor()
3251 self.clear_app()
3253 def OutputUnchecked(self, out):
3254 out.putVarInt32(9)
3255 out.put64(self.cursor_)
3256 if (self.has_app_):
3257 out.putVarInt32(18)
3258 out.putPrefixedString(self.app_)
3260 def OutputPartial(self, out):
3261 if (self.has_cursor_):
3262 out.putVarInt32(9)
3263 out.put64(self.cursor_)
3264 if (self.has_app_):
3265 out.putVarInt32(18)
3266 out.putPrefixedString(self.app_)
3268 def TryMerge(self, d):
3269 while d.avail() > 0:
3270 tt = d.getVarInt32()
3271 if tt == 9:
3272 self.set_cursor(d.get64())
3273 continue
3274 if tt == 18:
3275 self.set_app(d.getPrefixedString())
3276 continue
3279 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3280 d.skipData(tt)
3283 def __str__(self, prefix="", printElemNumber=0):
3284 res=""
3285 if self.has_cursor_: res+=prefix+("cursor: %s\n" % self.DebugFormatFixed64(self.cursor_))
3286 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_))
3287 return res
3290 def _BuildTagLookupTable(sparse, maxtag, default=None):
3291 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3293 kcursor = 1
3294 kapp = 2
3296 _TEXT = _BuildTagLookupTable({
3297 0: "ErrorCode",
3298 1: "cursor",
3299 2: "app",
3300 }, 2)
3302 _TYPES = _BuildTagLookupTable({
3303 0: ProtocolBuffer.Encoder.NUMERIC,
3304 1: ProtocolBuffer.Encoder.DOUBLE,
3305 2: ProtocolBuffer.Encoder.STRING,
3306 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
3309 _STYLE = """"""
3310 _STYLE_CONTENT_TYPE = """"""
3311 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.Cursor'
3312 class Error(ProtocolBuffer.ProtocolMessage):
3315 BAD_REQUEST = 1
3316 CONCURRENT_TRANSACTION = 2
3317 INTERNAL_ERROR = 3
3318 NEED_INDEX = 4
3319 TIMEOUT = 5
3320 PERMISSION_DENIED = 6
3321 BIGTABLE_ERROR = 7
3322 COMMITTED_BUT_STILL_APPLYING = 8
3323 CAPABILITY_DISABLED = 9
3324 TRY_ALTERNATE_BACKEND = 10
3325 SAFE_TIME_TOO_OLD = 11
3327 _ErrorCode_NAMES = {
3328 1: "BAD_REQUEST",
3329 2: "CONCURRENT_TRANSACTION",
3330 3: "INTERNAL_ERROR",
3331 4: "NEED_INDEX",
3332 5: "TIMEOUT",
3333 6: "PERMISSION_DENIED",
3334 7: "BIGTABLE_ERROR",
3335 8: "COMMITTED_BUT_STILL_APPLYING",
3336 9: "CAPABILITY_DISABLED",
3337 10: "TRY_ALTERNATE_BACKEND",
3338 11: "SAFE_TIME_TOO_OLD",
3341 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "")
3342 ErrorCode_Name = classmethod(ErrorCode_Name)
3345 def __init__(self, contents=None):
3346 pass
3347 if contents is not None: self.MergeFromString(contents)
3350 def MergeFrom(self, x):
3351 assert x is not self
3353 def Equals(self, x):
3354 if x is self: return 1
3355 return 1
3357 def IsInitialized(self, debug_strs=None):
3358 initialized = 1
3359 return initialized
3361 def ByteSize(self):
3362 n = 0
3363 return n
3365 def ByteSizePartial(self):
3366 n = 0
3367 return n
3369 def Clear(self):
3370 pass
3372 def OutputUnchecked(self, out):
3373 pass
3375 def OutputPartial(self, out):
3376 pass
3378 def TryMerge(self, d):
3379 while d.avail() > 0:
3380 tt = d.getVarInt32()
3383 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3384 d.skipData(tt)
3387 def __str__(self, prefix="", printElemNumber=0):
3388 res=""
3389 return res
3392 def _BuildTagLookupTable(sparse, maxtag, default=None):
3393 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3396 _TEXT = _BuildTagLookupTable({
3397 0: "ErrorCode",
3398 }, 0)
3400 _TYPES = _BuildTagLookupTable({
3401 0: ProtocolBuffer.Encoder.NUMERIC,
3402 }, 0, ProtocolBuffer.Encoder.MAX_TYPE)
3405 _STYLE = """"""
3406 _STYLE_CONTENT_TYPE = """"""
3407 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.Error'
3408 class Cost_CommitCost(ProtocolBuffer.ProtocolMessage):
3409 has_requested_entity_puts_ = 0
3410 requested_entity_puts_ = 0
3411 has_requested_entity_deletes_ = 0
3412 requested_entity_deletes_ = 0
3414 def __init__(self, contents=None):
3415 if contents is not None: self.MergeFromString(contents)
3417 def requested_entity_puts(self): return self.requested_entity_puts_
3419 def set_requested_entity_puts(self, x):
3420 self.has_requested_entity_puts_ = 1
3421 self.requested_entity_puts_ = x
3423 def clear_requested_entity_puts(self):
3424 if self.has_requested_entity_puts_:
3425 self.has_requested_entity_puts_ = 0
3426 self.requested_entity_puts_ = 0
3428 def has_requested_entity_puts(self): return self.has_requested_entity_puts_
3430 def requested_entity_deletes(self): return self.requested_entity_deletes_
3432 def set_requested_entity_deletes(self, x):
3433 self.has_requested_entity_deletes_ = 1
3434 self.requested_entity_deletes_ = x
3436 def clear_requested_entity_deletes(self):
3437 if self.has_requested_entity_deletes_:
3438 self.has_requested_entity_deletes_ = 0
3439 self.requested_entity_deletes_ = 0
3441 def has_requested_entity_deletes(self): return self.has_requested_entity_deletes_
3444 def MergeFrom(self, x):
3445 assert x is not self
3446 if (x.has_requested_entity_puts()): self.set_requested_entity_puts(x.requested_entity_puts())
3447 if (x.has_requested_entity_deletes()): self.set_requested_entity_deletes(x.requested_entity_deletes())
3449 def Equals(self, x):
3450 if x is self: return 1
3451 if self.has_requested_entity_puts_ != x.has_requested_entity_puts_: return 0
3452 if self.has_requested_entity_puts_ and self.requested_entity_puts_ != x.requested_entity_puts_: return 0
3453 if self.has_requested_entity_deletes_ != x.has_requested_entity_deletes_: return 0
3454 if self.has_requested_entity_deletes_ and self.requested_entity_deletes_ != x.requested_entity_deletes_: return 0
3455 return 1
3457 def IsInitialized(self, debug_strs=None):
3458 initialized = 1
3459 return initialized
3461 def ByteSize(self):
3462 n = 0
3463 if (self.has_requested_entity_puts_): n += 1 + self.lengthVarInt64(self.requested_entity_puts_)
3464 if (self.has_requested_entity_deletes_): n += 1 + self.lengthVarInt64(self.requested_entity_deletes_)
3465 return n
3467 def ByteSizePartial(self):
3468 n = 0
3469 if (self.has_requested_entity_puts_): n += 1 + self.lengthVarInt64(self.requested_entity_puts_)
3470 if (self.has_requested_entity_deletes_): n += 1 + self.lengthVarInt64(self.requested_entity_deletes_)
3471 return n
3473 def Clear(self):
3474 self.clear_requested_entity_puts()
3475 self.clear_requested_entity_deletes()
3477 def OutputUnchecked(self, out):
3478 if (self.has_requested_entity_puts_):
3479 out.putVarInt32(48)
3480 out.putVarInt32(self.requested_entity_puts_)
3481 if (self.has_requested_entity_deletes_):
3482 out.putVarInt32(56)
3483 out.putVarInt32(self.requested_entity_deletes_)
3485 def OutputPartial(self, out):
3486 if (self.has_requested_entity_puts_):
3487 out.putVarInt32(48)
3488 out.putVarInt32(self.requested_entity_puts_)
3489 if (self.has_requested_entity_deletes_):
3490 out.putVarInt32(56)
3491 out.putVarInt32(self.requested_entity_deletes_)
3493 def TryMerge(self, d):
3494 while 1:
3495 tt = d.getVarInt32()
3496 if tt == 44: break
3497 if tt == 48:
3498 self.set_requested_entity_puts(d.getVarInt32())
3499 continue
3500 if tt == 56:
3501 self.set_requested_entity_deletes(d.getVarInt32())
3502 continue
3505 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3506 d.skipData(tt)
3509 def __str__(self, prefix="", printElemNumber=0):
3510 res=""
3511 if self.has_requested_entity_puts_: res+=prefix+("requested_entity_puts: %s\n" % self.DebugFormatInt32(self.requested_entity_puts_))
3512 if self.has_requested_entity_deletes_: res+=prefix+("requested_entity_deletes: %s\n" % self.DebugFormatInt32(self.requested_entity_deletes_))
3513 return res
3515 class Cost(ProtocolBuffer.ProtocolMessage):
3516 has_index_writes_ = 0
3517 index_writes_ = 0
3518 has_index_write_bytes_ = 0
3519 index_write_bytes_ = 0
3520 has_entity_writes_ = 0
3521 entity_writes_ = 0
3522 has_entity_write_bytes_ = 0
3523 entity_write_bytes_ = 0
3524 has_commitcost_ = 0
3525 commitcost_ = None
3526 has_approximate_storage_delta_ = 0
3527 approximate_storage_delta_ = 0
3528 has_id_sequence_updates_ = 0
3529 id_sequence_updates_ = 0
3531 def __init__(self, contents=None):
3532 self.lazy_init_lock_ = thread.allocate_lock()
3533 if contents is not None: self.MergeFromString(contents)
3535 def index_writes(self): return self.index_writes_
3537 def set_index_writes(self, x):
3538 self.has_index_writes_ = 1
3539 self.index_writes_ = x
3541 def clear_index_writes(self):
3542 if self.has_index_writes_:
3543 self.has_index_writes_ = 0
3544 self.index_writes_ = 0
3546 def has_index_writes(self): return self.has_index_writes_
3548 def index_write_bytes(self): return self.index_write_bytes_
3550 def set_index_write_bytes(self, x):
3551 self.has_index_write_bytes_ = 1
3552 self.index_write_bytes_ = x
3554 def clear_index_write_bytes(self):
3555 if self.has_index_write_bytes_:
3556 self.has_index_write_bytes_ = 0
3557 self.index_write_bytes_ = 0
3559 def has_index_write_bytes(self): return self.has_index_write_bytes_
3561 def entity_writes(self): return self.entity_writes_
3563 def set_entity_writes(self, x):
3564 self.has_entity_writes_ = 1
3565 self.entity_writes_ = x
3567 def clear_entity_writes(self):
3568 if self.has_entity_writes_:
3569 self.has_entity_writes_ = 0
3570 self.entity_writes_ = 0
3572 def has_entity_writes(self): return self.has_entity_writes_
3574 def entity_write_bytes(self): return self.entity_write_bytes_
3576 def set_entity_write_bytes(self, x):
3577 self.has_entity_write_bytes_ = 1
3578 self.entity_write_bytes_ = x
3580 def clear_entity_write_bytes(self):
3581 if self.has_entity_write_bytes_:
3582 self.has_entity_write_bytes_ = 0
3583 self.entity_write_bytes_ = 0
3585 def has_entity_write_bytes(self): return self.has_entity_write_bytes_
3587 def commitcost(self):
3588 if self.commitcost_ is None:
3589 self.lazy_init_lock_.acquire()
3590 try:
3591 if self.commitcost_ is None: self.commitcost_ = Cost_CommitCost()
3592 finally:
3593 self.lazy_init_lock_.release()
3594 return self.commitcost_
3596 def mutable_commitcost(self): self.has_commitcost_ = 1; return self.commitcost()
3598 def clear_commitcost(self):
3600 if self.has_commitcost_:
3601 self.has_commitcost_ = 0;
3602 if self.commitcost_ is not None: self.commitcost_.Clear()
3604 def has_commitcost(self): return self.has_commitcost_
3606 def approximate_storage_delta(self): return self.approximate_storage_delta_
3608 def set_approximate_storage_delta(self, x):
3609 self.has_approximate_storage_delta_ = 1
3610 self.approximate_storage_delta_ = x
3612 def clear_approximate_storage_delta(self):
3613 if self.has_approximate_storage_delta_:
3614 self.has_approximate_storage_delta_ = 0
3615 self.approximate_storage_delta_ = 0
3617 def has_approximate_storage_delta(self): return self.has_approximate_storage_delta_
3619 def id_sequence_updates(self): return self.id_sequence_updates_
3621 def set_id_sequence_updates(self, x):
3622 self.has_id_sequence_updates_ = 1
3623 self.id_sequence_updates_ = x
3625 def clear_id_sequence_updates(self):
3626 if self.has_id_sequence_updates_:
3627 self.has_id_sequence_updates_ = 0
3628 self.id_sequence_updates_ = 0
3630 def has_id_sequence_updates(self): return self.has_id_sequence_updates_
3633 def MergeFrom(self, x):
3634 assert x is not self
3635 if (x.has_index_writes()): self.set_index_writes(x.index_writes())
3636 if (x.has_index_write_bytes()): self.set_index_write_bytes(x.index_write_bytes())
3637 if (x.has_entity_writes()): self.set_entity_writes(x.entity_writes())
3638 if (x.has_entity_write_bytes()): self.set_entity_write_bytes(x.entity_write_bytes())
3639 if (x.has_commitcost()): self.mutable_commitcost().MergeFrom(x.commitcost())
3640 if (x.has_approximate_storage_delta()): self.set_approximate_storage_delta(x.approximate_storage_delta())
3641 if (x.has_id_sequence_updates()): self.set_id_sequence_updates(x.id_sequence_updates())
3643 def Equals(self, x):
3644 if x is self: return 1
3645 if self.has_index_writes_ != x.has_index_writes_: return 0
3646 if self.has_index_writes_ and self.index_writes_ != x.index_writes_: return 0
3647 if self.has_index_write_bytes_ != x.has_index_write_bytes_: return 0
3648 if self.has_index_write_bytes_ and self.index_write_bytes_ != x.index_write_bytes_: return 0
3649 if self.has_entity_writes_ != x.has_entity_writes_: return 0
3650 if self.has_entity_writes_ and self.entity_writes_ != x.entity_writes_: return 0
3651 if self.has_entity_write_bytes_ != x.has_entity_write_bytes_: return 0
3652 if self.has_entity_write_bytes_ and self.entity_write_bytes_ != x.entity_write_bytes_: return 0
3653 if self.has_commitcost_ != x.has_commitcost_: return 0
3654 if self.has_commitcost_ and self.commitcost_ != x.commitcost_: return 0
3655 if self.has_approximate_storage_delta_ != x.has_approximate_storage_delta_: return 0
3656 if self.has_approximate_storage_delta_ and self.approximate_storage_delta_ != x.approximate_storage_delta_: return 0
3657 if self.has_id_sequence_updates_ != x.has_id_sequence_updates_: return 0
3658 if self.has_id_sequence_updates_ and self.id_sequence_updates_ != x.id_sequence_updates_: return 0
3659 return 1
3661 def IsInitialized(self, debug_strs=None):
3662 initialized = 1
3663 if (self.has_commitcost_ and not self.commitcost_.IsInitialized(debug_strs)): initialized = 0
3664 return initialized
3666 def ByteSize(self):
3667 n = 0
3668 if (self.has_index_writes_): n += 1 + self.lengthVarInt64(self.index_writes_)
3669 if (self.has_index_write_bytes_): n += 1 + self.lengthVarInt64(self.index_write_bytes_)
3670 if (self.has_entity_writes_): n += 1 + self.lengthVarInt64(self.entity_writes_)
3671 if (self.has_entity_write_bytes_): n += 1 + self.lengthVarInt64(self.entity_write_bytes_)
3672 if (self.has_commitcost_): n += 2 + self.commitcost_.ByteSize()
3673 if (self.has_approximate_storage_delta_): n += 1 + self.lengthVarInt64(self.approximate_storage_delta_)
3674 if (self.has_id_sequence_updates_): n += 1 + self.lengthVarInt64(self.id_sequence_updates_)
3675 return n
3677 def ByteSizePartial(self):
3678 n = 0
3679 if (self.has_index_writes_): n += 1 + self.lengthVarInt64(self.index_writes_)
3680 if (self.has_index_write_bytes_): n += 1 + self.lengthVarInt64(self.index_write_bytes_)
3681 if (self.has_entity_writes_): n += 1 + self.lengthVarInt64(self.entity_writes_)
3682 if (self.has_entity_write_bytes_): n += 1 + self.lengthVarInt64(self.entity_write_bytes_)
3683 if (self.has_commitcost_): n += 2 + self.commitcost_.ByteSizePartial()
3684 if (self.has_approximate_storage_delta_): n += 1 + self.lengthVarInt64(self.approximate_storage_delta_)
3685 if (self.has_id_sequence_updates_): n += 1 + self.lengthVarInt64(self.id_sequence_updates_)
3686 return n
3688 def Clear(self):
3689 self.clear_index_writes()
3690 self.clear_index_write_bytes()
3691 self.clear_entity_writes()
3692 self.clear_entity_write_bytes()
3693 self.clear_commitcost()
3694 self.clear_approximate_storage_delta()
3695 self.clear_id_sequence_updates()
3697 def OutputUnchecked(self, out):
3698 if (self.has_index_writes_):
3699 out.putVarInt32(8)
3700 out.putVarInt32(self.index_writes_)
3701 if (self.has_index_write_bytes_):
3702 out.putVarInt32(16)
3703 out.putVarInt32(self.index_write_bytes_)
3704 if (self.has_entity_writes_):
3705 out.putVarInt32(24)
3706 out.putVarInt32(self.entity_writes_)
3707 if (self.has_entity_write_bytes_):
3708 out.putVarInt32(32)
3709 out.putVarInt32(self.entity_write_bytes_)
3710 if (self.has_commitcost_):
3711 out.putVarInt32(43)
3712 self.commitcost_.OutputUnchecked(out)
3713 out.putVarInt32(44)
3714 if (self.has_approximate_storage_delta_):
3715 out.putVarInt32(64)
3716 out.putVarInt32(self.approximate_storage_delta_)
3717 if (self.has_id_sequence_updates_):
3718 out.putVarInt32(72)
3719 out.putVarInt32(self.id_sequence_updates_)
3721 def OutputPartial(self, out):
3722 if (self.has_index_writes_):
3723 out.putVarInt32(8)
3724 out.putVarInt32(self.index_writes_)
3725 if (self.has_index_write_bytes_):
3726 out.putVarInt32(16)
3727 out.putVarInt32(self.index_write_bytes_)
3728 if (self.has_entity_writes_):
3729 out.putVarInt32(24)
3730 out.putVarInt32(self.entity_writes_)
3731 if (self.has_entity_write_bytes_):
3732 out.putVarInt32(32)
3733 out.putVarInt32(self.entity_write_bytes_)
3734 if (self.has_commitcost_):
3735 out.putVarInt32(43)
3736 self.commitcost_.OutputPartial(out)
3737 out.putVarInt32(44)
3738 if (self.has_approximate_storage_delta_):
3739 out.putVarInt32(64)
3740 out.putVarInt32(self.approximate_storage_delta_)
3741 if (self.has_id_sequence_updates_):
3742 out.putVarInt32(72)
3743 out.putVarInt32(self.id_sequence_updates_)
3745 def TryMerge(self, d):
3746 while d.avail() > 0:
3747 tt = d.getVarInt32()
3748 if tt == 8:
3749 self.set_index_writes(d.getVarInt32())
3750 continue
3751 if tt == 16:
3752 self.set_index_write_bytes(d.getVarInt32())
3753 continue
3754 if tt == 24:
3755 self.set_entity_writes(d.getVarInt32())
3756 continue
3757 if tt == 32:
3758 self.set_entity_write_bytes(d.getVarInt32())
3759 continue
3760 if tt == 43:
3761 self.mutable_commitcost().TryMerge(d)
3762 continue
3763 if tt == 64:
3764 self.set_approximate_storage_delta(d.getVarInt32())
3765 continue
3766 if tt == 72:
3767 self.set_id_sequence_updates(d.getVarInt32())
3768 continue
3771 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3772 d.skipData(tt)
3775 def __str__(self, prefix="", printElemNumber=0):
3776 res=""
3777 if self.has_index_writes_: res+=prefix+("index_writes: %s\n" % self.DebugFormatInt32(self.index_writes_))
3778 if self.has_index_write_bytes_: res+=prefix+("index_write_bytes: %s\n" % self.DebugFormatInt32(self.index_write_bytes_))
3779 if self.has_entity_writes_: res+=prefix+("entity_writes: %s\n" % self.DebugFormatInt32(self.entity_writes_))
3780 if self.has_entity_write_bytes_: res+=prefix+("entity_write_bytes: %s\n" % self.DebugFormatInt32(self.entity_write_bytes_))
3781 if self.has_commitcost_:
3782 res+=prefix+"CommitCost {\n"
3783 res+=self.commitcost_.__str__(prefix + " ", printElemNumber)
3784 res+=prefix+"}\n"
3785 if self.has_approximate_storage_delta_: res+=prefix+("approximate_storage_delta: %s\n" % self.DebugFormatInt32(self.approximate_storage_delta_))
3786 if self.has_id_sequence_updates_: res+=prefix+("id_sequence_updates: %s\n" % self.DebugFormatInt32(self.id_sequence_updates_))
3787 return res
3790 def _BuildTagLookupTable(sparse, maxtag, default=None):
3791 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3793 kindex_writes = 1
3794 kindex_write_bytes = 2
3795 kentity_writes = 3
3796 kentity_write_bytes = 4
3797 kCommitCostGroup = 5
3798 kCommitCostrequested_entity_puts = 6
3799 kCommitCostrequested_entity_deletes = 7
3800 kapproximate_storage_delta = 8
3801 kid_sequence_updates = 9
3803 _TEXT = _BuildTagLookupTable({
3804 0: "ErrorCode",
3805 1: "index_writes",
3806 2: "index_write_bytes",
3807 3: "entity_writes",
3808 4: "entity_write_bytes",
3809 5: "CommitCost",
3810 6: "requested_entity_puts",
3811 7: "requested_entity_deletes",
3812 8: "approximate_storage_delta",
3813 9: "id_sequence_updates",
3814 }, 9)
3816 _TYPES = _BuildTagLookupTable({
3817 0: ProtocolBuffer.Encoder.NUMERIC,
3818 1: ProtocolBuffer.Encoder.NUMERIC,
3819 2: ProtocolBuffer.Encoder.NUMERIC,
3820 3: ProtocolBuffer.Encoder.NUMERIC,
3821 4: ProtocolBuffer.Encoder.NUMERIC,
3822 5: ProtocolBuffer.Encoder.STARTGROUP,
3823 6: ProtocolBuffer.Encoder.NUMERIC,
3824 7: ProtocolBuffer.Encoder.NUMERIC,
3825 8: ProtocolBuffer.Encoder.NUMERIC,
3826 9: ProtocolBuffer.Encoder.NUMERIC,
3827 }, 9, ProtocolBuffer.Encoder.MAX_TYPE)
3830 _STYLE = """"""
3831 _STYLE_CONTENT_TYPE = """"""
3832 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.Cost'
3833 class GetRequest(ProtocolBuffer.ProtocolMessage):
3834 has_transaction_ = 0
3835 transaction_ = None
3836 has_failover_ms_ = 0
3837 failover_ms_ = 0
3838 has_strong_ = 0
3839 strong_ = 0
3840 has_allow_deferred_ = 0
3841 allow_deferred_ = 0
3843 def __init__(self, contents=None):
3844 self.key_ = []
3845 self.lazy_init_lock_ = thread.allocate_lock()
3846 if contents is not None: self.MergeFromString(contents)
3848 def key_size(self): return len(self.key_)
3849 def key_list(self): return self.key_
3851 def key(self, i):
3852 return self.key_[i]
3854 def mutable_key(self, i):
3855 return self.key_[i]
3857 def add_key(self):
3858 x = Reference()
3859 self.key_.append(x)
3860 return x
3862 def clear_key(self):
3863 self.key_ = []
3864 def transaction(self):
3865 if self.transaction_ is None:
3866 self.lazy_init_lock_.acquire()
3867 try:
3868 if self.transaction_ is None: self.transaction_ = Transaction()
3869 finally:
3870 self.lazy_init_lock_.release()
3871 return self.transaction_
3873 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
3875 def clear_transaction(self):
3877 if self.has_transaction_:
3878 self.has_transaction_ = 0;
3879 if self.transaction_ is not None: self.transaction_.Clear()
3881 def has_transaction(self): return self.has_transaction_
3883 def failover_ms(self): return self.failover_ms_
3885 def set_failover_ms(self, x):
3886 self.has_failover_ms_ = 1
3887 self.failover_ms_ = x
3889 def clear_failover_ms(self):
3890 if self.has_failover_ms_:
3891 self.has_failover_ms_ = 0
3892 self.failover_ms_ = 0
3894 def has_failover_ms(self): return self.has_failover_ms_
3896 def strong(self): return self.strong_
3898 def set_strong(self, x):
3899 self.has_strong_ = 1
3900 self.strong_ = x
3902 def clear_strong(self):
3903 if self.has_strong_:
3904 self.has_strong_ = 0
3905 self.strong_ = 0
3907 def has_strong(self): return self.has_strong_
3909 def allow_deferred(self): return self.allow_deferred_
3911 def set_allow_deferred(self, x):
3912 self.has_allow_deferred_ = 1
3913 self.allow_deferred_ = x
3915 def clear_allow_deferred(self):
3916 if self.has_allow_deferred_:
3917 self.has_allow_deferred_ = 0
3918 self.allow_deferred_ = 0
3920 def has_allow_deferred(self): return self.has_allow_deferred_
3923 def MergeFrom(self, x):
3924 assert x is not self
3925 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
3926 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
3927 if (x.has_failover_ms()): self.set_failover_ms(x.failover_ms())
3928 if (x.has_strong()): self.set_strong(x.strong())
3929 if (x.has_allow_deferred()): self.set_allow_deferred(x.allow_deferred())
3931 def Equals(self, x):
3932 if x is self: return 1
3933 if len(self.key_) != len(x.key_): return 0
3934 for e1, e2 in zip(self.key_, x.key_):
3935 if e1 != e2: return 0
3936 if self.has_transaction_ != x.has_transaction_: return 0
3937 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
3938 if self.has_failover_ms_ != x.has_failover_ms_: return 0
3939 if self.has_failover_ms_ and self.failover_ms_ != x.failover_ms_: return 0
3940 if self.has_strong_ != x.has_strong_: return 0
3941 if self.has_strong_ and self.strong_ != x.strong_: return 0
3942 if self.has_allow_deferred_ != x.has_allow_deferred_: return 0
3943 if self.has_allow_deferred_ and self.allow_deferred_ != x.allow_deferred_: return 0
3944 return 1
3946 def IsInitialized(self, debug_strs=None):
3947 initialized = 1
3948 for p in self.key_:
3949 if not p.IsInitialized(debug_strs): initialized=0
3950 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
3951 return initialized
3953 def ByteSize(self):
3954 n = 0
3955 n += 1 * len(self.key_)
3956 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
3957 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
3958 if (self.has_failover_ms_): n += 1 + self.lengthVarInt64(self.failover_ms_)
3959 if (self.has_strong_): n += 2
3960 if (self.has_allow_deferred_): n += 2
3961 return n
3963 def ByteSizePartial(self):
3964 n = 0
3965 n += 1 * len(self.key_)
3966 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSizePartial())
3967 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSizePartial())
3968 if (self.has_failover_ms_): n += 1 + self.lengthVarInt64(self.failover_ms_)
3969 if (self.has_strong_): n += 2
3970 if (self.has_allow_deferred_): n += 2
3971 return n
3973 def Clear(self):
3974 self.clear_key()
3975 self.clear_transaction()
3976 self.clear_failover_ms()
3977 self.clear_strong()
3978 self.clear_allow_deferred()
3980 def OutputUnchecked(self, out):
3981 for i in xrange(len(self.key_)):
3982 out.putVarInt32(10)
3983 out.putVarInt32(self.key_[i].ByteSize())
3984 self.key_[i].OutputUnchecked(out)
3985 if (self.has_transaction_):
3986 out.putVarInt32(18)
3987 out.putVarInt32(self.transaction_.ByteSize())
3988 self.transaction_.OutputUnchecked(out)
3989 if (self.has_failover_ms_):
3990 out.putVarInt32(24)
3991 out.putVarInt64(self.failover_ms_)
3992 if (self.has_strong_):
3993 out.putVarInt32(32)
3994 out.putBoolean(self.strong_)
3995 if (self.has_allow_deferred_):
3996 out.putVarInt32(40)
3997 out.putBoolean(self.allow_deferred_)
3999 def OutputPartial(self, out):
4000 for i in xrange(len(self.key_)):
4001 out.putVarInt32(10)
4002 out.putVarInt32(self.key_[i].ByteSizePartial())
4003 self.key_[i].OutputPartial(out)
4004 if (self.has_transaction_):
4005 out.putVarInt32(18)
4006 out.putVarInt32(self.transaction_.ByteSizePartial())
4007 self.transaction_.OutputPartial(out)
4008 if (self.has_failover_ms_):
4009 out.putVarInt32(24)
4010 out.putVarInt64(self.failover_ms_)
4011 if (self.has_strong_):
4012 out.putVarInt32(32)
4013 out.putBoolean(self.strong_)
4014 if (self.has_allow_deferred_):
4015 out.putVarInt32(40)
4016 out.putBoolean(self.allow_deferred_)
4018 def TryMerge(self, d):
4019 while d.avail() > 0:
4020 tt = d.getVarInt32()
4021 if tt == 10:
4022 length = d.getVarInt32()
4023 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4024 d.skip(length)
4025 self.add_key().TryMerge(tmp)
4026 continue
4027 if tt == 18:
4028 length = d.getVarInt32()
4029 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4030 d.skip(length)
4031 self.mutable_transaction().TryMerge(tmp)
4032 continue
4033 if tt == 24:
4034 self.set_failover_ms(d.getVarInt64())
4035 continue
4036 if tt == 32:
4037 self.set_strong(d.getBoolean())
4038 continue
4039 if tt == 40:
4040 self.set_allow_deferred(d.getBoolean())
4041 continue
4044 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4045 d.skipData(tt)
4048 def __str__(self, prefix="", printElemNumber=0):
4049 res=""
4050 cnt=0
4051 for e in self.key_:
4052 elm=""
4053 if printElemNumber: elm="(%d)" % cnt
4054 res+=prefix+("key%s <\n" % elm)
4055 res+=e.__str__(prefix + " ", printElemNumber)
4056 res+=prefix+">\n"
4057 cnt+=1
4058 if self.has_transaction_:
4059 res+=prefix+"transaction <\n"
4060 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
4061 res+=prefix+">\n"
4062 if self.has_failover_ms_: res+=prefix+("failover_ms: %s\n" % self.DebugFormatInt64(self.failover_ms_))
4063 if self.has_strong_: res+=prefix+("strong: %s\n" % self.DebugFormatBool(self.strong_))
4064 if self.has_allow_deferred_: res+=prefix+("allow_deferred: %s\n" % self.DebugFormatBool(self.allow_deferred_))
4065 return res
4068 def _BuildTagLookupTable(sparse, maxtag, default=None):
4069 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4071 kkey = 1
4072 ktransaction = 2
4073 kfailover_ms = 3
4074 kstrong = 4
4075 kallow_deferred = 5
4077 _TEXT = _BuildTagLookupTable({
4078 0: "ErrorCode",
4079 1: "key",
4080 2: "transaction",
4081 3: "failover_ms",
4082 4: "strong",
4083 5: "allow_deferred",
4084 }, 5)
4086 _TYPES = _BuildTagLookupTable({
4087 0: ProtocolBuffer.Encoder.NUMERIC,
4088 1: ProtocolBuffer.Encoder.STRING,
4089 2: ProtocolBuffer.Encoder.STRING,
4090 3: ProtocolBuffer.Encoder.NUMERIC,
4091 4: ProtocolBuffer.Encoder.NUMERIC,
4092 5: ProtocolBuffer.Encoder.NUMERIC,
4093 }, 5, ProtocolBuffer.Encoder.MAX_TYPE)
4096 _STYLE = """"""
4097 _STYLE_CONTENT_TYPE = """"""
4098 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.GetRequest'
4099 class GetResponse_Entity(ProtocolBuffer.ProtocolMessage):
4100 has_entity_ = 0
4101 entity_ = None
4102 has_key_ = 0
4103 key_ = None
4104 has_version_ = 0
4105 version_ = 0
4107 def __init__(self, contents=None):
4108 self.lazy_init_lock_ = thread.allocate_lock()
4109 if contents is not None: self.MergeFromString(contents)
4111 def entity(self):
4112 if self.entity_ is None:
4113 self.lazy_init_lock_.acquire()
4114 try:
4115 if self.entity_ is None: self.entity_ = EntityProto()
4116 finally:
4117 self.lazy_init_lock_.release()
4118 return self.entity_
4120 def mutable_entity(self): self.has_entity_ = 1; return self.entity()
4122 def clear_entity(self):
4124 if self.has_entity_:
4125 self.has_entity_ = 0;
4126 if self.entity_ is not None: self.entity_.Clear()
4128 def has_entity(self): return self.has_entity_
4130 def key(self):
4131 if self.key_ is None:
4132 self.lazy_init_lock_.acquire()
4133 try:
4134 if self.key_ is None: self.key_ = Reference()
4135 finally:
4136 self.lazy_init_lock_.release()
4137 return self.key_
4139 def mutable_key(self): self.has_key_ = 1; return self.key()
4141 def clear_key(self):
4143 if self.has_key_:
4144 self.has_key_ = 0;
4145 if self.key_ is not None: self.key_.Clear()
4147 def has_key(self): return self.has_key_
4149 def version(self): return self.version_
4151 def set_version(self, x):
4152 self.has_version_ = 1
4153 self.version_ = x
4155 def clear_version(self):
4156 if self.has_version_:
4157 self.has_version_ = 0
4158 self.version_ = 0
4160 def has_version(self): return self.has_version_
4163 def MergeFrom(self, x):
4164 assert x is not self
4165 if (x.has_entity()): self.mutable_entity().MergeFrom(x.entity())
4166 if (x.has_key()): self.mutable_key().MergeFrom(x.key())
4167 if (x.has_version()): self.set_version(x.version())
4169 def Equals(self, x):
4170 if x is self: return 1
4171 if self.has_entity_ != x.has_entity_: return 0
4172 if self.has_entity_ and self.entity_ != x.entity_: return 0
4173 if self.has_key_ != x.has_key_: return 0
4174 if self.has_key_ and self.key_ != x.key_: return 0
4175 if self.has_version_ != x.has_version_: return 0
4176 if self.has_version_ and self.version_ != x.version_: return 0
4177 return 1
4179 def IsInitialized(self, debug_strs=None):
4180 initialized = 1
4181 if (self.has_entity_ and not self.entity_.IsInitialized(debug_strs)): initialized = 0
4182 if (self.has_key_ and not self.key_.IsInitialized(debug_strs)): initialized = 0
4183 return initialized
4185 def ByteSize(self):
4186 n = 0
4187 if (self.has_entity_): n += 1 + self.lengthString(self.entity_.ByteSize())
4188 if (self.has_key_): n += 1 + self.lengthString(self.key_.ByteSize())
4189 if (self.has_version_): n += 1 + self.lengthVarInt64(self.version_)
4190 return n
4192 def ByteSizePartial(self):
4193 n = 0
4194 if (self.has_entity_): n += 1 + self.lengthString(self.entity_.ByteSizePartial())
4195 if (self.has_key_): n += 1 + self.lengthString(self.key_.ByteSizePartial())
4196 if (self.has_version_): n += 1 + self.lengthVarInt64(self.version_)
4197 return n
4199 def Clear(self):
4200 self.clear_entity()
4201 self.clear_key()
4202 self.clear_version()
4204 def OutputUnchecked(self, out):
4205 if (self.has_entity_):
4206 out.putVarInt32(18)
4207 out.putVarInt32(self.entity_.ByteSize())
4208 self.entity_.OutputUnchecked(out)
4209 if (self.has_version_):
4210 out.putVarInt32(24)
4211 out.putVarInt64(self.version_)
4212 if (self.has_key_):
4213 out.putVarInt32(34)
4214 out.putVarInt32(self.key_.ByteSize())
4215 self.key_.OutputUnchecked(out)
4217 def OutputPartial(self, out):
4218 if (self.has_entity_):
4219 out.putVarInt32(18)
4220 out.putVarInt32(self.entity_.ByteSizePartial())
4221 self.entity_.OutputPartial(out)
4222 if (self.has_version_):
4223 out.putVarInt32(24)
4224 out.putVarInt64(self.version_)
4225 if (self.has_key_):
4226 out.putVarInt32(34)
4227 out.putVarInt32(self.key_.ByteSizePartial())
4228 self.key_.OutputPartial(out)
4230 def TryMerge(self, d):
4231 while 1:
4232 tt = d.getVarInt32()
4233 if tt == 12: break
4234 if tt == 18:
4235 length = d.getVarInt32()
4236 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4237 d.skip(length)
4238 self.mutable_entity().TryMerge(tmp)
4239 continue
4240 if tt == 24:
4241 self.set_version(d.getVarInt64())
4242 continue
4243 if tt == 34:
4244 length = d.getVarInt32()
4245 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4246 d.skip(length)
4247 self.mutable_key().TryMerge(tmp)
4248 continue
4251 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4252 d.skipData(tt)
4255 def __str__(self, prefix="", printElemNumber=0):
4256 res=""
4257 if self.has_entity_:
4258 res+=prefix+"entity <\n"
4259 res+=self.entity_.__str__(prefix + " ", printElemNumber)
4260 res+=prefix+">\n"
4261 if self.has_key_:
4262 res+=prefix+"key <\n"
4263 res+=self.key_.__str__(prefix + " ", printElemNumber)
4264 res+=prefix+">\n"
4265 if self.has_version_: res+=prefix+("version: %s\n" % self.DebugFormatInt64(self.version_))
4266 return res
4268 class GetResponse(ProtocolBuffer.ProtocolMessage):
4269 has_in_order_ = 0
4270 in_order_ = 1
4272 def __init__(self, contents=None):
4273 self.entity_ = []
4274 self.deferred_ = []
4275 if contents is not None: self.MergeFromString(contents)
4277 def entity_size(self): return len(self.entity_)
4278 def entity_list(self): return self.entity_
4280 def entity(self, i):
4281 return self.entity_[i]
4283 def mutable_entity(self, i):
4284 return self.entity_[i]
4286 def add_entity(self):
4287 x = GetResponse_Entity()
4288 self.entity_.append(x)
4289 return x
4291 def clear_entity(self):
4292 self.entity_ = []
4293 def deferred_size(self): return len(self.deferred_)
4294 def deferred_list(self): return self.deferred_
4296 def deferred(self, i):
4297 return self.deferred_[i]
4299 def mutable_deferred(self, i):
4300 return self.deferred_[i]
4302 def add_deferred(self):
4303 x = Reference()
4304 self.deferred_.append(x)
4305 return x
4307 def clear_deferred(self):
4308 self.deferred_ = []
4309 def in_order(self): return self.in_order_
4311 def set_in_order(self, x):
4312 self.has_in_order_ = 1
4313 self.in_order_ = x
4315 def clear_in_order(self):
4316 if self.has_in_order_:
4317 self.has_in_order_ = 0
4318 self.in_order_ = 1
4320 def has_in_order(self): return self.has_in_order_
4323 def MergeFrom(self, x):
4324 assert x is not self
4325 for i in xrange(x.entity_size()): self.add_entity().CopyFrom(x.entity(i))
4326 for i in xrange(x.deferred_size()): self.add_deferred().CopyFrom(x.deferred(i))
4327 if (x.has_in_order()): self.set_in_order(x.in_order())
4329 def Equals(self, x):
4330 if x is self: return 1
4331 if len(self.entity_) != len(x.entity_): return 0
4332 for e1, e2 in zip(self.entity_, x.entity_):
4333 if e1 != e2: return 0
4334 if len(self.deferred_) != len(x.deferred_): return 0
4335 for e1, e2 in zip(self.deferred_, x.deferred_):
4336 if e1 != e2: return 0
4337 if self.has_in_order_ != x.has_in_order_: return 0
4338 if self.has_in_order_ and self.in_order_ != x.in_order_: return 0
4339 return 1
4341 def IsInitialized(self, debug_strs=None):
4342 initialized = 1
4343 for p in self.entity_:
4344 if not p.IsInitialized(debug_strs): initialized=0
4345 for p in self.deferred_:
4346 if not p.IsInitialized(debug_strs): initialized=0
4347 return initialized
4349 def ByteSize(self):
4350 n = 0
4351 n += 2 * len(self.entity_)
4352 for i in xrange(len(self.entity_)): n += self.entity_[i].ByteSize()
4353 n += 1 * len(self.deferred_)
4354 for i in xrange(len(self.deferred_)): n += self.lengthString(self.deferred_[i].ByteSize())
4355 if (self.has_in_order_): n += 2
4356 return n
4358 def ByteSizePartial(self):
4359 n = 0
4360 n += 2 * len(self.entity_)
4361 for i in xrange(len(self.entity_)): n += self.entity_[i].ByteSizePartial()
4362 n += 1 * len(self.deferred_)
4363 for i in xrange(len(self.deferred_)): n += self.lengthString(self.deferred_[i].ByteSizePartial())
4364 if (self.has_in_order_): n += 2
4365 return n
4367 def Clear(self):
4368 self.clear_entity()
4369 self.clear_deferred()
4370 self.clear_in_order()
4372 def OutputUnchecked(self, out):
4373 for i in xrange(len(self.entity_)):
4374 out.putVarInt32(11)
4375 self.entity_[i].OutputUnchecked(out)
4376 out.putVarInt32(12)
4377 for i in xrange(len(self.deferred_)):
4378 out.putVarInt32(42)
4379 out.putVarInt32(self.deferred_[i].ByteSize())
4380 self.deferred_[i].OutputUnchecked(out)
4381 if (self.has_in_order_):
4382 out.putVarInt32(48)
4383 out.putBoolean(self.in_order_)
4385 def OutputPartial(self, out):
4386 for i in xrange(len(self.entity_)):
4387 out.putVarInt32(11)
4388 self.entity_[i].OutputPartial(out)
4389 out.putVarInt32(12)
4390 for i in xrange(len(self.deferred_)):
4391 out.putVarInt32(42)
4392 out.putVarInt32(self.deferred_[i].ByteSizePartial())
4393 self.deferred_[i].OutputPartial(out)
4394 if (self.has_in_order_):
4395 out.putVarInt32(48)
4396 out.putBoolean(self.in_order_)
4398 def TryMerge(self, d):
4399 while d.avail() > 0:
4400 tt = d.getVarInt32()
4401 if tt == 11:
4402 self.add_entity().TryMerge(d)
4403 continue
4404 if tt == 42:
4405 length = d.getVarInt32()
4406 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4407 d.skip(length)
4408 self.add_deferred().TryMerge(tmp)
4409 continue
4410 if tt == 48:
4411 self.set_in_order(d.getBoolean())
4412 continue
4415 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4416 d.skipData(tt)
4419 def __str__(self, prefix="", printElemNumber=0):
4420 res=""
4421 cnt=0
4422 for e in self.entity_:
4423 elm=""
4424 if printElemNumber: elm="(%d)" % cnt
4425 res+=prefix+("Entity%s {\n" % elm)
4426 res+=e.__str__(prefix + " ", printElemNumber)
4427 res+=prefix+"}\n"
4428 cnt+=1
4429 cnt=0
4430 for e in self.deferred_:
4431 elm=""
4432 if printElemNumber: elm="(%d)" % cnt
4433 res+=prefix+("deferred%s <\n" % elm)
4434 res+=e.__str__(prefix + " ", printElemNumber)
4435 res+=prefix+">\n"
4436 cnt+=1
4437 if self.has_in_order_: res+=prefix+("in_order: %s\n" % self.DebugFormatBool(self.in_order_))
4438 return res
4441 def _BuildTagLookupTable(sparse, maxtag, default=None):
4442 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4444 kEntityGroup = 1
4445 kEntityentity = 2
4446 kEntitykey = 4
4447 kEntityversion = 3
4448 kdeferred = 5
4449 kin_order = 6
4451 _TEXT = _BuildTagLookupTable({
4452 0: "ErrorCode",
4453 1: "Entity",
4454 2: "entity",
4455 3: "version",
4456 4: "key",
4457 5: "deferred",
4458 6: "in_order",
4459 }, 6)
4461 _TYPES = _BuildTagLookupTable({
4462 0: ProtocolBuffer.Encoder.NUMERIC,
4463 1: ProtocolBuffer.Encoder.STARTGROUP,
4464 2: ProtocolBuffer.Encoder.STRING,
4465 3: ProtocolBuffer.Encoder.NUMERIC,
4466 4: ProtocolBuffer.Encoder.STRING,
4467 5: ProtocolBuffer.Encoder.STRING,
4468 6: ProtocolBuffer.Encoder.NUMERIC,
4469 }, 6, ProtocolBuffer.Encoder.MAX_TYPE)
4472 _STYLE = """"""
4473 _STYLE_CONTENT_TYPE = """"""
4474 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.GetResponse'
4475 class PutRequest(ProtocolBuffer.ProtocolMessage):
4478 CURRENT = 0
4479 SEQUENTIAL = 1
4481 _AutoIdPolicy_NAMES = {
4482 0: "CURRENT",
4483 1: "SEQUENTIAL",
4486 def AutoIdPolicy_Name(cls, x): return cls._AutoIdPolicy_NAMES.get(x, "")
4487 AutoIdPolicy_Name = classmethod(AutoIdPolicy_Name)
4489 has_transaction_ = 0
4490 transaction_ = None
4491 has_trusted_ = 0
4492 trusted_ = 0
4493 has_force_ = 0
4494 force_ = 0
4495 has_mark_changes_ = 0
4496 mark_changes_ = 0
4497 has_auto_id_policy_ = 0
4498 auto_id_policy_ = 0
4500 def __init__(self, contents=None):
4501 self.entity_ = []
4502 self.composite_index_ = []
4503 self.snapshot_ = []
4504 self.lazy_init_lock_ = thread.allocate_lock()
4505 if contents is not None: self.MergeFromString(contents)
4507 def entity_size(self): return len(self.entity_)
4508 def entity_list(self): return self.entity_
4510 def entity(self, i):
4511 return self.entity_[i]
4513 def mutable_entity(self, i):
4514 return self.entity_[i]
4516 def add_entity(self):
4517 x = EntityProto()
4518 self.entity_.append(x)
4519 return x
4521 def clear_entity(self):
4522 self.entity_ = []
4523 def transaction(self):
4524 if self.transaction_ is None:
4525 self.lazy_init_lock_.acquire()
4526 try:
4527 if self.transaction_ is None: self.transaction_ = Transaction()
4528 finally:
4529 self.lazy_init_lock_.release()
4530 return self.transaction_
4532 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
4534 def clear_transaction(self):
4536 if self.has_transaction_:
4537 self.has_transaction_ = 0;
4538 if self.transaction_ is not None: self.transaction_.Clear()
4540 def has_transaction(self): return self.has_transaction_
4542 def composite_index_size(self): return len(self.composite_index_)
4543 def composite_index_list(self): return self.composite_index_
4545 def composite_index(self, i):
4546 return self.composite_index_[i]
4548 def mutable_composite_index(self, i):
4549 return self.composite_index_[i]
4551 def add_composite_index(self):
4552 x = CompositeIndex()
4553 self.composite_index_.append(x)
4554 return x
4556 def clear_composite_index(self):
4557 self.composite_index_ = []
4558 def trusted(self): return self.trusted_
4560 def set_trusted(self, x):
4561 self.has_trusted_ = 1
4562 self.trusted_ = x
4564 def clear_trusted(self):
4565 if self.has_trusted_:
4566 self.has_trusted_ = 0
4567 self.trusted_ = 0
4569 def has_trusted(self): return self.has_trusted_
4571 def force(self): return self.force_
4573 def set_force(self, x):
4574 self.has_force_ = 1
4575 self.force_ = x
4577 def clear_force(self):
4578 if self.has_force_:
4579 self.has_force_ = 0
4580 self.force_ = 0
4582 def has_force(self): return self.has_force_
4584 def mark_changes(self): return self.mark_changes_
4586 def set_mark_changes(self, x):
4587 self.has_mark_changes_ = 1
4588 self.mark_changes_ = x
4590 def clear_mark_changes(self):
4591 if self.has_mark_changes_:
4592 self.has_mark_changes_ = 0
4593 self.mark_changes_ = 0
4595 def has_mark_changes(self): return self.has_mark_changes_
4597 def snapshot_size(self): return len(self.snapshot_)
4598 def snapshot_list(self): return self.snapshot_
4600 def snapshot(self, i):
4601 return self.snapshot_[i]
4603 def mutable_snapshot(self, i):
4604 return self.snapshot_[i]
4606 def add_snapshot(self):
4607 x = Snapshot()
4608 self.snapshot_.append(x)
4609 return x
4611 def clear_snapshot(self):
4612 self.snapshot_ = []
4613 def auto_id_policy(self): return self.auto_id_policy_
4615 def set_auto_id_policy(self, x):
4616 self.has_auto_id_policy_ = 1
4617 self.auto_id_policy_ = x
4619 def clear_auto_id_policy(self):
4620 if self.has_auto_id_policy_:
4621 self.has_auto_id_policy_ = 0
4622 self.auto_id_policy_ = 0
4624 def has_auto_id_policy(self): return self.has_auto_id_policy_
4627 def MergeFrom(self, x):
4628 assert x is not self
4629 for i in xrange(x.entity_size()): self.add_entity().CopyFrom(x.entity(i))
4630 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
4631 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
4632 if (x.has_trusted()): self.set_trusted(x.trusted())
4633 if (x.has_force()): self.set_force(x.force())
4634 if (x.has_mark_changes()): self.set_mark_changes(x.mark_changes())
4635 for i in xrange(x.snapshot_size()): self.add_snapshot().CopyFrom(x.snapshot(i))
4636 if (x.has_auto_id_policy()): self.set_auto_id_policy(x.auto_id_policy())
4638 def Equals(self, x):
4639 if x is self: return 1
4640 if len(self.entity_) != len(x.entity_): return 0
4641 for e1, e2 in zip(self.entity_, x.entity_):
4642 if e1 != e2: return 0
4643 if self.has_transaction_ != x.has_transaction_: return 0
4644 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
4645 if len(self.composite_index_) != len(x.composite_index_): return 0
4646 for e1, e2 in zip(self.composite_index_, x.composite_index_):
4647 if e1 != e2: return 0
4648 if self.has_trusted_ != x.has_trusted_: return 0
4649 if self.has_trusted_ and self.trusted_ != x.trusted_: return 0
4650 if self.has_force_ != x.has_force_: return 0
4651 if self.has_force_ and self.force_ != x.force_: return 0
4652 if self.has_mark_changes_ != x.has_mark_changes_: return 0
4653 if self.has_mark_changes_ and self.mark_changes_ != x.mark_changes_: return 0
4654 if len(self.snapshot_) != len(x.snapshot_): return 0
4655 for e1, e2 in zip(self.snapshot_, x.snapshot_):
4656 if e1 != e2: return 0
4657 if self.has_auto_id_policy_ != x.has_auto_id_policy_: return 0
4658 if self.has_auto_id_policy_ and self.auto_id_policy_ != x.auto_id_policy_: return 0
4659 return 1
4661 def IsInitialized(self, debug_strs=None):
4662 initialized = 1
4663 for p in self.entity_:
4664 if not p.IsInitialized(debug_strs): initialized=0
4665 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
4666 for p in self.composite_index_:
4667 if not p.IsInitialized(debug_strs): initialized=0
4668 for p in self.snapshot_:
4669 if not p.IsInitialized(debug_strs): initialized=0
4670 return initialized
4672 def ByteSize(self):
4673 n = 0
4674 n += 1 * len(self.entity_)
4675 for i in xrange(len(self.entity_)): n += self.lengthString(self.entity_[i].ByteSize())
4676 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
4677 n += 1 * len(self.composite_index_)
4678 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
4679 if (self.has_trusted_): n += 2
4680 if (self.has_force_): n += 2
4681 if (self.has_mark_changes_): n += 2
4682 n += 1 * len(self.snapshot_)
4683 for i in xrange(len(self.snapshot_)): n += self.lengthString(self.snapshot_[i].ByteSize())
4684 if (self.has_auto_id_policy_): n += 1 + self.lengthVarInt64(self.auto_id_policy_)
4685 return n
4687 def ByteSizePartial(self):
4688 n = 0
4689 n += 1 * len(self.entity_)
4690 for i in xrange(len(self.entity_)): n += self.lengthString(self.entity_[i].ByteSizePartial())
4691 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSizePartial())
4692 n += 1 * len(self.composite_index_)
4693 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSizePartial())
4694 if (self.has_trusted_): n += 2
4695 if (self.has_force_): n += 2
4696 if (self.has_mark_changes_): n += 2
4697 n += 1 * len(self.snapshot_)
4698 for i in xrange(len(self.snapshot_)): n += self.lengthString(self.snapshot_[i].ByteSizePartial())
4699 if (self.has_auto_id_policy_): n += 1 + self.lengthVarInt64(self.auto_id_policy_)
4700 return n
4702 def Clear(self):
4703 self.clear_entity()
4704 self.clear_transaction()
4705 self.clear_composite_index()
4706 self.clear_trusted()
4707 self.clear_force()
4708 self.clear_mark_changes()
4709 self.clear_snapshot()
4710 self.clear_auto_id_policy()
4712 def OutputUnchecked(self, out):
4713 for i in xrange(len(self.entity_)):
4714 out.putVarInt32(10)
4715 out.putVarInt32(self.entity_[i].ByteSize())
4716 self.entity_[i].OutputUnchecked(out)
4717 if (self.has_transaction_):
4718 out.putVarInt32(18)
4719 out.putVarInt32(self.transaction_.ByteSize())
4720 self.transaction_.OutputUnchecked(out)
4721 for i in xrange(len(self.composite_index_)):
4722 out.putVarInt32(26)
4723 out.putVarInt32(self.composite_index_[i].ByteSize())
4724 self.composite_index_[i].OutputUnchecked(out)
4725 if (self.has_trusted_):
4726 out.putVarInt32(32)
4727 out.putBoolean(self.trusted_)
4728 if (self.has_force_):
4729 out.putVarInt32(56)
4730 out.putBoolean(self.force_)
4731 if (self.has_mark_changes_):
4732 out.putVarInt32(64)
4733 out.putBoolean(self.mark_changes_)
4734 for i in xrange(len(self.snapshot_)):
4735 out.putVarInt32(74)
4736 out.putVarInt32(self.snapshot_[i].ByteSize())
4737 self.snapshot_[i].OutputUnchecked(out)
4738 if (self.has_auto_id_policy_):
4739 out.putVarInt32(80)
4740 out.putVarInt32(self.auto_id_policy_)
4742 def OutputPartial(self, out):
4743 for i in xrange(len(self.entity_)):
4744 out.putVarInt32(10)
4745 out.putVarInt32(self.entity_[i].ByteSizePartial())
4746 self.entity_[i].OutputPartial(out)
4747 if (self.has_transaction_):
4748 out.putVarInt32(18)
4749 out.putVarInt32(self.transaction_.ByteSizePartial())
4750 self.transaction_.OutputPartial(out)
4751 for i in xrange(len(self.composite_index_)):
4752 out.putVarInt32(26)
4753 out.putVarInt32(self.composite_index_[i].ByteSizePartial())
4754 self.composite_index_[i].OutputPartial(out)
4755 if (self.has_trusted_):
4756 out.putVarInt32(32)
4757 out.putBoolean(self.trusted_)
4758 if (self.has_force_):
4759 out.putVarInt32(56)
4760 out.putBoolean(self.force_)
4761 if (self.has_mark_changes_):
4762 out.putVarInt32(64)
4763 out.putBoolean(self.mark_changes_)
4764 for i in xrange(len(self.snapshot_)):
4765 out.putVarInt32(74)
4766 out.putVarInt32(self.snapshot_[i].ByteSizePartial())
4767 self.snapshot_[i].OutputPartial(out)
4768 if (self.has_auto_id_policy_):
4769 out.putVarInt32(80)
4770 out.putVarInt32(self.auto_id_policy_)
4772 def TryMerge(self, d):
4773 while d.avail() > 0:
4774 tt = d.getVarInt32()
4775 if tt == 10:
4776 length = d.getVarInt32()
4777 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4778 d.skip(length)
4779 self.add_entity().TryMerge(tmp)
4780 continue
4781 if tt == 18:
4782 length = d.getVarInt32()
4783 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4784 d.skip(length)
4785 self.mutable_transaction().TryMerge(tmp)
4786 continue
4787 if tt == 26:
4788 length = d.getVarInt32()
4789 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4790 d.skip(length)
4791 self.add_composite_index().TryMerge(tmp)
4792 continue
4793 if tt == 32:
4794 self.set_trusted(d.getBoolean())
4795 continue
4796 if tt == 56:
4797 self.set_force(d.getBoolean())
4798 continue
4799 if tt == 64:
4800 self.set_mark_changes(d.getBoolean())
4801 continue
4802 if tt == 74:
4803 length = d.getVarInt32()
4804 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4805 d.skip(length)
4806 self.add_snapshot().TryMerge(tmp)
4807 continue
4808 if tt == 80:
4809 self.set_auto_id_policy(d.getVarInt32())
4810 continue
4813 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4814 d.skipData(tt)
4817 def __str__(self, prefix="", printElemNumber=0):
4818 res=""
4819 cnt=0
4820 for e in self.entity_:
4821 elm=""
4822 if printElemNumber: elm="(%d)" % cnt
4823 res+=prefix+("entity%s <\n" % elm)
4824 res+=e.__str__(prefix + " ", printElemNumber)
4825 res+=prefix+">\n"
4826 cnt+=1
4827 if self.has_transaction_:
4828 res+=prefix+"transaction <\n"
4829 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
4830 res+=prefix+">\n"
4831 cnt=0
4832 for e in self.composite_index_:
4833 elm=""
4834 if printElemNumber: elm="(%d)" % cnt
4835 res+=prefix+("composite_index%s <\n" % elm)
4836 res+=e.__str__(prefix + " ", printElemNumber)
4837 res+=prefix+">\n"
4838 cnt+=1
4839 if self.has_trusted_: res+=prefix+("trusted: %s\n" % self.DebugFormatBool(self.trusted_))
4840 if self.has_force_: res+=prefix+("force: %s\n" % self.DebugFormatBool(self.force_))
4841 if self.has_mark_changes_: res+=prefix+("mark_changes: %s\n" % self.DebugFormatBool(self.mark_changes_))
4842 cnt=0
4843 for e in self.snapshot_:
4844 elm=""
4845 if printElemNumber: elm="(%d)" % cnt
4846 res+=prefix+("snapshot%s <\n" % elm)
4847 res+=e.__str__(prefix + " ", printElemNumber)
4848 res+=prefix+">\n"
4849 cnt+=1
4850 if self.has_auto_id_policy_: res+=prefix+("auto_id_policy: %s\n" % self.DebugFormatInt32(self.auto_id_policy_))
4851 return res
4854 def _BuildTagLookupTable(sparse, maxtag, default=None):
4855 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4857 kentity = 1
4858 ktransaction = 2
4859 kcomposite_index = 3
4860 ktrusted = 4
4861 kforce = 7
4862 kmark_changes = 8
4863 ksnapshot = 9
4864 kauto_id_policy = 10
4866 _TEXT = _BuildTagLookupTable({
4867 0: "ErrorCode",
4868 1: "entity",
4869 2: "transaction",
4870 3: "composite_index",
4871 4: "trusted",
4872 7: "force",
4873 8: "mark_changes",
4874 9: "snapshot",
4875 10: "auto_id_policy",
4876 }, 10)
4878 _TYPES = _BuildTagLookupTable({
4879 0: ProtocolBuffer.Encoder.NUMERIC,
4880 1: ProtocolBuffer.Encoder.STRING,
4881 2: ProtocolBuffer.Encoder.STRING,
4882 3: ProtocolBuffer.Encoder.STRING,
4883 4: ProtocolBuffer.Encoder.NUMERIC,
4884 7: ProtocolBuffer.Encoder.NUMERIC,
4885 8: ProtocolBuffer.Encoder.NUMERIC,
4886 9: ProtocolBuffer.Encoder.STRING,
4887 10: ProtocolBuffer.Encoder.NUMERIC,
4888 }, 10, ProtocolBuffer.Encoder.MAX_TYPE)
4891 _STYLE = """"""
4892 _STYLE_CONTENT_TYPE = """"""
4893 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.PutRequest'
4894 class PutResponse(ProtocolBuffer.ProtocolMessage):
4895 has_cost_ = 0
4896 cost_ = None
4898 def __init__(self, contents=None):
4899 self.key_ = []
4900 self.version_ = []
4901 self.lazy_init_lock_ = thread.allocate_lock()
4902 if contents is not None: self.MergeFromString(contents)
4904 def key_size(self): return len(self.key_)
4905 def key_list(self): return self.key_
4907 def key(self, i):
4908 return self.key_[i]
4910 def mutable_key(self, i):
4911 return self.key_[i]
4913 def add_key(self):
4914 x = Reference()
4915 self.key_.append(x)
4916 return x
4918 def clear_key(self):
4919 self.key_ = []
4920 def cost(self):
4921 if self.cost_ is None:
4922 self.lazy_init_lock_.acquire()
4923 try:
4924 if self.cost_ is None: self.cost_ = Cost()
4925 finally:
4926 self.lazy_init_lock_.release()
4927 return self.cost_
4929 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
4931 def clear_cost(self):
4933 if self.has_cost_:
4934 self.has_cost_ = 0;
4935 if self.cost_ is not None: self.cost_.Clear()
4937 def has_cost(self): return self.has_cost_
4939 def version_size(self): return len(self.version_)
4940 def version_list(self): return self.version_
4942 def version(self, i):
4943 return self.version_[i]
4945 def set_version(self, i, x):
4946 self.version_[i] = x
4948 def add_version(self, x):
4949 self.version_.append(x)
4951 def clear_version(self):
4952 self.version_ = []
4955 def MergeFrom(self, x):
4956 assert x is not self
4957 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
4958 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
4959 for i in xrange(x.version_size()): self.add_version(x.version(i))
4961 def Equals(self, x):
4962 if x is self: return 1
4963 if len(self.key_) != len(x.key_): return 0
4964 for e1, e2 in zip(self.key_, x.key_):
4965 if e1 != e2: return 0
4966 if self.has_cost_ != x.has_cost_: return 0
4967 if self.has_cost_ and self.cost_ != x.cost_: return 0
4968 if len(self.version_) != len(x.version_): return 0
4969 for e1, e2 in zip(self.version_, x.version_):
4970 if e1 != e2: return 0
4971 return 1
4973 def IsInitialized(self, debug_strs=None):
4974 initialized = 1
4975 for p in self.key_:
4976 if not p.IsInitialized(debug_strs): initialized=0
4977 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
4978 return initialized
4980 def ByteSize(self):
4981 n = 0
4982 n += 1 * len(self.key_)
4983 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
4984 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
4985 n += 1 * len(self.version_)
4986 for i in xrange(len(self.version_)): n += self.lengthVarInt64(self.version_[i])
4987 return n
4989 def ByteSizePartial(self):
4990 n = 0
4991 n += 1 * len(self.key_)
4992 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSizePartial())
4993 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSizePartial())
4994 n += 1 * len(self.version_)
4995 for i in xrange(len(self.version_)): n += self.lengthVarInt64(self.version_[i])
4996 return n
4998 def Clear(self):
4999 self.clear_key()
5000 self.clear_cost()
5001 self.clear_version()
5003 def OutputUnchecked(self, out):
5004 for i in xrange(len(self.key_)):
5005 out.putVarInt32(10)
5006 out.putVarInt32(self.key_[i].ByteSize())
5007 self.key_[i].OutputUnchecked(out)
5008 if (self.has_cost_):
5009 out.putVarInt32(18)
5010 out.putVarInt32(self.cost_.ByteSize())
5011 self.cost_.OutputUnchecked(out)
5012 for i in xrange(len(self.version_)):
5013 out.putVarInt32(24)
5014 out.putVarInt64(self.version_[i])
5016 def OutputPartial(self, out):
5017 for i in xrange(len(self.key_)):
5018 out.putVarInt32(10)
5019 out.putVarInt32(self.key_[i].ByteSizePartial())
5020 self.key_[i].OutputPartial(out)
5021 if (self.has_cost_):
5022 out.putVarInt32(18)
5023 out.putVarInt32(self.cost_.ByteSizePartial())
5024 self.cost_.OutputPartial(out)
5025 for i in xrange(len(self.version_)):
5026 out.putVarInt32(24)
5027 out.putVarInt64(self.version_[i])
5029 def TryMerge(self, d):
5030 while d.avail() > 0:
5031 tt = d.getVarInt32()
5032 if tt == 10:
5033 length = d.getVarInt32()
5034 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5035 d.skip(length)
5036 self.add_key().TryMerge(tmp)
5037 continue
5038 if tt == 18:
5039 length = d.getVarInt32()
5040 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5041 d.skip(length)
5042 self.mutable_cost().TryMerge(tmp)
5043 continue
5044 if tt == 24:
5045 self.add_version(d.getVarInt64())
5046 continue
5049 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
5050 d.skipData(tt)
5053 def __str__(self, prefix="", printElemNumber=0):
5054 res=""
5055 cnt=0
5056 for e in self.key_:
5057 elm=""
5058 if printElemNumber: elm="(%d)" % cnt
5059 res+=prefix+("key%s <\n" % elm)
5060 res+=e.__str__(prefix + " ", printElemNumber)
5061 res+=prefix+">\n"
5062 cnt+=1
5063 if self.has_cost_:
5064 res+=prefix+"cost <\n"
5065 res+=self.cost_.__str__(prefix + " ", printElemNumber)
5066 res+=prefix+">\n"
5067 cnt=0
5068 for e in self.version_:
5069 elm=""
5070 if printElemNumber: elm="(%d)" % cnt
5071 res+=prefix+("version%s: %s\n" % (elm, self.DebugFormatInt64(e)))
5072 cnt+=1
5073 return res
5076 def _BuildTagLookupTable(sparse, maxtag, default=None):
5077 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
5079 kkey = 1
5080 kcost = 2
5081 kversion = 3
5083 _TEXT = _BuildTagLookupTable({
5084 0: "ErrorCode",
5085 1: "key",
5086 2: "cost",
5087 3: "version",
5088 }, 3)
5090 _TYPES = _BuildTagLookupTable({
5091 0: ProtocolBuffer.Encoder.NUMERIC,
5092 1: ProtocolBuffer.Encoder.STRING,
5093 2: ProtocolBuffer.Encoder.STRING,
5094 3: ProtocolBuffer.Encoder.NUMERIC,
5095 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
5098 _STYLE = """"""
5099 _STYLE_CONTENT_TYPE = """"""
5100 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.PutResponse'
5101 class TouchRequest(ProtocolBuffer.ProtocolMessage):
5102 has_force_ = 0
5103 force_ = 0
5105 def __init__(self, contents=None):
5106 self.key_ = []
5107 self.composite_index_ = []
5108 self.snapshot_ = []
5109 if contents is not None: self.MergeFromString(contents)
5111 def key_size(self): return len(self.key_)
5112 def key_list(self): return self.key_
5114 def key(self, i):
5115 return self.key_[i]
5117 def mutable_key(self, i):
5118 return self.key_[i]
5120 def add_key(self):
5121 x = Reference()
5122 self.key_.append(x)
5123 return x
5125 def clear_key(self):
5126 self.key_ = []
5127 def composite_index_size(self): return len(self.composite_index_)
5128 def composite_index_list(self): return self.composite_index_
5130 def composite_index(self, i):
5131 return self.composite_index_[i]
5133 def mutable_composite_index(self, i):
5134 return self.composite_index_[i]
5136 def add_composite_index(self):
5137 x = CompositeIndex()
5138 self.composite_index_.append(x)
5139 return x
5141 def clear_composite_index(self):
5142 self.composite_index_ = []
5143 def force(self): return self.force_
5145 def set_force(self, x):
5146 self.has_force_ = 1
5147 self.force_ = x
5149 def clear_force(self):
5150 if self.has_force_:
5151 self.has_force_ = 0
5152 self.force_ = 0
5154 def has_force(self): return self.has_force_
5156 def snapshot_size(self): return len(self.snapshot_)
5157 def snapshot_list(self): return self.snapshot_
5159 def snapshot(self, i):
5160 return self.snapshot_[i]
5162 def mutable_snapshot(self, i):
5163 return self.snapshot_[i]
5165 def add_snapshot(self):
5166 x = Snapshot()
5167 self.snapshot_.append(x)
5168 return x
5170 def clear_snapshot(self):
5171 self.snapshot_ = []
5173 def MergeFrom(self, x):
5174 assert x is not self
5175 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
5176 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
5177 if (x.has_force()): self.set_force(x.force())
5178 for i in xrange(x.snapshot_size()): self.add_snapshot().CopyFrom(x.snapshot(i))
5180 def Equals(self, x):
5181 if x is self: return 1
5182 if len(self.key_) != len(x.key_): return 0
5183 for e1, e2 in zip(self.key_, x.key_):
5184 if e1 != e2: return 0
5185 if len(self.composite_index_) != len(x.composite_index_): return 0
5186 for e1, e2 in zip(self.composite_index_, x.composite_index_):
5187 if e1 != e2: return 0
5188 if self.has_force_ != x.has_force_: return 0
5189 if self.has_force_ and self.force_ != x.force_: return 0
5190 if len(self.snapshot_) != len(x.snapshot_): return 0
5191 for e1, e2 in zip(self.snapshot_, x.snapshot_):
5192 if e1 != e2: return 0
5193 return 1
5195 def IsInitialized(self, debug_strs=None):
5196 initialized = 1
5197 for p in self.key_:
5198 if not p.IsInitialized(debug_strs): initialized=0
5199 for p in self.composite_index_:
5200 if not p.IsInitialized(debug_strs): initialized=0
5201 for p in self.snapshot_:
5202 if not p.IsInitialized(debug_strs): initialized=0
5203 return initialized
5205 def ByteSize(self):
5206 n = 0
5207 n += 1 * len(self.key_)
5208 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
5209 n += 1 * len(self.composite_index_)
5210 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
5211 if (self.has_force_): n += 2
5212 n += 1 * len(self.snapshot_)
5213 for i in xrange(len(self.snapshot_)): n += self.lengthString(self.snapshot_[i].ByteSize())
5214 return n
5216 def ByteSizePartial(self):
5217 n = 0
5218 n += 1 * len(self.key_)
5219 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSizePartial())
5220 n += 1 * len(self.composite_index_)
5221 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSizePartial())
5222 if (self.has_force_): n += 2
5223 n += 1 * len(self.snapshot_)
5224 for i in xrange(len(self.snapshot_)): n += self.lengthString(self.snapshot_[i].ByteSizePartial())
5225 return n
5227 def Clear(self):
5228 self.clear_key()
5229 self.clear_composite_index()
5230 self.clear_force()
5231 self.clear_snapshot()
5233 def OutputUnchecked(self, out):
5234 for i in xrange(len(self.key_)):
5235 out.putVarInt32(10)
5236 out.putVarInt32(self.key_[i].ByteSize())
5237 self.key_[i].OutputUnchecked(out)
5238 for i in xrange(len(self.composite_index_)):
5239 out.putVarInt32(18)
5240 out.putVarInt32(self.composite_index_[i].ByteSize())
5241 self.composite_index_[i].OutputUnchecked(out)
5242 if (self.has_force_):
5243 out.putVarInt32(24)
5244 out.putBoolean(self.force_)
5245 for i in xrange(len(self.snapshot_)):
5246 out.putVarInt32(74)
5247 out.putVarInt32(self.snapshot_[i].ByteSize())
5248 self.snapshot_[i].OutputUnchecked(out)
5250 def OutputPartial(self, out):
5251 for i in xrange(len(self.key_)):
5252 out.putVarInt32(10)
5253 out.putVarInt32(self.key_[i].ByteSizePartial())
5254 self.key_[i].OutputPartial(out)
5255 for i in xrange(len(self.composite_index_)):
5256 out.putVarInt32(18)
5257 out.putVarInt32(self.composite_index_[i].ByteSizePartial())
5258 self.composite_index_[i].OutputPartial(out)
5259 if (self.has_force_):
5260 out.putVarInt32(24)
5261 out.putBoolean(self.force_)
5262 for i in xrange(len(self.snapshot_)):
5263 out.putVarInt32(74)
5264 out.putVarInt32(self.snapshot_[i].ByteSizePartial())
5265 self.snapshot_[i].OutputPartial(out)
5267 def TryMerge(self, d):
5268 while d.avail() > 0:
5269 tt = d.getVarInt32()
5270 if tt == 10:
5271 length = d.getVarInt32()
5272 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5273 d.skip(length)
5274 self.add_key().TryMerge(tmp)
5275 continue
5276 if tt == 18:
5277 length = d.getVarInt32()
5278 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5279 d.skip(length)
5280 self.add_composite_index().TryMerge(tmp)
5281 continue
5282 if tt == 24:
5283 self.set_force(d.getBoolean())
5284 continue
5285 if tt == 74:
5286 length = d.getVarInt32()
5287 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5288 d.skip(length)
5289 self.add_snapshot().TryMerge(tmp)
5290 continue
5293 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
5294 d.skipData(tt)
5297 def __str__(self, prefix="", printElemNumber=0):
5298 res=""
5299 cnt=0
5300 for e in self.key_:
5301 elm=""
5302 if printElemNumber: elm="(%d)" % cnt
5303 res+=prefix+("key%s <\n" % elm)
5304 res+=e.__str__(prefix + " ", printElemNumber)
5305 res+=prefix+">\n"
5306 cnt+=1
5307 cnt=0
5308 for e in self.composite_index_:
5309 elm=""
5310 if printElemNumber: elm="(%d)" % cnt
5311 res+=prefix+("composite_index%s <\n" % elm)
5312 res+=e.__str__(prefix + " ", printElemNumber)
5313 res+=prefix+">\n"
5314 cnt+=1
5315 if self.has_force_: res+=prefix+("force: %s\n" % self.DebugFormatBool(self.force_))
5316 cnt=0
5317 for e in self.snapshot_:
5318 elm=""
5319 if printElemNumber: elm="(%d)" % cnt
5320 res+=prefix+("snapshot%s <\n" % elm)
5321 res+=e.__str__(prefix + " ", printElemNumber)
5322 res+=prefix+">\n"
5323 cnt+=1
5324 return res
5327 def _BuildTagLookupTable(sparse, maxtag, default=None):
5328 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
5330 kkey = 1
5331 kcomposite_index = 2
5332 kforce = 3
5333 ksnapshot = 9
5335 _TEXT = _BuildTagLookupTable({
5336 0: "ErrorCode",
5337 1: "key",
5338 2: "composite_index",
5339 3: "force",
5340 9: "snapshot",
5341 }, 9)
5343 _TYPES = _BuildTagLookupTable({
5344 0: ProtocolBuffer.Encoder.NUMERIC,
5345 1: ProtocolBuffer.Encoder.STRING,
5346 2: ProtocolBuffer.Encoder.STRING,
5347 3: ProtocolBuffer.Encoder.NUMERIC,
5348 9: ProtocolBuffer.Encoder.STRING,
5349 }, 9, ProtocolBuffer.Encoder.MAX_TYPE)
5352 _STYLE = """"""
5353 _STYLE_CONTENT_TYPE = """"""
5354 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.TouchRequest'
5355 class TouchResponse(ProtocolBuffer.ProtocolMessage):
5356 has_cost_ = 0
5357 cost_ = None
5359 def __init__(self, contents=None):
5360 self.lazy_init_lock_ = thread.allocate_lock()
5361 if contents is not None: self.MergeFromString(contents)
5363 def cost(self):
5364 if self.cost_ is None:
5365 self.lazy_init_lock_.acquire()
5366 try:
5367 if self.cost_ is None: self.cost_ = Cost()
5368 finally:
5369 self.lazy_init_lock_.release()
5370 return self.cost_
5372 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
5374 def clear_cost(self):
5376 if self.has_cost_:
5377 self.has_cost_ = 0;
5378 if self.cost_ is not None: self.cost_.Clear()
5380 def has_cost(self): return self.has_cost_
5383 def MergeFrom(self, x):
5384 assert x is not self
5385 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
5387 def Equals(self, x):
5388 if x is self: return 1
5389 if self.has_cost_ != x.has_cost_: return 0
5390 if self.has_cost_ and self.cost_ != x.cost_: return 0
5391 return 1
5393 def IsInitialized(self, debug_strs=None):
5394 initialized = 1
5395 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
5396 return initialized
5398 def ByteSize(self):
5399 n = 0
5400 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
5401 return n
5403 def ByteSizePartial(self):
5404 n = 0
5405 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSizePartial())
5406 return n
5408 def Clear(self):
5409 self.clear_cost()
5411 def OutputUnchecked(self, out):
5412 if (self.has_cost_):
5413 out.putVarInt32(10)
5414 out.putVarInt32(self.cost_.ByteSize())
5415 self.cost_.OutputUnchecked(out)
5417 def OutputPartial(self, out):
5418 if (self.has_cost_):
5419 out.putVarInt32(10)
5420 out.putVarInt32(self.cost_.ByteSizePartial())
5421 self.cost_.OutputPartial(out)
5423 def TryMerge(self, d):
5424 while d.avail() > 0:
5425 tt = d.getVarInt32()
5426 if tt == 10:
5427 length = d.getVarInt32()
5428 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5429 d.skip(length)
5430 self.mutable_cost().TryMerge(tmp)
5431 continue
5434 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
5435 d.skipData(tt)
5438 def __str__(self, prefix="", printElemNumber=0):
5439 res=""
5440 if self.has_cost_:
5441 res+=prefix+"cost <\n"
5442 res+=self.cost_.__str__(prefix + " ", printElemNumber)
5443 res+=prefix+">\n"
5444 return res
5447 def _BuildTagLookupTable(sparse, maxtag, default=None):
5448 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
5450 kcost = 1
5452 _TEXT = _BuildTagLookupTable({
5453 0: "ErrorCode",
5454 1: "cost",
5455 }, 1)
5457 _TYPES = _BuildTagLookupTable({
5458 0: ProtocolBuffer.Encoder.NUMERIC,
5459 1: ProtocolBuffer.Encoder.STRING,
5460 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
5463 _STYLE = """"""
5464 _STYLE_CONTENT_TYPE = """"""
5465 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.TouchResponse'
5466 class DeleteRequest(ProtocolBuffer.ProtocolMessage):
5467 has_transaction_ = 0
5468 transaction_ = None
5469 has_trusted_ = 0
5470 trusted_ = 0
5471 has_force_ = 0
5472 force_ = 0
5473 has_mark_changes_ = 0
5474 mark_changes_ = 0
5476 def __init__(self, contents=None):
5477 self.key_ = []
5478 self.snapshot_ = []
5479 self.lazy_init_lock_ = thread.allocate_lock()
5480 if contents is not None: self.MergeFromString(contents)
5482 def key_size(self): return len(self.key_)
5483 def key_list(self): return self.key_
5485 def key(self, i):
5486 return self.key_[i]
5488 def mutable_key(self, i):
5489 return self.key_[i]
5491 def add_key(self):
5492 x = Reference()
5493 self.key_.append(x)
5494 return x
5496 def clear_key(self):
5497 self.key_ = []
5498 def transaction(self):
5499 if self.transaction_ is None:
5500 self.lazy_init_lock_.acquire()
5501 try:
5502 if self.transaction_ is None: self.transaction_ = Transaction()
5503 finally:
5504 self.lazy_init_lock_.release()
5505 return self.transaction_
5507 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
5509 def clear_transaction(self):
5511 if self.has_transaction_:
5512 self.has_transaction_ = 0;
5513 if self.transaction_ is not None: self.transaction_.Clear()
5515 def has_transaction(self): return self.has_transaction_
5517 def trusted(self): return self.trusted_
5519 def set_trusted(self, x):
5520 self.has_trusted_ = 1
5521 self.trusted_ = x
5523 def clear_trusted(self):
5524 if self.has_trusted_:
5525 self.has_trusted_ = 0
5526 self.trusted_ = 0
5528 def has_trusted(self): return self.has_trusted_
5530 def force(self): return self.force_
5532 def set_force(self, x):
5533 self.has_force_ = 1
5534 self.force_ = x
5536 def clear_force(self):
5537 if self.has_force_:
5538 self.has_force_ = 0
5539 self.force_ = 0
5541 def has_force(self): return self.has_force_
5543 def mark_changes(self): return self.mark_changes_
5545 def set_mark_changes(self, x):
5546 self.has_mark_changes_ = 1
5547 self.mark_changes_ = x
5549 def clear_mark_changes(self):
5550 if self.has_mark_changes_:
5551 self.has_mark_changes_ = 0
5552 self.mark_changes_ = 0
5554 def has_mark_changes(self): return self.has_mark_changes_
5556 def snapshot_size(self): return len(self.snapshot_)
5557 def snapshot_list(self): return self.snapshot_
5559 def snapshot(self, i):
5560 return self.snapshot_[i]
5562 def mutable_snapshot(self, i):
5563 return self.snapshot_[i]
5565 def add_snapshot(self):
5566 x = Snapshot()
5567 self.snapshot_.append(x)
5568 return x
5570 def clear_snapshot(self):
5571 self.snapshot_ = []
5573 def MergeFrom(self, x):
5574 assert x is not self
5575 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
5576 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
5577 if (x.has_trusted()): self.set_trusted(x.trusted())
5578 if (x.has_force()): self.set_force(x.force())
5579 if (x.has_mark_changes()): self.set_mark_changes(x.mark_changes())
5580 for i in xrange(x.snapshot_size()): self.add_snapshot().CopyFrom(x.snapshot(i))
5582 def Equals(self, x):
5583 if x is self: return 1
5584 if len(self.key_) != len(x.key_): return 0
5585 for e1, e2 in zip(self.key_, x.key_):
5586 if e1 != e2: return 0
5587 if self.has_transaction_ != x.has_transaction_: return 0
5588 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
5589 if self.has_trusted_ != x.has_trusted_: return 0
5590 if self.has_trusted_ and self.trusted_ != x.trusted_: return 0
5591 if self.has_force_ != x.has_force_: return 0
5592 if self.has_force_ and self.force_ != x.force_: return 0
5593 if self.has_mark_changes_ != x.has_mark_changes_: return 0
5594 if self.has_mark_changes_ and self.mark_changes_ != x.mark_changes_: return 0
5595 if len(self.snapshot_) != len(x.snapshot_): return 0
5596 for e1, e2 in zip(self.snapshot_, x.snapshot_):
5597 if e1 != e2: return 0
5598 return 1
5600 def IsInitialized(self, debug_strs=None):
5601 initialized = 1
5602 for p in self.key_:
5603 if not p.IsInitialized(debug_strs): initialized=0
5604 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
5605 for p in self.snapshot_:
5606 if not p.IsInitialized(debug_strs): initialized=0
5607 return initialized
5609 def ByteSize(self):
5610 n = 0
5611 n += 1 * len(self.key_)
5612 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
5613 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
5614 if (self.has_trusted_): n += 2
5615 if (self.has_force_): n += 2
5616 if (self.has_mark_changes_): n += 2
5617 n += 1 * len(self.snapshot_)
5618 for i in xrange(len(self.snapshot_)): n += self.lengthString(self.snapshot_[i].ByteSize())
5619 return n
5621 def ByteSizePartial(self):
5622 n = 0
5623 n += 1 * len(self.key_)
5624 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSizePartial())
5625 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSizePartial())
5626 if (self.has_trusted_): n += 2
5627 if (self.has_force_): n += 2
5628 if (self.has_mark_changes_): n += 2
5629 n += 1 * len(self.snapshot_)
5630 for i in xrange(len(self.snapshot_)): n += self.lengthString(self.snapshot_[i].ByteSizePartial())
5631 return n
5633 def Clear(self):
5634 self.clear_key()
5635 self.clear_transaction()
5636 self.clear_trusted()
5637 self.clear_force()
5638 self.clear_mark_changes()
5639 self.clear_snapshot()
5641 def OutputUnchecked(self, out):
5642 if (self.has_trusted_):
5643 out.putVarInt32(32)
5644 out.putBoolean(self.trusted_)
5645 if (self.has_transaction_):
5646 out.putVarInt32(42)
5647 out.putVarInt32(self.transaction_.ByteSize())
5648 self.transaction_.OutputUnchecked(out)
5649 for i in xrange(len(self.key_)):
5650 out.putVarInt32(50)
5651 out.putVarInt32(self.key_[i].ByteSize())
5652 self.key_[i].OutputUnchecked(out)
5653 if (self.has_force_):
5654 out.putVarInt32(56)
5655 out.putBoolean(self.force_)
5656 if (self.has_mark_changes_):
5657 out.putVarInt32(64)
5658 out.putBoolean(self.mark_changes_)
5659 for i in xrange(len(self.snapshot_)):
5660 out.putVarInt32(74)
5661 out.putVarInt32(self.snapshot_[i].ByteSize())
5662 self.snapshot_[i].OutputUnchecked(out)
5664 def OutputPartial(self, out):
5665 if (self.has_trusted_):
5666 out.putVarInt32(32)
5667 out.putBoolean(self.trusted_)
5668 if (self.has_transaction_):
5669 out.putVarInt32(42)
5670 out.putVarInt32(self.transaction_.ByteSizePartial())
5671 self.transaction_.OutputPartial(out)
5672 for i in xrange(len(self.key_)):
5673 out.putVarInt32(50)
5674 out.putVarInt32(self.key_[i].ByteSizePartial())
5675 self.key_[i].OutputPartial(out)
5676 if (self.has_force_):
5677 out.putVarInt32(56)
5678 out.putBoolean(self.force_)
5679 if (self.has_mark_changes_):
5680 out.putVarInt32(64)
5681 out.putBoolean(self.mark_changes_)
5682 for i in xrange(len(self.snapshot_)):
5683 out.putVarInt32(74)
5684 out.putVarInt32(self.snapshot_[i].ByteSizePartial())
5685 self.snapshot_[i].OutputPartial(out)
5687 def TryMerge(self, d):
5688 while d.avail() > 0:
5689 tt = d.getVarInt32()
5690 if tt == 32:
5691 self.set_trusted(d.getBoolean())
5692 continue
5693 if tt == 42:
5694 length = d.getVarInt32()
5695 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5696 d.skip(length)
5697 self.mutable_transaction().TryMerge(tmp)
5698 continue
5699 if tt == 50:
5700 length = d.getVarInt32()
5701 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5702 d.skip(length)
5703 self.add_key().TryMerge(tmp)
5704 continue
5705 if tt == 56:
5706 self.set_force(d.getBoolean())
5707 continue
5708 if tt == 64:
5709 self.set_mark_changes(d.getBoolean())
5710 continue
5711 if tt == 74:
5712 length = d.getVarInt32()
5713 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5714 d.skip(length)
5715 self.add_snapshot().TryMerge(tmp)
5716 continue
5719 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
5720 d.skipData(tt)
5723 def __str__(self, prefix="", printElemNumber=0):
5724 res=""
5725 cnt=0
5726 for e in self.key_:
5727 elm=""
5728 if printElemNumber: elm="(%d)" % cnt
5729 res+=prefix+("key%s <\n" % elm)
5730 res+=e.__str__(prefix + " ", printElemNumber)
5731 res+=prefix+">\n"
5732 cnt+=1
5733 if self.has_transaction_:
5734 res+=prefix+"transaction <\n"
5735 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
5736 res+=prefix+">\n"
5737 if self.has_trusted_: res+=prefix+("trusted: %s\n" % self.DebugFormatBool(self.trusted_))
5738 if self.has_force_: res+=prefix+("force: %s\n" % self.DebugFormatBool(self.force_))
5739 if self.has_mark_changes_: res+=prefix+("mark_changes: %s\n" % self.DebugFormatBool(self.mark_changes_))
5740 cnt=0
5741 for e in self.snapshot_:
5742 elm=""
5743 if printElemNumber: elm="(%d)" % cnt
5744 res+=prefix+("snapshot%s <\n" % elm)
5745 res+=e.__str__(prefix + " ", printElemNumber)
5746 res+=prefix+">\n"
5747 cnt+=1
5748 return res
5751 def _BuildTagLookupTable(sparse, maxtag, default=None):
5752 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
5754 kkey = 6
5755 ktransaction = 5
5756 ktrusted = 4
5757 kforce = 7
5758 kmark_changes = 8
5759 ksnapshot = 9
5761 _TEXT = _BuildTagLookupTable({
5762 0: "ErrorCode",
5763 4: "trusted",
5764 5: "transaction",
5765 6: "key",
5766 7: "force",
5767 8: "mark_changes",
5768 9: "snapshot",
5769 }, 9)
5771 _TYPES = _BuildTagLookupTable({
5772 0: ProtocolBuffer.Encoder.NUMERIC,
5773 4: ProtocolBuffer.Encoder.NUMERIC,
5774 5: ProtocolBuffer.Encoder.STRING,
5775 6: ProtocolBuffer.Encoder.STRING,
5776 7: ProtocolBuffer.Encoder.NUMERIC,
5777 8: ProtocolBuffer.Encoder.NUMERIC,
5778 9: ProtocolBuffer.Encoder.STRING,
5779 }, 9, ProtocolBuffer.Encoder.MAX_TYPE)
5782 _STYLE = """"""
5783 _STYLE_CONTENT_TYPE = """"""
5784 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.DeleteRequest'
5785 class DeleteResponse(ProtocolBuffer.ProtocolMessage):
5786 has_cost_ = 0
5787 cost_ = None
5789 def __init__(self, contents=None):
5790 self.version_ = []
5791 self.lazy_init_lock_ = thread.allocate_lock()
5792 if contents is not None: self.MergeFromString(contents)
5794 def cost(self):
5795 if self.cost_ is None:
5796 self.lazy_init_lock_.acquire()
5797 try:
5798 if self.cost_ is None: self.cost_ = Cost()
5799 finally:
5800 self.lazy_init_lock_.release()
5801 return self.cost_
5803 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
5805 def clear_cost(self):
5807 if self.has_cost_:
5808 self.has_cost_ = 0;
5809 if self.cost_ is not None: self.cost_.Clear()
5811 def has_cost(self): return self.has_cost_
5813 def version_size(self): return len(self.version_)
5814 def version_list(self): return self.version_
5816 def version(self, i):
5817 return self.version_[i]
5819 def set_version(self, i, x):
5820 self.version_[i] = x
5822 def add_version(self, x):
5823 self.version_.append(x)
5825 def clear_version(self):
5826 self.version_ = []
5829 def MergeFrom(self, x):
5830 assert x is not self
5831 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
5832 for i in xrange(x.version_size()): self.add_version(x.version(i))
5834 def Equals(self, x):
5835 if x is self: return 1
5836 if self.has_cost_ != x.has_cost_: return 0
5837 if self.has_cost_ and self.cost_ != x.cost_: return 0
5838 if len(self.version_) != len(x.version_): return 0
5839 for e1, e2 in zip(self.version_, x.version_):
5840 if e1 != e2: return 0
5841 return 1
5843 def IsInitialized(self, debug_strs=None):
5844 initialized = 1
5845 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
5846 return initialized
5848 def ByteSize(self):
5849 n = 0
5850 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
5851 n += 1 * len(self.version_)
5852 for i in xrange(len(self.version_)): n += self.lengthVarInt64(self.version_[i])
5853 return n
5855 def ByteSizePartial(self):
5856 n = 0
5857 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSizePartial())
5858 n += 1 * len(self.version_)
5859 for i in xrange(len(self.version_)): n += self.lengthVarInt64(self.version_[i])
5860 return n
5862 def Clear(self):
5863 self.clear_cost()
5864 self.clear_version()
5866 def OutputUnchecked(self, out):
5867 if (self.has_cost_):
5868 out.putVarInt32(10)
5869 out.putVarInt32(self.cost_.ByteSize())
5870 self.cost_.OutputUnchecked(out)
5871 for i in xrange(len(self.version_)):
5872 out.putVarInt32(24)
5873 out.putVarInt64(self.version_[i])
5875 def OutputPartial(self, out):
5876 if (self.has_cost_):
5877 out.putVarInt32(10)
5878 out.putVarInt32(self.cost_.ByteSizePartial())
5879 self.cost_.OutputPartial(out)
5880 for i in xrange(len(self.version_)):
5881 out.putVarInt32(24)
5882 out.putVarInt64(self.version_[i])
5884 def TryMerge(self, d):
5885 while d.avail() > 0:
5886 tt = d.getVarInt32()
5887 if tt == 10:
5888 length = d.getVarInt32()
5889 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
5890 d.skip(length)
5891 self.mutable_cost().TryMerge(tmp)
5892 continue
5893 if tt == 24:
5894 self.add_version(d.getVarInt64())
5895 continue
5898 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
5899 d.skipData(tt)
5902 def __str__(self, prefix="", printElemNumber=0):
5903 res=""
5904 if self.has_cost_:
5905 res+=prefix+"cost <\n"
5906 res+=self.cost_.__str__(prefix + " ", printElemNumber)
5907 res+=prefix+">\n"
5908 cnt=0
5909 for e in self.version_:
5910 elm=""
5911 if printElemNumber: elm="(%d)" % cnt
5912 res+=prefix+("version%s: %s\n" % (elm, self.DebugFormatInt64(e)))
5913 cnt+=1
5914 return res
5917 def _BuildTagLookupTable(sparse, maxtag, default=None):
5918 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
5920 kcost = 1
5921 kversion = 3
5923 _TEXT = _BuildTagLookupTable({
5924 0: "ErrorCode",
5925 1: "cost",
5926 3: "version",
5927 }, 3)
5929 _TYPES = _BuildTagLookupTable({
5930 0: ProtocolBuffer.Encoder.NUMERIC,
5931 1: ProtocolBuffer.Encoder.STRING,
5932 3: ProtocolBuffer.Encoder.NUMERIC,
5933 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
5936 _STYLE = """"""
5937 _STYLE_CONTENT_TYPE = """"""
5938 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.DeleteResponse'
5939 class NextRequest(ProtocolBuffer.ProtocolMessage):
5940 has_cursor_ = 0
5941 has_count_ = 0
5942 count_ = 0
5943 has_offset_ = 0
5944 offset_ = 0
5945 has_compile_ = 0
5946 compile_ = 0
5948 def __init__(self, contents=None):
5949 self.cursor_ = Cursor()
5950 if contents is not None: self.MergeFromString(contents)
5952 def cursor(self): return self.cursor_
5954 def mutable_cursor(self): self.has_cursor_ = 1; return self.cursor_
5956 def clear_cursor(self):self.has_cursor_ = 0; self.cursor_.Clear()
5958 def has_cursor(self): return self.has_cursor_
5960 def count(self): return self.count_
5962 def set_count(self, x):
5963 self.has_count_ = 1
5964 self.count_ = x
5966 def clear_count(self):
5967 if self.has_count_:
5968 self.has_count_ = 0
5969 self.count_ = 0
5971 def has_count(self): return self.has_count_
5973 def offset(self): return self.offset_
5975 def set_offset(self, x):
5976 self.has_offset_ = 1
5977 self.offset_ = x
5979 def clear_offset(self):
5980 if self.has_offset_:
5981 self.has_offset_ = 0
5982 self.offset_ = 0
5984 def has_offset(self): return self.has_offset_
5986 def compile(self): return self.compile_
5988 def set_compile(self, x):
5989 self.has_compile_ = 1
5990 self.compile_ = x
5992 def clear_compile(self):
5993 if self.has_compile_:
5994 self.has_compile_ = 0
5995 self.compile_ = 0
5997 def has_compile(self): return self.has_compile_
6000 def MergeFrom(self, x):
6001 assert x is not self
6002 if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor())
6003 if (x.has_count()): self.set_count(x.count())
6004 if (x.has_offset()): self.set_offset(x.offset())
6005 if (x.has_compile()): self.set_compile(x.compile())
6007 def Equals(self, x):
6008 if x is self: return 1
6009 if self.has_cursor_ != x.has_cursor_: return 0
6010 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
6011 if self.has_count_ != x.has_count_: return 0
6012 if self.has_count_ and self.count_ != x.count_: return 0
6013 if self.has_offset_ != x.has_offset_: return 0
6014 if self.has_offset_ and self.offset_ != x.offset_: return 0
6015 if self.has_compile_ != x.has_compile_: return 0
6016 if self.has_compile_ and self.compile_ != x.compile_: return 0
6017 return 1
6019 def IsInitialized(self, debug_strs=None):
6020 initialized = 1
6021 if (not self.has_cursor_):
6022 initialized = 0
6023 if debug_strs is not None:
6024 debug_strs.append('Required field: cursor not set.')
6025 elif not self.cursor_.IsInitialized(debug_strs): initialized = 0
6026 return initialized
6028 def ByteSize(self):
6029 n = 0
6030 n += self.lengthString(self.cursor_.ByteSize())
6031 if (self.has_count_): n += 1 + self.lengthVarInt64(self.count_)
6032 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
6033 if (self.has_compile_): n += 2
6034 return n + 1
6036 def ByteSizePartial(self):
6037 n = 0
6038 if (self.has_cursor_):
6039 n += 1
6040 n += self.lengthString(self.cursor_.ByteSizePartial())
6041 if (self.has_count_): n += 1 + self.lengthVarInt64(self.count_)
6042 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
6043 if (self.has_compile_): n += 2
6044 return n
6046 def Clear(self):
6047 self.clear_cursor()
6048 self.clear_count()
6049 self.clear_offset()
6050 self.clear_compile()
6052 def OutputUnchecked(self, out):
6053 out.putVarInt32(10)
6054 out.putVarInt32(self.cursor_.ByteSize())
6055 self.cursor_.OutputUnchecked(out)
6056 if (self.has_count_):
6057 out.putVarInt32(16)
6058 out.putVarInt32(self.count_)
6059 if (self.has_compile_):
6060 out.putVarInt32(24)
6061 out.putBoolean(self.compile_)
6062 if (self.has_offset_):
6063 out.putVarInt32(32)
6064 out.putVarInt32(self.offset_)
6066 def OutputPartial(self, out):
6067 if (self.has_cursor_):
6068 out.putVarInt32(10)
6069 out.putVarInt32(self.cursor_.ByteSizePartial())
6070 self.cursor_.OutputPartial(out)
6071 if (self.has_count_):
6072 out.putVarInt32(16)
6073 out.putVarInt32(self.count_)
6074 if (self.has_compile_):
6075 out.putVarInt32(24)
6076 out.putBoolean(self.compile_)
6077 if (self.has_offset_):
6078 out.putVarInt32(32)
6079 out.putVarInt32(self.offset_)
6081 def TryMerge(self, d):
6082 while d.avail() > 0:
6083 tt = d.getVarInt32()
6084 if tt == 10:
6085 length = d.getVarInt32()
6086 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6087 d.skip(length)
6088 self.mutable_cursor().TryMerge(tmp)
6089 continue
6090 if tt == 16:
6091 self.set_count(d.getVarInt32())
6092 continue
6093 if tt == 24:
6094 self.set_compile(d.getBoolean())
6095 continue
6096 if tt == 32:
6097 self.set_offset(d.getVarInt32())
6098 continue
6101 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
6102 d.skipData(tt)
6105 def __str__(self, prefix="", printElemNumber=0):
6106 res=""
6107 if self.has_cursor_:
6108 res+=prefix+"cursor <\n"
6109 res+=self.cursor_.__str__(prefix + " ", printElemNumber)
6110 res+=prefix+">\n"
6111 if self.has_count_: res+=prefix+("count: %s\n" % self.DebugFormatInt32(self.count_))
6112 if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
6113 if self.has_compile_: res+=prefix+("compile: %s\n" % self.DebugFormatBool(self.compile_))
6114 return res
6117 def _BuildTagLookupTable(sparse, maxtag, default=None):
6118 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
6120 kcursor = 1
6121 kcount = 2
6122 koffset = 4
6123 kcompile = 3
6125 _TEXT = _BuildTagLookupTable({
6126 0: "ErrorCode",
6127 1: "cursor",
6128 2: "count",
6129 3: "compile",
6130 4: "offset",
6131 }, 4)
6133 _TYPES = _BuildTagLookupTable({
6134 0: ProtocolBuffer.Encoder.NUMERIC,
6135 1: ProtocolBuffer.Encoder.STRING,
6136 2: ProtocolBuffer.Encoder.NUMERIC,
6137 3: ProtocolBuffer.Encoder.NUMERIC,
6138 4: ProtocolBuffer.Encoder.NUMERIC,
6139 }, 4, ProtocolBuffer.Encoder.MAX_TYPE)
6142 _STYLE = """"""
6143 _STYLE_CONTENT_TYPE = """"""
6144 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.NextRequest'
6145 class QueryResult(ProtocolBuffer.ProtocolMessage):
6146 has_cursor_ = 0
6147 cursor_ = None
6148 has_skipped_results_ = 0
6149 skipped_results_ = 0
6150 has_more_results_ = 0
6151 more_results_ = 0
6152 has_keys_only_ = 0
6153 keys_only_ = 0
6154 has_index_only_ = 0
6155 index_only_ = 0
6156 has_small_ops_ = 0
6157 small_ops_ = 0
6158 has_compiled_query_ = 0
6159 compiled_query_ = None
6160 has_compiled_cursor_ = 0
6161 compiled_cursor_ = None
6163 def __init__(self, contents=None):
6164 self.result_ = []
6165 self.index_ = []
6166 self.version_ = []
6167 self.lazy_init_lock_ = thread.allocate_lock()
6168 if contents is not None: self.MergeFromString(contents)
6170 def cursor(self):
6171 if self.cursor_ is None:
6172 self.lazy_init_lock_.acquire()
6173 try:
6174 if self.cursor_ is None: self.cursor_ = Cursor()
6175 finally:
6176 self.lazy_init_lock_.release()
6177 return self.cursor_
6179 def mutable_cursor(self): self.has_cursor_ = 1; return self.cursor()
6181 def clear_cursor(self):
6183 if self.has_cursor_:
6184 self.has_cursor_ = 0;
6185 if self.cursor_ is not None: self.cursor_.Clear()
6187 def has_cursor(self): return self.has_cursor_
6189 def result_size(self): return len(self.result_)
6190 def result_list(self): return self.result_
6192 def result(self, i):
6193 return self.result_[i]
6195 def mutable_result(self, i):
6196 return self.result_[i]
6198 def add_result(self):
6199 x = EntityProto()
6200 self.result_.append(x)
6201 return x
6203 def clear_result(self):
6204 self.result_ = []
6205 def skipped_results(self): return self.skipped_results_
6207 def set_skipped_results(self, x):
6208 self.has_skipped_results_ = 1
6209 self.skipped_results_ = x
6211 def clear_skipped_results(self):
6212 if self.has_skipped_results_:
6213 self.has_skipped_results_ = 0
6214 self.skipped_results_ = 0
6216 def has_skipped_results(self): return self.has_skipped_results_
6218 def more_results(self): return self.more_results_
6220 def set_more_results(self, x):
6221 self.has_more_results_ = 1
6222 self.more_results_ = x
6224 def clear_more_results(self):
6225 if self.has_more_results_:
6226 self.has_more_results_ = 0
6227 self.more_results_ = 0
6229 def has_more_results(self): return self.has_more_results_
6231 def keys_only(self): return self.keys_only_
6233 def set_keys_only(self, x):
6234 self.has_keys_only_ = 1
6235 self.keys_only_ = x
6237 def clear_keys_only(self):
6238 if self.has_keys_only_:
6239 self.has_keys_only_ = 0
6240 self.keys_only_ = 0
6242 def has_keys_only(self): return self.has_keys_only_
6244 def index_only(self): return self.index_only_
6246 def set_index_only(self, x):
6247 self.has_index_only_ = 1
6248 self.index_only_ = x
6250 def clear_index_only(self):
6251 if self.has_index_only_:
6252 self.has_index_only_ = 0
6253 self.index_only_ = 0
6255 def has_index_only(self): return self.has_index_only_
6257 def small_ops(self): return self.small_ops_
6259 def set_small_ops(self, x):
6260 self.has_small_ops_ = 1
6261 self.small_ops_ = x
6263 def clear_small_ops(self):
6264 if self.has_small_ops_:
6265 self.has_small_ops_ = 0
6266 self.small_ops_ = 0
6268 def has_small_ops(self): return self.has_small_ops_
6270 def compiled_query(self):
6271 if self.compiled_query_ is None:
6272 self.lazy_init_lock_.acquire()
6273 try:
6274 if self.compiled_query_ is None: self.compiled_query_ = CompiledQuery()
6275 finally:
6276 self.lazy_init_lock_.release()
6277 return self.compiled_query_
6279 def mutable_compiled_query(self): self.has_compiled_query_ = 1; return self.compiled_query()
6281 def clear_compiled_query(self):
6283 if self.has_compiled_query_:
6284 self.has_compiled_query_ = 0;
6285 if self.compiled_query_ is not None: self.compiled_query_.Clear()
6287 def has_compiled_query(self): return self.has_compiled_query_
6289 def compiled_cursor(self):
6290 if self.compiled_cursor_ is None:
6291 self.lazy_init_lock_.acquire()
6292 try:
6293 if self.compiled_cursor_ is None: self.compiled_cursor_ = CompiledCursor()
6294 finally:
6295 self.lazy_init_lock_.release()
6296 return self.compiled_cursor_
6298 def mutable_compiled_cursor(self): self.has_compiled_cursor_ = 1; return self.compiled_cursor()
6300 def clear_compiled_cursor(self):
6302 if self.has_compiled_cursor_:
6303 self.has_compiled_cursor_ = 0;
6304 if self.compiled_cursor_ is not None: self.compiled_cursor_.Clear()
6306 def has_compiled_cursor(self): return self.has_compiled_cursor_
6308 def index_size(self): return len(self.index_)
6309 def index_list(self): return self.index_
6311 def index(self, i):
6312 return self.index_[i]
6314 def mutable_index(self, i):
6315 return self.index_[i]
6317 def add_index(self):
6318 x = CompositeIndex()
6319 self.index_.append(x)
6320 return x
6322 def clear_index(self):
6323 self.index_ = []
6324 def version_size(self): return len(self.version_)
6325 def version_list(self): return self.version_
6327 def version(self, i):
6328 return self.version_[i]
6330 def set_version(self, i, x):
6331 self.version_[i] = x
6333 def add_version(self, x):
6334 self.version_.append(x)
6336 def clear_version(self):
6337 self.version_ = []
6340 def MergeFrom(self, x):
6341 assert x is not self
6342 if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor())
6343 for i in xrange(x.result_size()): self.add_result().CopyFrom(x.result(i))
6344 if (x.has_skipped_results()): self.set_skipped_results(x.skipped_results())
6345 if (x.has_more_results()): self.set_more_results(x.more_results())
6346 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
6347 if (x.has_index_only()): self.set_index_only(x.index_only())
6348 if (x.has_small_ops()): self.set_small_ops(x.small_ops())
6349 if (x.has_compiled_query()): self.mutable_compiled_query().MergeFrom(x.compiled_query())
6350 if (x.has_compiled_cursor()): self.mutable_compiled_cursor().MergeFrom(x.compiled_cursor())
6351 for i in xrange(x.index_size()): self.add_index().CopyFrom(x.index(i))
6352 for i in xrange(x.version_size()): self.add_version(x.version(i))
6354 def Equals(self, x):
6355 if x is self: return 1
6356 if self.has_cursor_ != x.has_cursor_: return 0
6357 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
6358 if len(self.result_) != len(x.result_): return 0
6359 for e1, e2 in zip(self.result_, x.result_):
6360 if e1 != e2: return 0
6361 if self.has_skipped_results_ != x.has_skipped_results_: return 0
6362 if self.has_skipped_results_ and self.skipped_results_ != x.skipped_results_: return 0
6363 if self.has_more_results_ != x.has_more_results_: return 0
6364 if self.has_more_results_ and self.more_results_ != x.more_results_: return 0
6365 if self.has_keys_only_ != x.has_keys_only_: return 0
6366 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
6367 if self.has_index_only_ != x.has_index_only_: return 0
6368 if self.has_index_only_ and self.index_only_ != x.index_only_: return 0
6369 if self.has_small_ops_ != x.has_small_ops_: return 0
6370 if self.has_small_ops_ and self.small_ops_ != x.small_ops_: return 0
6371 if self.has_compiled_query_ != x.has_compiled_query_: return 0
6372 if self.has_compiled_query_ and self.compiled_query_ != x.compiled_query_: return 0
6373 if self.has_compiled_cursor_ != x.has_compiled_cursor_: return 0
6374 if self.has_compiled_cursor_ and self.compiled_cursor_ != x.compiled_cursor_: return 0
6375 if len(self.index_) != len(x.index_): return 0
6376 for e1, e2 in zip(self.index_, x.index_):
6377 if e1 != e2: return 0
6378 if len(self.version_) != len(x.version_): return 0
6379 for e1, e2 in zip(self.version_, x.version_):
6380 if e1 != e2: return 0
6381 return 1
6383 def IsInitialized(self, debug_strs=None):
6384 initialized = 1
6385 if (self.has_cursor_ and not self.cursor_.IsInitialized(debug_strs)): initialized = 0
6386 for p in self.result_:
6387 if not p.IsInitialized(debug_strs): initialized=0
6388 if (not self.has_more_results_):
6389 initialized = 0
6390 if debug_strs is not None:
6391 debug_strs.append('Required field: more_results not set.')
6392 if (self.has_compiled_query_ and not self.compiled_query_.IsInitialized(debug_strs)): initialized = 0
6393 if (self.has_compiled_cursor_ and not self.compiled_cursor_.IsInitialized(debug_strs)): initialized = 0
6394 for p in self.index_:
6395 if not p.IsInitialized(debug_strs): initialized=0
6396 return initialized
6398 def ByteSize(self):
6399 n = 0
6400 if (self.has_cursor_): n += 1 + self.lengthString(self.cursor_.ByteSize())
6401 n += 1 * len(self.result_)
6402 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSize())
6403 if (self.has_skipped_results_): n += 1 + self.lengthVarInt64(self.skipped_results_)
6404 if (self.has_keys_only_): n += 2
6405 if (self.has_index_only_): n += 2
6406 if (self.has_small_ops_): n += 2
6407 if (self.has_compiled_query_): n += 1 + self.lengthString(self.compiled_query_.ByteSize())
6408 if (self.has_compiled_cursor_): n += 1 + self.lengthString(self.compiled_cursor_.ByteSize())
6409 n += 1 * len(self.index_)
6410 for i in xrange(len(self.index_)): n += self.lengthString(self.index_[i].ByteSize())
6411 n += 1 * len(self.version_)
6412 for i in xrange(len(self.version_)): n += self.lengthVarInt64(self.version_[i])
6413 return n + 2
6415 def ByteSizePartial(self):
6416 n = 0
6417 if (self.has_cursor_): n += 1 + self.lengthString(self.cursor_.ByteSizePartial())
6418 n += 1 * len(self.result_)
6419 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSizePartial())
6420 if (self.has_skipped_results_): n += 1 + self.lengthVarInt64(self.skipped_results_)
6421 if (self.has_more_results_):
6422 n += 2
6423 if (self.has_keys_only_): n += 2
6424 if (self.has_index_only_): n += 2
6425 if (self.has_small_ops_): n += 2
6426 if (self.has_compiled_query_): n += 1 + self.lengthString(self.compiled_query_.ByteSizePartial())
6427 if (self.has_compiled_cursor_): n += 1 + self.lengthString(self.compiled_cursor_.ByteSizePartial())
6428 n += 1 * len(self.index_)
6429 for i in xrange(len(self.index_)): n += self.lengthString(self.index_[i].ByteSizePartial())
6430 n += 1 * len(self.version_)
6431 for i in xrange(len(self.version_)): n += self.lengthVarInt64(self.version_[i])
6432 return n
6434 def Clear(self):
6435 self.clear_cursor()
6436 self.clear_result()
6437 self.clear_skipped_results()
6438 self.clear_more_results()
6439 self.clear_keys_only()
6440 self.clear_index_only()
6441 self.clear_small_ops()
6442 self.clear_compiled_query()
6443 self.clear_compiled_cursor()
6444 self.clear_index()
6445 self.clear_version()
6447 def OutputUnchecked(self, out):
6448 if (self.has_cursor_):
6449 out.putVarInt32(10)
6450 out.putVarInt32(self.cursor_.ByteSize())
6451 self.cursor_.OutputUnchecked(out)
6452 for i in xrange(len(self.result_)):
6453 out.putVarInt32(18)
6454 out.putVarInt32(self.result_[i].ByteSize())
6455 self.result_[i].OutputUnchecked(out)
6456 out.putVarInt32(24)
6457 out.putBoolean(self.more_results_)
6458 if (self.has_keys_only_):
6459 out.putVarInt32(32)
6460 out.putBoolean(self.keys_only_)
6461 if (self.has_compiled_query_):
6462 out.putVarInt32(42)
6463 out.putVarInt32(self.compiled_query_.ByteSize())
6464 self.compiled_query_.OutputUnchecked(out)
6465 if (self.has_compiled_cursor_):
6466 out.putVarInt32(50)
6467 out.putVarInt32(self.compiled_cursor_.ByteSize())
6468 self.compiled_cursor_.OutputUnchecked(out)
6469 if (self.has_skipped_results_):
6470 out.putVarInt32(56)
6471 out.putVarInt32(self.skipped_results_)
6472 for i in xrange(len(self.index_)):
6473 out.putVarInt32(66)
6474 out.putVarInt32(self.index_[i].ByteSize())
6475 self.index_[i].OutputUnchecked(out)
6476 if (self.has_index_only_):
6477 out.putVarInt32(72)
6478 out.putBoolean(self.index_only_)
6479 if (self.has_small_ops_):
6480 out.putVarInt32(80)
6481 out.putBoolean(self.small_ops_)
6482 for i in xrange(len(self.version_)):
6483 out.putVarInt32(88)
6484 out.putVarInt64(self.version_[i])
6486 def OutputPartial(self, out):
6487 if (self.has_cursor_):
6488 out.putVarInt32(10)
6489 out.putVarInt32(self.cursor_.ByteSizePartial())
6490 self.cursor_.OutputPartial(out)
6491 for i in xrange(len(self.result_)):
6492 out.putVarInt32(18)
6493 out.putVarInt32(self.result_[i].ByteSizePartial())
6494 self.result_[i].OutputPartial(out)
6495 if (self.has_more_results_):
6496 out.putVarInt32(24)
6497 out.putBoolean(self.more_results_)
6498 if (self.has_keys_only_):
6499 out.putVarInt32(32)
6500 out.putBoolean(self.keys_only_)
6501 if (self.has_compiled_query_):
6502 out.putVarInt32(42)
6503 out.putVarInt32(self.compiled_query_.ByteSizePartial())
6504 self.compiled_query_.OutputPartial(out)
6505 if (self.has_compiled_cursor_):
6506 out.putVarInt32(50)
6507 out.putVarInt32(self.compiled_cursor_.ByteSizePartial())
6508 self.compiled_cursor_.OutputPartial(out)
6509 if (self.has_skipped_results_):
6510 out.putVarInt32(56)
6511 out.putVarInt32(self.skipped_results_)
6512 for i in xrange(len(self.index_)):
6513 out.putVarInt32(66)
6514 out.putVarInt32(self.index_[i].ByteSizePartial())
6515 self.index_[i].OutputPartial(out)
6516 if (self.has_index_only_):
6517 out.putVarInt32(72)
6518 out.putBoolean(self.index_only_)
6519 if (self.has_small_ops_):
6520 out.putVarInt32(80)
6521 out.putBoolean(self.small_ops_)
6522 for i in xrange(len(self.version_)):
6523 out.putVarInt32(88)
6524 out.putVarInt64(self.version_[i])
6526 def TryMerge(self, d):
6527 while d.avail() > 0:
6528 tt = d.getVarInt32()
6529 if tt == 10:
6530 length = d.getVarInt32()
6531 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6532 d.skip(length)
6533 self.mutable_cursor().TryMerge(tmp)
6534 continue
6535 if tt == 18:
6536 length = d.getVarInt32()
6537 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6538 d.skip(length)
6539 self.add_result().TryMerge(tmp)
6540 continue
6541 if tt == 24:
6542 self.set_more_results(d.getBoolean())
6543 continue
6544 if tt == 32:
6545 self.set_keys_only(d.getBoolean())
6546 continue
6547 if tt == 42:
6548 length = d.getVarInt32()
6549 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6550 d.skip(length)
6551 self.mutable_compiled_query().TryMerge(tmp)
6552 continue
6553 if tt == 50:
6554 length = d.getVarInt32()
6555 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6556 d.skip(length)
6557 self.mutable_compiled_cursor().TryMerge(tmp)
6558 continue
6559 if tt == 56:
6560 self.set_skipped_results(d.getVarInt32())
6561 continue
6562 if tt == 66:
6563 length = d.getVarInt32()
6564 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6565 d.skip(length)
6566 self.add_index().TryMerge(tmp)
6567 continue
6568 if tt == 72:
6569 self.set_index_only(d.getBoolean())
6570 continue
6571 if tt == 80:
6572 self.set_small_ops(d.getBoolean())
6573 continue
6574 if tt == 88:
6575 self.add_version(d.getVarInt64())
6576 continue
6579 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
6580 d.skipData(tt)
6583 def __str__(self, prefix="", printElemNumber=0):
6584 res=""
6585 if self.has_cursor_:
6586 res+=prefix+"cursor <\n"
6587 res+=self.cursor_.__str__(prefix + " ", printElemNumber)
6588 res+=prefix+">\n"
6589 cnt=0
6590 for e in self.result_:
6591 elm=""
6592 if printElemNumber: elm="(%d)" % cnt
6593 res+=prefix+("result%s <\n" % elm)
6594 res+=e.__str__(prefix + " ", printElemNumber)
6595 res+=prefix+">\n"
6596 cnt+=1
6597 if self.has_skipped_results_: res+=prefix+("skipped_results: %s\n" % self.DebugFormatInt32(self.skipped_results_))
6598 if self.has_more_results_: res+=prefix+("more_results: %s\n" % self.DebugFormatBool(self.more_results_))
6599 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
6600 if self.has_index_only_: res+=prefix+("index_only: %s\n" % self.DebugFormatBool(self.index_only_))
6601 if self.has_small_ops_: res+=prefix+("small_ops: %s\n" % self.DebugFormatBool(self.small_ops_))
6602 if self.has_compiled_query_:
6603 res+=prefix+"compiled_query <\n"
6604 res+=self.compiled_query_.__str__(prefix + " ", printElemNumber)
6605 res+=prefix+">\n"
6606 if self.has_compiled_cursor_:
6607 res+=prefix+"compiled_cursor <\n"
6608 res+=self.compiled_cursor_.__str__(prefix + " ", printElemNumber)
6609 res+=prefix+">\n"
6610 cnt=0
6611 for e in self.index_:
6612 elm=""
6613 if printElemNumber: elm="(%d)" % cnt
6614 res+=prefix+("index%s <\n" % elm)
6615 res+=e.__str__(prefix + " ", printElemNumber)
6616 res+=prefix+">\n"
6617 cnt+=1
6618 cnt=0
6619 for e in self.version_:
6620 elm=""
6621 if printElemNumber: elm="(%d)" % cnt
6622 res+=prefix+("version%s: %s\n" % (elm, self.DebugFormatInt64(e)))
6623 cnt+=1
6624 return res
6627 def _BuildTagLookupTable(sparse, maxtag, default=None):
6628 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
6630 kcursor = 1
6631 kresult = 2
6632 kskipped_results = 7
6633 kmore_results = 3
6634 kkeys_only = 4
6635 kindex_only = 9
6636 ksmall_ops = 10
6637 kcompiled_query = 5
6638 kcompiled_cursor = 6
6639 kindex = 8
6640 kversion = 11
6642 _TEXT = _BuildTagLookupTable({
6643 0: "ErrorCode",
6644 1: "cursor",
6645 2: "result",
6646 3: "more_results",
6647 4: "keys_only",
6648 5: "compiled_query",
6649 6: "compiled_cursor",
6650 7: "skipped_results",
6651 8: "index",
6652 9: "index_only",
6653 10: "small_ops",
6654 11: "version",
6655 }, 11)
6657 _TYPES = _BuildTagLookupTable({
6658 0: ProtocolBuffer.Encoder.NUMERIC,
6659 1: ProtocolBuffer.Encoder.STRING,
6660 2: ProtocolBuffer.Encoder.STRING,
6661 3: ProtocolBuffer.Encoder.NUMERIC,
6662 4: ProtocolBuffer.Encoder.NUMERIC,
6663 5: ProtocolBuffer.Encoder.STRING,
6664 6: ProtocolBuffer.Encoder.STRING,
6665 7: ProtocolBuffer.Encoder.NUMERIC,
6666 8: ProtocolBuffer.Encoder.STRING,
6667 9: ProtocolBuffer.Encoder.NUMERIC,
6668 10: ProtocolBuffer.Encoder.NUMERIC,
6669 11: ProtocolBuffer.Encoder.NUMERIC,
6670 }, 11, ProtocolBuffer.Encoder.MAX_TYPE)
6673 _STYLE = """"""
6674 _STYLE_CONTENT_TYPE = """"""
6675 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.QueryResult'
6676 class AllocateIdsRequest(ProtocolBuffer.ProtocolMessage):
6677 has_model_key_ = 0
6678 has_size_ = 0
6679 size_ = 0
6680 has_max_ = 0
6681 max_ = 0
6683 def __init__(self, contents=None):
6684 self.model_key_ = Reference()
6685 if contents is not None: self.MergeFromString(contents)
6687 def model_key(self): return self.model_key_
6689 def mutable_model_key(self): self.has_model_key_ = 1; return self.model_key_
6691 def clear_model_key(self):self.has_model_key_ = 0; self.model_key_.Clear()
6693 def has_model_key(self): return self.has_model_key_
6695 def size(self): return self.size_
6697 def set_size(self, x):
6698 self.has_size_ = 1
6699 self.size_ = x
6701 def clear_size(self):
6702 if self.has_size_:
6703 self.has_size_ = 0
6704 self.size_ = 0
6706 def has_size(self): return self.has_size_
6708 def max(self): return self.max_
6710 def set_max(self, x):
6711 self.has_max_ = 1
6712 self.max_ = x
6714 def clear_max(self):
6715 if self.has_max_:
6716 self.has_max_ = 0
6717 self.max_ = 0
6719 def has_max(self): return self.has_max_
6722 def MergeFrom(self, x):
6723 assert x is not self
6724 if (x.has_model_key()): self.mutable_model_key().MergeFrom(x.model_key())
6725 if (x.has_size()): self.set_size(x.size())
6726 if (x.has_max()): self.set_max(x.max())
6728 def Equals(self, x):
6729 if x is self: return 1
6730 if self.has_model_key_ != x.has_model_key_: return 0
6731 if self.has_model_key_ and self.model_key_ != x.model_key_: return 0
6732 if self.has_size_ != x.has_size_: return 0
6733 if self.has_size_ and self.size_ != x.size_: return 0
6734 if self.has_max_ != x.has_max_: return 0
6735 if self.has_max_ and self.max_ != x.max_: return 0
6736 return 1
6738 def IsInitialized(self, debug_strs=None):
6739 initialized = 1
6740 if (not self.has_model_key_):
6741 initialized = 0
6742 if debug_strs is not None:
6743 debug_strs.append('Required field: model_key not set.')
6744 elif not self.model_key_.IsInitialized(debug_strs): initialized = 0
6745 return initialized
6747 def ByteSize(self):
6748 n = 0
6749 n += self.lengthString(self.model_key_.ByteSize())
6750 if (self.has_size_): n += 1 + self.lengthVarInt64(self.size_)
6751 if (self.has_max_): n += 1 + self.lengthVarInt64(self.max_)
6752 return n + 1
6754 def ByteSizePartial(self):
6755 n = 0
6756 if (self.has_model_key_):
6757 n += 1
6758 n += self.lengthString(self.model_key_.ByteSizePartial())
6759 if (self.has_size_): n += 1 + self.lengthVarInt64(self.size_)
6760 if (self.has_max_): n += 1 + self.lengthVarInt64(self.max_)
6761 return n
6763 def Clear(self):
6764 self.clear_model_key()
6765 self.clear_size()
6766 self.clear_max()
6768 def OutputUnchecked(self, out):
6769 out.putVarInt32(10)
6770 out.putVarInt32(self.model_key_.ByteSize())
6771 self.model_key_.OutputUnchecked(out)
6772 if (self.has_size_):
6773 out.putVarInt32(16)
6774 out.putVarInt64(self.size_)
6775 if (self.has_max_):
6776 out.putVarInt32(24)
6777 out.putVarInt64(self.max_)
6779 def OutputPartial(self, out):
6780 if (self.has_model_key_):
6781 out.putVarInt32(10)
6782 out.putVarInt32(self.model_key_.ByteSizePartial())
6783 self.model_key_.OutputPartial(out)
6784 if (self.has_size_):
6785 out.putVarInt32(16)
6786 out.putVarInt64(self.size_)
6787 if (self.has_max_):
6788 out.putVarInt32(24)
6789 out.putVarInt64(self.max_)
6791 def TryMerge(self, d):
6792 while d.avail() > 0:
6793 tt = d.getVarInt32()
6794 if tt == 10:
6795 length = d.getVarInt32()
6796 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6797 d.skip(length)
6798 self.mutable_model_key().TryMerge(tmp)
6799 continue
6800 if tt == 16:
6801 self.set_size(d.getVarInt64())
6802 continue
6803 if tt == 24:
6804 self.set_max(d.getVarInt64())
6805 continue
6808 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
6809 d.skipData(tt)
6812 def __str__(self, prefix="", printElemNumber=0):
6813 res=""
6814 if self.has_model_key_:
6815 res+=prefix+"model_key <\n"
6816 res+=self.model_key_.__str__(prefix + " ", printElemNumber)
6817 res+=prefix+">\n"
6818 if self.has_size_: res+=prefix+("size: %s\n" % self.DebugFormatInt64(self.size_))
6819 if self.has_max_: res+=prefix+("max: %s\n" % self.DebugFormatInt64(self.max_))
6820 return res
6823 def _BuildTagLookupTable(sparse, maxtag, default=None):
6824 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
6826 kmodel_key = 1
6827 ksize = 2
6828 kmax = 3
6830 _TEXT = _BuildTagLookupTable({
6831 0: "ErrorCode",
6832 1: "model_key",
6833 2: "size",
6834 3: "max",
6835 }, 3)
6837 _TYPES = _BuildTagLookupTable({
6838 0: ProtocolBuffer.Encoder.NUMERIC,
6839 1: ProtocolBuffer.Encoder.STRING,
6840 2: ProtocolBuffer.Encoder.NUMERIC,
6841 3: ProtocolBuffer.Encoder.NUMERIC,
6842 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
6845 _STYLE = """"""
6846 _STYLE_CONTENT_TYPE = """"""
6847 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.AllocateIdsRequest'
6848 class AllocateIdsResponse(ProtocolBuffer.ProtocolMessage):
6849 has_start_ = 0
6850 start_ = 0
6851 has_end_ = 0
6852 end_ = 0
6853 has_cost_ = 0
6854 cost_ = None
6856 def __init__(self, contents=None):
6857 self.lazy_init_lock_ = thread.allocate_lock()
6858 if contents is not None: self.MergeFromString(contents)
6860 def start(self): return self.start_
6862 def set_start(self, x):
6863 self.has_start_ = 1
6864 self.start_ = x
6866 def clear_start(self):
6867 if self.has_start_:
6868 self.has_start_ = 0
6869 self.start_ = 0
6871 def has_start(self): return self.has_start_
6873 def end(self): return self.end_
6875 def set_end(self, x):
6876 self.has_end_ = 1
6877 self.end_ = x
6879 def clear_end(self):
6880 if self.has_end_:
6881 self.has_end_ = 0
6882 self.end_ = 0
6884 def has_end(self): return self.has_end_
6886 def cost(self):
6887 if self.cost_ is None:
6888 self.lazy_init_lock_.acquire()
6889 try:
6890 if self.cost_ is None: self.cost_ = Cost()
6891 finally:
6892 self.lazy_init_lock_.release()
6893 return self.cost_
6895 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
6897 def clear_cost(self):
6899 if self.has_cost_:
6900 self.has_cost_ = 0;
6901 if self.cost_ is not None: self.cost_.Clear()
6903 def has_cost(self): return self.has_cost_
6906 def MergeFrom(self, x):
6907 assert x is not self
6908 if (x.has_start()): self.set_start(x.start())
6909 if (x.has_end()): self.set_end(x.end())
6910 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
6912 def Equals(self, x):
6913 if x is self: return 1
6914 if self.has_start_ != x.has_start_: return 0
6915 if self.has_start_ and self.start_ != x.start_: return 0
6916 if self.has_end_ != x.has_end_: return 0
6917 if self.has_end_ and self.end_ != x.end_: return 0
6918 if self.has_cost_ != x.has_cost_: return 0
6919 if self.has_cost_ and self.cost_ != x.cost_: return 0
6920 return 1
6922 def IsInitialized(self, debug_strs=None):
6923 initialized = 1
6924 if (not self.has_start_):
6925 initialized = 0
6926 if debug_strs is not None:
6927 debug_strs.append('Required field: start not set.')
6928 if (not self.has_end_):
6929 initialized = 0
6930 if debug_strs is not None:
6931 debug_strs.append('Required field: end not set.')
6932 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
6933 return initialized
6935 def ByteSize(self):
6936 n = 0
6937 n += self.lengthVarInt64(self.start_)
6938 n += self.lengthVarInt64(self.end_)
6939 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
6940 return n + 2
6942 def ByteSizePartial(self):
6943 n = 0
6944 if (self.has_start_):
6945 n += 1
6946 n += self.lengthVarInt64(self.start_)
6947 if (self.has_end_):
6948 n += 1
6949 n += self.lengthVarInt64(self.end_)
6950 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSizePartial())
6951 return n
6953 def Clear(self):
6954 self.clear_start()
6955 self.clear_end()
6956 self.clear_cost()
6958 def OutputUnchecked(self, out):
6959 out.putVarInt32(8)
6960 out.putVarInt64(self.start_)
6961 out.putVarInt32(16)
6962 out.putVarInt64(self.end_)
6963 if (self.has_cost_):
6964 out.putVarInt32(26)
6965 out.putVarInt32(self.cost_.ByteSize())
6966 self.cost_.OutputUnchecked(out)
6968 def OutputPartial(self, out):
6969 if (self.has_start_):
6970 out.putVarInt32(8)
6971 out.putVarInt64(self.start_)
6972 if (self.has_end_):
6973 out.putVarInt32(16)
6974 out.putVarInt64(self.end_)
6975 if (self.has_cost_):
6976 out.putVarInt32(26)
6977 out.putVarInt32(self.cost_.ByteSizePartial())
6978 self.cost_.OutputPartial(out)
6980 def TryMerge(self, d):
6981 while d.avail() > 0:
6982 tt = d.getVarInt32()
6983 if tt == 8:
6984 self.set_start(d.getVarInt64())
6985 continue
6986 if tt == 16:
6987 self.set_end(d.getVarInt64())
6988 continue
6989 if tt == 26:
6990 length = d.getVarInt32()
6991 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
6992 d.skip(length)
6993 self.mutable_cost().TryMerge(tmp)
6994 continue
6997 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
6998 d.skipData(tt)
7001 def __str__(self, prefix="", printElemNumber=0):
7002 res=""
7003 if self.has_start_: res+=prefix+("start: %s\n" % self.DebugFormatInt64(self.start_))
7004 if self.has_end_: res+=prefix+("end: %s\n" % self.DebugFormatInt64(self.end_))
7005 if self.has_cost_:
7006 res+=prefix+"cost <\n"
7007 res+=self.cost_.__str__(prefix + " ", printElemNumber)
7008 res+=prefix+">\n"
7009 return res
7012 def _BuildTagLookupTable(sparse, maxtag, default=None):
7013 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
7015 kstart = 1
7016 kend = 2
7017 kcost = 3
7019 _TEXT = _BuildTagLookupTable({
7020 0: "ErrorCode",
7021 1: "start",
7022 2: "end",
7023 3: "cost",
7024 }, 3)
7026 _TYPES = _BuildTagLookupTable({
7027 0: ProtocolBuffer.Encoder.NUMERIC,
7028 1: ProtocolBuffer.Encoder.NUMERIC,
7029 2: ProtocolBuffer.Encoder.NUMERIC,
7030 3: ProtocolBuffer.Encoder.STRING,
7031 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
7034 _STYLE = """"""
7035 _STYLE_CONTENT_TYPE = """"""
7036 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.AllocateIdsResponse'
7037 class CompositeIndices(ProtocolBuffer.ProtocolMessage):
7039 def __init__(self, contents=None):
7040 self.index_ = []
7041 if contents is not None: self.MergeFromString(contents)
7043 def index_size(self): return len(self.index_)
7044 def index_list(self): return self.index_
7046 def index(self, i):
7047 return self.index_[i]
7049 def mutable_index(self, i):
7050 return self.index_[i]
7052 def add_index(self):
7053 x = CompositeIndex()
7054 self.index_.append(x)
7055 return x
7057 def clear_index(self):
7058 self.index_ = []
7060 def MergeFrom(self, x):
7061 assert x is not self
7062 for i in xrange(x.index_size()): self.add_index().CopyFrom(x.index(i))
7064 def Equals(self, x):
7065 if x is self: return 1
7066 if len(self.index_) != len(x.index_): return 0
7067 for e1, e2 in zip(self.index_, x.index_):
7068 if e1 != e2: return 0
7069 return 1
7071 def IsInitialized(self, debug_strs=None):
7072 initialized = 1
7073 for p in self.index_:
7074 if not p.IsInitialized(debug_strs): initialized=0
7075 return initialized
7077 def ByteSize(self):
7078 n = 0
7079 n += 1 * len(self.index_)
7080 for i in xrange(len(self.index_)): n += self.lengthString(self.index_[i].ByteSize())
7081 return n
7083 def ByteSizePartial(self):
7084 n = 0
7085 n += 1 * len(self.index_)
7086 for i in xrange(len(self.index_)): n += self.lengthString(self.index_[i].ByteSizePartial())
7087 return n
7089 def Clear(self):
7090 self.clear_index()
7092 def OutputUnchecked(self, out):
7093 for i in xrange(len(self.index_)):
7094 out.putVarInt32(10)
7095 out.putVarInt32(self.index_[i].ByteSize())
7096 self.index_[i].OutputUnchecked(out)
7098 def OutputPartial(self, out):
7099 for i in xrange(len(self.index_)):
7100 out.putVarInt32(10)
7101 out.putVarInt32(self.index_[i].ByteSizePartial())
7102 self.index_[i].OutputPartial(out)
7104 def TryMerge(self, d):
7105 while d.avail() > 0:
7106 tt = d.getVarInt32()
7107 if tt == 10:
7108 length = d.getVarInt32()
7109 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
7110 d.skip(length)
7111 self.add_index().TryMerge(tmp)
7112 continue
7115 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
7116 d.skipData(tt)
7119 def __str__(self, prefix="", printElemNumber=0):
7120 res=""
7121 cnt=0
7122 for e in self.index_:
7123 elm=""
7124 if printElemNumber: elm="(%d)" % cnt
7125 res+=prefix+("index%s <\n" % elm)
7126 res+=e.__str__(prefix + " ", printElemNumber)
7127 res+=prefix+">\n"
7128 cnt+=1
7129 return res
7132 def _BuildTagLookupTable(sparse, maxtag, default=None):
7133 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
7135 kindex = 1
7137 _TEXT = _BuildTagLookupTable({
7138 0: "ErrorCode",
7139 1: "index",
7140 }, 1)
7142 _TYPES = _BuildTagLookupTable({
7143 0: ProtocolBuffer.Encoder.NUMERIC,
7144 1: ProtocolBuffer.Encoder.STRING,
7145 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
7148 _STYLE = """"""
7149 _STYLE_CONTENT_TYPE = """"""
7150 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.CompositeIndices'
7151 class AddActionsRequest(ProtocolBuffer.ProtocolMessage):
7152 has_transaction_ = 0
7154 def __init__(self, contents=None):
7155 self.transaction_ = Transaction()
7156 self.action_ = []
7157 if contents is not None: self.MergeFromString(contents)
7159 def transaction(self): return self.transaction_
7161 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction_
7163 def clear_transaction(self):self.has_transaction_ = 0; self.transaction_.Clear()
7165 def has_transaction(self): return self.has_transaction_
7167 def action_size(self): return len(self.action_)
7168 def action_list(self): return self.action_
7170 def action(self, i):
7171 return self.action_[i]
7173 def mutable_action(self, i):
7174 return self.action_[i]
7176 def add_action(self):
7177 x = Action()
7178 self.action_.append(x)
7179 return x
7181 def clear_action(self):
7182 self.action_ = []
7184 def MergeFrom(self, x):
7185 assert x is not self
7186 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
7187 for i in xrange(x.action_size()): self.add_action().CopyFrom(x.action(i))
7189 def Equals(self, x):
7190 if x is self: return 1
7191 if self.has_transaction_ != x.has_transaction_: return 0
7192 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
7193 if len(self.action_) != len(x.action_): return 0
7194 for e1, e2 in zip(self.action_, x.action_):
7195 if e1 != e2: return 0
7196 return 1
7198 def IsInitialized(self, debug_strs=None):
7199 initialized = 1
7200 if (not self.has_transaction_):
7201 initialized = 0
7202 if debug_strs is not None:
7203 debug_strs.append('Required field: transaction not set.')
7204 elif not self.transaction_.IsInitialized(debug_strs): initialized = 0
7205 for p in self.action_:
7206 if not p.IsInitialized(debug_strs): initialized=0
7207 return initialized
7209 def ByteSize(self):
7210 n = 0
7211 n += self.lengthString(self.transaction_.ByteSize())
7212 n += 1 * len(self.action_)
7213 for i in xrange(len(self.action_)): n += self.lengthString(self.action_[i].ByteSize())
7214 return n + 1
7216 def ByteSizePartial(self):
7217 n = 0
7218 if (self.has_transaction_):
7219 n += 1
7220 n += self.lengthString(self.transaction_.ByteSizePartial())
7221 n += 1 * len(self.action_)
7222 for i in xrange(len(self.action_)): n += self.lengthString(self.action_[i].ByteSizePartial())
7223 return n
7225 def Clear(self):
7226 self.clear_transaction()
7227 self.clear_action()
7229 def OutputUnchecked(self, out):
7230 out.putVarInt32(10)
7231 out.putVarInt32(self.transaction_.ByteSize())
7232 self.transaction_.OutputUnchecked(out)
7233 for i in xrange(len(self.action_)):
7234 out.putVarInt32(18)
7235 out.putVarInt32(self.action_[i].ByteSize())
7236 self.action_[i].OutputUnchecked(out)
7238 def OutputPartial(self, out):
7239 if (self.has_transaction_):
7240 out.putVarInt32(10)
7241 out.putVarInt32(self.transaction_.ByteSizePartial())
7242 self.transaction_.OutputPartial(out)
7243 for i in xrange(len(self.action_)):
7244 out.putVarInt32(18)
7245 out.putVarInt32(self.action_[i].ByteSizePartial())
7246 self.action_[i].OutputPartial(out)
7248 def TryMerge(self, d):
7249 while d.avail() > 0:
7250 tt = d.getVarInt32()
7251 if tt == 10:
7252 length = d.getVarInt32()
7253 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
7254 d.skip(length)
7255 self.mutable_transaction().TryMerge(tmp)
7256 continue
7257 if tt == 18:
7258 length = d.getVarInt32()
7259 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
7260 d.skip(length)
7261 self.add_action().TryMerge(tmp)
7262 continue
7265 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
7266 d.skipData(tt)
7269 def __str__(self, prefix="", printElemNumber=0):
7270 res=""
7271 if self.has_transaction_:
7272 res+=prefix+"transaction <\n"
7273 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
7274 res+=prefix+">\n"
7275 cnt=0
7276 for e in self.action_:
7277 elm=""
7278 if printElemNumber: elm="(%d)" % cnt
7279 res+=prefix+("action%s <\n" % elm)
7280 res+=e.__str__(prefix + " ", printElemNumber)
7281 res+=prefix+">\n"
7282 cnt+=1
7283 return res
7286 def _BuildTagLookupTable(sparse, maxtag, default=None):
7287 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
7289 ktransaction = 1
7290 kaction = 2
7292 _TEXT = _BuildTagLookupTable({
7293 0: "ErrorCode",
7294 1: "transaction",
7295 2: "action",
7296 }, 2)
7298 _TYPES = _BuildTagLookupTable({
7299 0: ProtocolBuffer.Encoder.NUMERIC,
7300 1: ProtocolBuffer.Encoder.STRING,
7301 2: ProtocolBuffer.Encoder.STRING,
7302 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
7305 _STYLE = """"""
7306 _STYLE_CONTENT_TYPE = """"""
7307 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.AddActionsRequest'
7308 class AddActionsResponse(ProtocolBuffer.ProtocolMessage):
7310 def __init__(self, contents=None):
7311 pass
7312 if contents is not None: self.MergeFromString(contents)
7315 def MergeFrom(self, x):
7316 assert x is not self
7318 def Equals(self, x):
7319 if x is self: return 1
7320 return 1
7322 def IsInitialized(self, debug_strs=None):
7323 initialized = 1
7324 return initialized
7326 def ByteSize(self):
7327 n = 0
7328 return n
7330 def ByteSizePartial(self):
7331 n = 0
7332 return n
7334 def Clear(self):
7335 pass
7337 def OutputUnchecked(self, out):
7338 pass
7340 def OutputPartial(self, out):
7341 pass
7343 def TryMerge(self, d):
7344 while d.avail() > 0:
7345 tt = d.getVarInt32()
7348 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
7349 d.skipData(tt)
7352 def __str__(self, prefix="", printElemNumber=0):
7353 res=""
7354 return res
7357 def _BuildTagLookupTable(sparse, maxtag, default=None):
7358 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
7361 _TEXT = _BuildTagLookupTable({
7362 0: "ErrorCode",
7363 }, 0)
7365 _TYPES = _BuildTagLookupTable({
7366 0: ProtocolBuffer.Encoder.NUMERIC,
7367 }, 0, ProtocolBuffer.Encoder.MAX_TYPE)
7370 _STYLE = """"""
7371 _STYLE_CONTENT_TYPE = """"""
7372 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.AddActionsResponse'
7373 class BeginTransactionRequest(ProtocolBuffer.ProtocolMessage):
7374 has_app_ = 0
7375 app_ = ""
7376 has_allow_multiple_eg_ = 0
7377 allow_multiple_eg_ = 0
7379 def __init__(self, contents=None):
7380 if contents is not None: self.MergeFromString(contents)
7382 def app(self): return self.app_
7384 def set_app(self, x):
7385 self.has_app_ = 1
7386 self.app_ = x
7388 def clear_app(self):
7389 if self.has_app_:
7390 self.has_app_ = 0
7391 self.app_ = ""
7393 def has_app(self): return self.has_app_
7395 def allow_multiple_eg(self): return self.allow_multiple_eg_
7397 def set_allow_multiple_eg(self, x):
7398 self.has_allow_multiple_eg_ = 1
7399 self.allow_multiple_eg_ = x
7401 def clear_allow_multiple_eg(self):
7402 if self.has_allow_multiple_eg_:
7403 self.has_allow_multiple_eg_ = 0
7404 self.allow_multiple_eg_ = 0
7406 def has_allow_multiple_eg(self): return self.has_allow_multiple_eg_
7409 def MergeFrom(self, x):
7410 assert x is not self
7411 if (x.has_app()): self.set_app(x.app())
7412 if (x.has_allow_multiple_eg()): self.set_allow_multiple_eg(x.allow_multiple_eg())
7414 def Equals(self, x):
7415 if x is self: return 1
7416 if self.has_app_ != x.has_app_: return 0
7417 if self.has_app_ and self.app_ != x.app_: return 0
7418 if self.has_allow_multiple_eg_ != x.has_allow_multiple_eg_: return 0
7419 if self.has_allow_multiple_eg_ and self.allow_multiple_eg_ != x.allow_multiple_eg_: return 0
7420 return 1
7422 def IsInitialized(self, debug_strs=None):
7423 initialized = 1
7424 if (not self.has_app_):
7425 initialized = 0
7426 if debug_strs is not None:
7427 debug_strs.append('Required field: app not set.')
7428 return initialized
7430 def ByteSize(self):
7431 n = 0
7432 n += self.lengthString(len(self.app_))
7433 if (self.has_allow_multiple_eg_): n += 2
7434 return n + 1
7436 def ByteSizePartial(self):
7437 n = 0
7438 if (self.has_app_):
7439 n += 1
7440 n += self.lengthString(len(self.app_))
7441 if (self.has_allow_multiple_eg_): n += 2
7442 return n
7444 def Clear(self):
7445 self.clear_app()
7446 self.clear_allow_multiple_eg()
7448 def OutputUnchecked(self, out):
7449 out.putVarInt32(10)
7450 out.putPrefixedString(self.app_)
7451 if (self.has_allow_multiple_eg_):
7452 out.putVarInt32(16)
7453 out.putBoolean(self.allow_multiple_eg_)
7455 def OutputPartial(self, out):
7456 if (self.has_app_):
7457 out.putVarInt32(10)
7458 out.putPrefixedString(self.app_)
7459 if (self.has_allow_multiple_eg_):
7460 out.putVarInt32(16)
7461 out.putBoolean(self.allow_multiple_eg_)
7463 def TryMerge(self, d):
7464 while d.avail() > 0:
7465 tt = d.getVarInt32()
7466 if tt == 10:
7467 self.set_app(d.getPrefixedString())
7468 continue
7469 if tt == 16:
7470 self.set_allow_multiple_eg(d.getBoolean())
7471 continue
7474 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
7475 d.skipData(tt)
7478 def __str__(self, prefix="", printElemNumber=0):
7479 res=""
7480 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_))
7481 if self.has_allow_multiple_eg_: res+=prefix+("allow_multiple_eg: %s\n" % self.DebugFormatBool(self.allow_multiple_eg_))
7482 return res
7485 def _BuildTagLookupTable(sparse, maxtag, default=None):
7486 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
7488 kapp = 1
7489 kallow_multiple_eg = 2
7491 _TEXT = _BuildTagLookupTable({
7492 0: "ErrorCode",
7493 1: "app",
7494 2: "allow_multiple_eg",
7495 }, 2)
7497 _TYPES = _BuildTagLookupTable({
7498 0: ProtocolBuffer.Encoder.NUMERIC,
7499 1: ProtocolBuffer.Encoder.STRING,
7500 2: ProtocolBuffer.Encoder.NUMERIC,
7501 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
7504 _STYLE = """"""
7505 _STYLE_CONTENT_TYPE = """"""
7506 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.BeginTransactionRequest'
7507 class CommitResponse_Version(ProtocolBuffer.ProtocolMessage):
7508 has_root_entity_key_ = 0
7509 has_version_ = 0
7510 version_ = 0
7512 def __init__(self, contents=None):
7513 self.root_entity_key_ = Reference()
7514 if contents is not None: self.MergeFromString(contents)
7516 def root_entity_key(self): return self.root_entity_key_
7518 def mutable_root_entity_key(self): self.has_root_entity_key_ = 1; return self.root_entity_key_
7520 def clear_root_entity_key(self):self.has_root_entity_key_ = 0; self.root_entity_key_.Clear()
7522 def has_root_entity_key(self): return self.has_root_entity_key_
7524 def version(self): return self.version_
7526 def set_version(self, x):
7527 self.has_version_ = 1
7528 self.version_ = x
7530 def clear_version(self):
7531 if self.has_version_:
7532 self.has_version_ = 0
7533 self.version_ = 0
7535 def has_version(self): return self.has_version_
7538 def MergeFrom(self, x):
7539 assert x is not self
7540 if (x.has_root_entity_key()): self.mutable_root_entity_key().MergeFrom(x.root_entity_key())
7541 if (x.has_version()): self.set_version(x.version())
7543 def Equals(self, x):
7544 if x is self: return 1
7545 if self.has_root_entity_key_ != x.has_root_entity_key_: return 0
7546 if self.has_root_entity_key_ and self.root_entity_key_ != x.root_entity_key_: return 0
7547 if self.has_version_ != x.has_version_: return 0
7548 if self.has_version_ and self.version_ != x.version_: return 0
7549 return 1
7551 def IsInitialized(self, debug_strs=None):
7552 initialized = 1
7553 if (not self.has_root_entity_key_):
7554 initialized = 0
7555 if debug_strs is not None:
7556 debug_strs.append('Required field: root_entity_key not set.')
7557 elif not self.root_entity_key_.IsInitialized(debug_strs): initialized = 0
7558 if (not self.has_version_):
7559 initialized = 0
7560 if debug_strs is not None:
7561 debug_strs.append('Required field: version not set.')
7562 return initialized
7564 def ByteSize(self):
7565 n = 0
7566 n += self.lengthString(self.root_entity_key_.ByteSize())
7567 n += self.lengthVarInt64(self.version_)
7568 return n + 2
7570 def ByteSizePartial(self):
7571 n = 0
7572 if (self.has_root_entity_key_):
7573 n += 1
7574 n += self.lengthString(self.root_entity_key_.ByteSizePartial())
7575 if (self.has_version_):
7576 n += 1
7577 n += self.lengthVarInt64(self.version_)
7578 return n
7580 def Clear(self):
7581 self.clear_root_entity_key()
7582 self.clear_version()
7584 def OutputUnchecked(self, out):
7585 out.putVarInt32(34)
7586 out.putVarInt32(self.root_entity_key_.ByteSize())
7587 self.root_entity_key_.OutputUnchecked(out)
7588 out.putVarInt32(40)
7589 out.putVarInt64(self.version_)
7591 def OutputPartial(self, out):
7592 if (self.has_root_entity_key_):
7593 out.putVarInt32(34)
7594 out.putVarInt32(self.root_entity_key_.ByteSizePartial())
7595 self.root_entity_key_.OutputPartial(out)
7596 if (self.has_version_):
7597 out.putVarInt32(40)
7598 out.putVarInt64(self.version_)
7600 def TryMerge(self, d):
7601 while 1:
7602 tt = d.getVarInt32()
7603 if tt == 28: break
7604 if tt == 34:
7605 length = d.getVarInt32()
7606 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
7607 d.skip(length)
7608 self.mutable_root_entity_key().TryMerge(tmp)
7609 continue
7610 if tt == 40:
7611 self.set_version(d.getVarInt64())
7612 continue
7615 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
7616 d.skipData(tt)
7619 def __str__(self, prefix="", printElemNumber=0):
7620 res=""
7621 if self.has_root_entity_key_:
7622 res+=prefix+"root_entity_key <\n"
7623 res+=self.root_entity_key_.__str__(prefix + " ", printElemNumber)
7624 res+=prefix+">\n"
7625 if self.has_version_: res+=prefix+("version: %s\n" % self.DebugFormatInt64(self.version_))
7626 return res
7628 class CommitResponse(ProtocolBuffer.ProtocolMessage):
7629 has_cost_ = 0
7630 cost_ = None
7632 def __init__(self, contents=None):
7633 self.version_ = []
7634 self.lazy_init_lock_ = thread.allocate_lock()
7635 if contents is not None: self.MergeFromString(contents)
7637 def cost(self):
7638 if self.cost_ is None:
7639 self.lazy_init_lock_.acquire()
7640 try:
7641 if self.cost_ is None: self.cost_ = Cost()
7642 finally:
7643 self.lazy_init_lock_.release()
7644 return self.cost_
7646 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
7648 def clear_cost(self):
7650 if self.has_cost_:
7651 self.has_cost_ = 0;
7652 if self.cost_ is not None: self.cost_.Clear()
7654 def has_cost(self): return self.has_cost_
7656 def version_size(self): return len(self.version_)
7657 def version_list(self): return self.version_
7659 def version(self, i):
7660 return self.version_[i]
7662 def mutable_version(self, i):
7663 return self.version_[i]
7665 def add_version(self):
7666 x = CommitResponse_Version()
7667 self.version_.append(x)
7668 return x
7670 def clear_version(self):
7671 self.version_ = []
7673 def MergeFrom(self, x):
7674 assert x is not self
7675 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
7676 for i in xrange(x.version_size()): self.add_version().CopyFrom(x.version(i))
7678 def Equals(self, x):
7679 if x is self: return 1
7680 if self.has_cost_ != x.has_cost_: return 0
7681 if self.has_cost_ and self.cost_ != x.cost_: return 0
7682 if len(self.version_) != len(x.version_): return 0
7683 for e1, e2 in zip(self.version_, x.version_):
7684 if e1 != e2: return 0
7685 return 1
7687 def IsInitialized(self, debug_strs=None):
7688 initialized = 1
7689 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
7690 for p in self.version_:
7691 if not p.IsInitialized(debug_strs): initialized=0
7692 return initialized
7694 def ByteSize(self):
7695 n = 0
7696 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
7697 n += 2 * len(self.version_)
7698 for i in xrange(len(self.version_)): n += self.version_[i].ByteSize()
7699 return n
7701 def ByteSizePartial(self):
7702 n = 0
7703 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSizePartial())
7704 n += 2 * len(self.version_)
7705 for i in xrange(len(self.version_)): n += self.version_[i].ByteSizePartial()
7706 return n
7708 def Clear(self):
7709 self.clear_cost()
7710 self.clear_version()
7712 def OutputUnchecked(self, out):
7713 if (self.has_cost_):
7714 out.putVarInt32(10)
7715 out.putVarInt32(self.cost_.ByteSize())
7716 self.cost_.OutputUnchecked(out)
7717 for i in xrange(len(self.version_)):
7718 out.putVarInt32(27)
7719 self.version_[i].OutputUnchecked(out)
7720 out.putVarInt32(28)
7722 def OutputPartial(self, out):
7723 if (self.has_cost_):
7724 out.putVarInt32(10)
7725 out.putVarInt32(self.cost_.ByteSizePartial())
7726 self.cost_.OutputPartial(out)
7727 for i in xrange(len(self.version_)):
7728 out.putVarInt32(27)
7729 self.version_[i].OutputPartial(out)
7730 out.putVarInt32(28)
7732 def TryMerge(self, d):
7733 while d.avail() > 0:
7734 tt = d.getVarInt32()
7735 if tt == 10:
7736 length = d.getVarInt32()
7737 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
7738 d.skip(length)
7739 self.mutable_cost().TryMerge(tmp)
7740 continue
7741 if tt == 27:
7742 self.add_version().TryMerge(d)
7743 continue
7746 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
7747 d.skipData(tt)
7750 def __str__(self, prefix="", printElemNumber=0):
7751 res=""
7752 if self.has_cost_:
7753 res+=prefix+"cost <\n"
7754 res+=self.cost_.__str__(prefix + " ", printElemNumber)
7755 res+=prefix+">\n"
7756 cnt=0
7757 for e in self.version_:
7758 elm=""
7759 if printElemNumber: elm="(%d)" % cnt
7760 res+=prefix+("Version%s {\n" % elm)
7761 res+=e.__str__(prefix + " ", printElemNumber)
7762 res+=prefix+"}\n"
7763 cnt+=1
7764 return res
7767 def _BuildTagLookupTable(sparse, maxtag, default=None):
7768 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
7770 kcost = 1
7771 kVersionGroup = 3
7772 kVersionroot_entity_key = 4
7773 kVersionversion = 5
7775 _TEXT = _BuildTagLookupTable({
7776 0: "ErrorCode",
7777 1: "cost",
7778 3: "Version",
7779 4: "root_entity_key",
7780 5: "version",
7781 }, 5)
7783 _TYPES = _BuildTagLookupTable({
7784 0: ProtocolBuffer.Encoder.NUMERIC,
7785 1: ProtocolBuffer.Encoder.STRING,
7786 3: ProtocolBuffer.Encoder.STARTGROUP,
7787 4: ProtocolBuffer.Encoder.STRING,
7788 5: ProtocolBuffer.Encoder.NUMERIC,
7789 }, 5, ProtocolBuffer.Encoder.MAX_TYPE)
7792 _STYLE = """"""
7793 _STYLE_CONTENT_TYPE = """"""
7794 _PROTO_DESCRIPTOR_NAME = 'apphosting_datastore_v3.CommitResponse'
7795 if _extension_runtime:
7796 pass
7798 __all__ = ['Transaction','Query','Query_Filter','Query_Order','CompiledQuery','CompiledQuery_PrimaryScan','CompiledQuery_MergeJoinScan','CompiledQuery_EntityFilter','CompiledCursor','CompiledCursor_PositionIndexValue','CompiledCursor_Position','Cursor','Error','Cost','Cost_CommitCost','GetRequest','GetResponse','GetResponse_Entity','PutRequest','PutResponse','TouchRequest','TouchResponse','DeleteRequest','DeleteResponse','NextRequest','QueryResult','AllocateIdsRequest','AllocateIdsResponse','CompositeIndices','AddActionsRequest','AddActionsResponse','BeginTransactionRequest','CommitResponse','CommitResponse_Version']