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
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
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
):
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
):
63 def clear_handle(self
):
68 def has_handle(self
): return self
.has_handle_
70 def app(self
): return 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
):
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())
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
113 def IsInitialized(self
, debug_strs
=None):
115 if (not self
.has_handle_
):
117 if debug_strs
is not None:
118 debug_strs
.append('Required field: handle not set.')
119 if (not self
.has_app_
):
121 if debug_strs
is not None:
122 debug_strs
.append('Required field: app not set.')
127 n
+= self
.lengthString(len(self
.app_
))
128 if (self
.has_mark_changes_
): n
+= 2
131 def ByteSizePartial(self
):
133 if (self
.has_handle_
):
137 n
+= self
.lengthString(len(self
.app_
))
138 if (self
.has_mark_changes_
): n
+= 2
144 self
.clear_mark_changes()
146 def OutputUnchecked(self
, out
):
148 out
.put64(self
.handle_
)
150 out
.putPrefixedString(self
.app_
)
151 if (self
.has_mark_changes_
):
153 out
.putBoolean(self
.mark_changes_
)
155 def OutputPartial(self
, out
):
156 if (self
.has_handle_
):
158 out
.put64(self
.handle_
)
161 out
.putPrefixedString(self
.app_
)
162 if (self
.has_mark_changes_
):
164 out
.putBoolean(self
.mark_changes_
)
166 def TryMerge(self
, d
):
170 self
.set_handle(d
.get64())
173 self
.set_app(d
.getPrefixedString())
176 self
.set_mark_changes(d
.getBoolean())
180 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
184 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
192 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
193 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
199 _TEXT
= _BuildTagLookupTable({
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
)
215 _STYLE_CONTENT_TYPE
= """"""
216 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.Transaction'
217 class Query_Filter(ProtocolBuffer
.ProtocolMessage
):
221 LESS_THAN_OR_EQUAL
= 2
223 GREATER_THAN_OR_EQUAL
= 4
230 2: "LESS_THAN_OR_EQUAL",
232 4: "GREATER_THAN_OR_EQUAL",
238 def Operator_Name(cls
, x
): return cls
._Operator
_NAMES
.get(x
, "")
239 Operator_Name
= classmethod(Operator_Name
)
244 def __init__(self
, contents
=None):
246 if contents
is not None: self
.MergeFromString(contents
)
248 def op(self
): return self
.op_
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
):
272 self
.property_
.append(x
)
275 def clear_property(self
):
278 def MergeFrom(self
, x
):
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
))
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
292 def IsInitialized(self
, debug_strs
=None):
294 if (not self
.has_op_
):
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
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())
309 def ByteSizePartial(self
):
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())
320 self
.clear_property()
322 def OutputUnchecked(self
, out
):
324 out
.putVarInt32(self
.op_
)
325 for i
in xrange(len(self
.property_
)):
327 out
.putVarInt32(self
.property_
[i
].ByteSize())
328 self
.property_
[i
].OutputUnchecked(out
)
330 def OutputPartial(self
, out
):
333 out
.putVarInt32(self
.op_
)
334 for i
in xrange(len(self
.property_
)):
336 out
.putVarInt32(self
.property_
[i
].ByteSizePartial())
337 self
.property_
[i
].OutputPartial(out
)
339 def TryMerge(self
, d
):
344 self
.set_op(d
.getVarInt32())
347 length
= d
.getVarInt32()
348 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
350 self
.add_property().TryMerge(tmp
)
354 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
358 def __str__(self
, prefix
="", printElemNumber
=0):
360 if self
.has_op_
: res
+=prefix
+("op: %s\n" % self
.DebugFormatInt32(self
.op_
))
362 for e
in self
.property_
:
364 if printElemNumber
: elm
="(%d)" % cnt
365 res
+=prefix
+("property%s <\n" % elm
)
366 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
371 class Query_Order(ProtocolBuffer
.ProtocolMessage
):
382 def Direction_Name(cls
, x
): return cls
._Direction
_NAMES
.get(x
, "")
383 Direction_Name
= classmethod(Direction_Name
)
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
399 def clear_property(self
):
400 if self
.has_property_
:
401 self
.has_property_
= 0
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
412 def clear_direction(self
):
413 if self
.has_direction_
:
414 self
.has_direction_
= 0
417 def has_direction(self
): return self
.has_direction_
420 def MergeFrom(self
, x
):
422 if (x
.has_property()): self
.set_property(x
.property())
423 if (x
.has_direction()): self
.set_direction(x
.direction())
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
433 def IsInitialized(self
, debug_strs
=None):
435 if (not self
.has_property_
):
437 if debug_strs
is not None:
438 debug_strs
.append('Required field: property not set.')
443 n
+= self
.lengthString(len(self
.property_
))
444 if (self
.has_direction_
): n
+= 1 + self
.lengthVarInt64(self
.direction_
)
447 def ByteSizePartial(self
):
449 if (self
.has_property_
):
451 n
+= self
.lengthString(len(self
.property_
))
452 if (self
.has_direction_
): n
+= 1 + self
.lengthVarInt64(self
.direction_
)
456 self
.clear_property()
457 self
.clear_direction()
459 def OutputUnchecked(self
, out
):
461 out
.putPrefixedString(self
.property_
)
462 if (self
.has_direction_
):
464 out
.putVarInt32(self
.direction_
)
466 def OutputPartial(self
, out
):
467 if (self
.has_property_
):
469 out
.putPrefixedString(self
.property_
)
470 if (self
.has_direction_
):
472 out
.putVarInt32(self
.direction_
)
474 def TryMerge(self
, d
):
479 self
.set_property(d
.getPrefixedString())
482 self
.set_direction(d
.getVarInt32())
486 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
490 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
496 class Query(ProtocolBuffer
.ProtocolMessage
):
509 def Hint_Name(cls
, x
): return cls
._Hint
_NAMES
.get(x
, "")
510 Hint_Name
= classmethod(Hint_Name
)
520 has_search_query_
= 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
548 has_min_safe_time_seconds_
= 0
549 min_safe_time_seconds_
= 0
550 has_persist_offset_
= 0
553 def __init__(self
, contents
=None):
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
):
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
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
):
595 def clear_kind(self
):
600 def has_kind(self
): return self
.has_kind_
603 if self
.ancestor_
is None:
604 self
.lazy_init_lock_
.acquire()
606 if self
.ancestor_
is None: self
.ancestor_
= Reference()
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_
625 return self
.filter_
[i
]
627 def mutable_filter(self
, i
):
628 return self
.filter_
[i
]
630 def add_filter(self
):
632 self
.filter_
.append(x
)
635 def clear_filter(self
):
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_
654 return self
.order_
[i
]
656 def mutable_order(self
, i
):
657 return self
.order_
[i
]
661 self
.order_
.append(x
)
664 def clear_order(self
):
666 def hint(self
): return self
.hint_
668 def set_hint(self
, x
):
672 def clear_hint(self
):
677 def has_hint(self
): return self
.has_hint_
679 def count(self
): return self
.count_
681 def set_count(self
, x
):
685 def clear_count(self
):
690 def has_count(self
): return self
.has_count_
692 def offset(self
): return self
.offset_
694 def set_offset(self
, x
):
698 def clear_offset(self
):
703 def has_offset(self
): return self
.has_offset_
705 def limit(self
): return self
.limit_
707 def set_limit(self
, x
):
711 def clear_limit(self
):
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()
722 if self
.compiled_cursor_
is None: self
.compiled_cursor_
= CompiledCursor()
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()
741 if self
.end_compiled_cursor_
is None: self
.end_compiled_cursor_
= CompiledCursor()
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
):
767 self
.composite_index_
.append(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
791 def clear_keys_only(self
):
792 if self
.has_keys_only_
:
793 self
.has_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()
802 if self
.transaction_
is None: self
.transaction_
= Transaction()
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
823 def clear_compile(self
):
824 if self
.has_compile_
:
825 self
.has_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
):
849 def clear_strong(self
):
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
892 def clear_distinct(self
):
893 if self
.has_distinct_
:
894 self
.has_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
):
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())
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
1032 def IsInitialized(self
, debug_strs
=None):
1034 if (not self
.has_app_
):
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
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
1086 def ByteSizePartial(self
):
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
1126 self
.clear_name_space()
1128 self
.clear_ancestor()
1130 self
.clear_search_query()
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()
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
):
1154 out
.putPrefixedString(self
.app_
)
1155 if (self
.has_kind_
):
1157 out
.putPrefixedString(self
.kind_
)
1158 for i
in xrange(len(self
.filter_
)):
1160 self
.filter_
[i
].OutputUnchecked(out
)
1162 if (self
.has_search_query_
):
1164 out
.putPrefixedString(self
.search_query_
)
1165 for i
in xrange(len(self
.order_
)):
1167 self
.order_
[i
].OutputUnchecked(out
)
1169 if (self
.has_offset_
):
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
):
1241 out
.putPrefixedString(self
.app_
)
1242 if (self
.has_kind_
):
1244 out
.putPrefixedString(self
.kind_
)
1245 for i
in xrange(len(self
.filter_
)):
1247 self
.filter_
[i
].OutputPartial(out
)
1249 if (self
.has_search_query_
):
1251 out
.putPrefixedString(self
.search_query_
)
1252 for i
in xrange(len(self
.order_
)):
1254 self
.order_
[i
].OutputPartial(out
)
1256 if (self
.has_offset_
):
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()
1329 self
.set_app(d
.getPrefixedString())
1332 self
.set_kind(d
.getPrefixedString())
1335 self
.add_filter().TryMerge(d
)
1338 self
.set_search_query(d
.getPrefixedString())
1341 self
.add_order().TryMerge(d
)
1344 self
.set_offset(d
.getVarInt32())
1347 self
.set_limit(d
.getVarInt32())
1350 length
= d
.getVarInt32()
1351 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1353 self
.mutable_ancestor().TryMerge(tmp
)
1356 self
.set_hint(d
.getVarInt32())
1359 length
= d
.getVarInt32()
1360 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1362 self
.add_composite_index().TryMerge(tmp
)
1365 self
.set_require_perfect_plan(d
.getBoolean())
1368 self
.set_keys_only(d
.getBoolean())
1371 length
= d
.getVarInt32()
1372 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1374 self
.mutable_transaction().TryMerge(tmp
)
1377 self
.set_count(d
.getVarInt32())
1380 self
.set_distinct(d
.getBoolean())
1383 self
.set_compile(d
.getBoolean())
1386 self
.set_failover_ms(d
.getVarInt64())
1389 self
.set_name_space(d
.getPrefixedString())
1392 length
= d
.getVarInt32()
1393 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1395 self
.mutable_compiled_cursor().TryMerge(tmp
)
1398 length
= d
.getVarInt32()
1399 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1401 self
.mutable_end_compiled_cursor().TryMerge(tmp
)
1404 self
.set_strong(d
.getBoolean())
1407 self
.add_property_name(d
.getPrefixedString())
1410 self
.add_group_by_property_name(d
.getPrefixedString())
1413 self
.set_min_safe_time_seconds(d
.getVarInt64())
1416 self
.add_safe_replica_name(d
.getPrefixedString())
1419 self
.set_persist_offset(d
.getBoolean())
1423 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1427 def __str__(self
, prefix
="", printElemNumber
=0):
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
)
1437 for e
in self
.filter_
:
1439 if printElemNumber
: elm
="(%d)" % cnt
1440 res
+=prefix
+("Filter%s {\n" % elm
)
1441 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1444 if self
.has_search_query_
: res
+=prefix
+("search_query: %s\n" % self
.DebugFormatString(self
.search_query_
))
1446 for e
in self
.order_
:
1448 if printElemNumber
: elm
="(%d)" % cnt
1449 res
+=prefix
+("Order%s {\n" % elm
)
1450 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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
)
1461 if self
.has_end_compiled_cursor_
:
1462 res
+=prefix
+"end_compiled_cursor <\n"
1463 res
+=self
.end_compiled_cursor_
.__str
__(prefix
+ " ", printElemNumber
)
1466 for e
in self
.composite_index_
:
1468 if printElemNumber
: elm
="(%d)" % cnt
1469 res
+=prefix
+("composite_index%s <\n" % elm
)
1470 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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
)
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_
))
1483 for e
in self
.property_name_
:
1485 if printElemNumber
: elm
="(%d)" % cnt
1486 res
+=prefix
+("property_name%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
1489 for e
in self
.group_by_property_name_
:
1491 if printElemNumber
: elm
="(%d)" % cnt
1492 res
+=prefix
+("group_by_property_name%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
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_
))
1497 for e
in self
.safe_replica_name_
:
1499 if printElemNumber
: elm
="(%d)" % cnt
1500 res
+=prefix
+("safe_replica_name%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
1502 if self
.has_persist_offset_
: res
+=prefix
+("persist_offset: %s\n" % self
.DebugFormatBool(self
.persist_offset_
))
1506 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1507 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1515 kFilterproperty
= 14
1519 kOrderdirection
= 11
1524 kcompiled_cursor
= 30
1525 kend_compiled_cursor
= 31
1526 kcomposite_index
= 19
1527 krequire_perfect_plan
= 20
1534 kgroup_by_property_name
= 34
1536 kmin_safe_time_seconds
= 35
1537 ksafe_replica_name
= 36
1538 kpersist_offset
= 37
1540 _TEXT
= _BuildTagLookupTable({
1555 19: "composite_index",
1556 20: "require_perfect_plan",
1564 30: "compiled_cursor",
1565 31: "end_compiled_cursor",
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",
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
)
1610 _STYLE_CONTENT_TYPE
= """"""
1611 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.Query'
1612 class CompiledQuery_PrimaryScan(ProtocolBuffer
.ProtocolMessage
):
1617 has_start_inclusive_
= 0
1618 start_inclusive_
= 0
1621 has_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
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
1676 def clear_end_key(self
):
1677 if self
.has_end_key_
:
1678 self
.has_end_key_
= 0
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
1773 def IsInitialized(self
, debug_strs
=None):
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_
)
1791 def ByteSizePartial(self
):
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_
)
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_
):
1818 out
.putPrefixedString(self
.index_name_
)
1819 if (self
.has_start_key_
):
1821 out
.putPrefixedString(self
.start_key_
)
1822 if (self
.has_start_inclusive_
):
1824 out
.putBoolean(self
.start_inclusive_
)
1825 if (self
.has_end_key_
):
1827 out
.putPrefixedString(self
.end_key_
)
1828 if (self
.has_end_inclusive_
):
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_
):
1844 out
.putPrefixedString(self
.index_name_
)
1845 if (self
.has_start_key_
):
1847 out
.putPrefixedString(self
.start_key_
)
1848 if (self
.has_start_inclusive_
):
1850 out
.putBoolean(self
.start_inclusive_
)
1851 if (self
.has_end_key_
):
1853 out
.putPrefixedString(self
.end_key_
)
1854 if (self
.has_end_inclusive_
):
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
):
1869 tt
= d
.getVarInt32()
1872 self
.set_index_name(d
.getPrefixedString())
1875 self
.set_start_key(d
.getPrefixedString())
1878 self
.set_start_inclusive(d
.getBoolean())
1881 self
.set_end_key(d
.getPrefixedString())
1884 self
.set_end_inclusive(d
.getBoolean())
1887 self
.set_end_unapplied_log_timestamp_us(d
.getVarInt64())
1890 self
.add_start_postfix_value(d
.getPrefixedString())
1893 self
.add_end_postfix_value(d
.getPrefixedString())
1897 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1901 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
1909 for e
in self
.start_postfix_value_
:
1911 if printElemNumber
: elm
="(%d)" % cnt
1912 res
+=prefix
+("start_postfix_value%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
1915 for e
in self
.end_postfix_value_
:
1917 if printElemNumber
: elm
="(%d)" % cnt
1918 res
+=prefix
+("end_postfix_value%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
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_
))
1923 class CompiledQuery_MergeJoinScan(ProtocolBuffer
.ProtocolMessage
):
1926 has_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
1992 def IsInitialized(self
, debug_strs
=None):
1994 if (not self
.has_index_name_
):
1996 if debug_strs
is not None:
1997 debug_strs
.append('Required field: index_name not set.')
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
2008 def ByteSizePartial(self
):
2010 if (self
.has_index_name_
):
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
2019 self
.clear_index_name()
2020 self
.clear_prefix_value()
2021 self
.clear_value_prefix()
2023 def OutputUnchecked(self
, out
):
2025 out
.putPrefixedString(self
.index_name_
)
2026 for i
in xrange(len(self
.prefix_value_
)):
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_
):
2036 out
.putPrefixedString(self
.index_name_
)
2037 for i
in xrange(len(self
.prefix_value_
)):
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
):
2046 tt
= d
.getVarInt32()
2049 self
.set_index_name(d
.getPrefixedString())
2052 self
.add_prefix_value(d
.getPrefixedString())
2055 self
.set_value_prefix(d
.getBoolean())
2059 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2063 def __str__(self
, prefix
="", printElemNumber
=0):
2065 if self
.has_index_name_
: res
+=prefix
+("index_name: %s\n" % self
.DebugFormatString(self
.index_name_
))
2067 for e
in self
.prefix_value_
:
2069 if printElemNumber
: elm
="(%d)" % cnt
2070 res
+=prefix
+("prefix_value%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
2072 if self
.has_value_prefix_
: res
+=prefix
+("value_prefix: %s\n" % self
.DebugFormatBool(self
.value_prefix_
))
2075 class CompiledQuery_EntityFilter(ProtocolBuffer
.ProtocolMessage
):
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
2093 def clear_distinct(self
):
2094 if self
.has_distinct_
:
2095 self
.has_distinct_
= 0
2098 def has_distinct(self
): return self
.has_distinct_
2100 def kind(self
): return self
.kind_
2102 def set_kind(self
, x
):
2106 def clear_kind(self
):
2111 def has_kind(self
): return self
.has_kind_
2114 if self
.ancestor_
is None:
2115 self
.lazy_init_lock_
.acquire()
2117 if self
.ancestor_
is None: self
.ancestor_
= Reference()
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
2149 def IsInitialized(self
, debug_strs
=None):
2151 if (self
.has_ancestor_
and not self
.ancestor_
.IsInitialized(debug_strs
)): initialized
= 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())
2161 def ByteSizePartial(self
):
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())
2169 self
.clear_distinct()
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
):
2199 tt
= d
.getVarInt32()
2202 self
.set_distinct(d
.getBoolean())
2205 self
.set_kind(d
.getPrefixedString())
2208 length
= d
.getVarInt32()
2209 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2211 self
.mutable_ancestor().TryMerge(tmp
)
2215 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2219 def __str__(self
, prefix
="", printElemNumber
=0):
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
)
2229 class CompiledQuery(ProtocolBuffer
.ProtocolMessage
):
2230 has_primaryscan_
= 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
)
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()
2279 if self
.index_def_
is None: self
.index_def_
= Index()
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
2300 def clear_offset(self
):
2301 if self
.has_offset_
:
2302 self
.has_offset_
= 0
2305 def has_offset(self
): return self
.has_offset_
2307 def limit(self
): return self
.limit_
2309 def set_limit(self
, x
):
2313 def clear_limit(self
):
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
2326 def clear_keys_only(self
):
2327 if self
.has_keys_only_
:
2328 self
.has_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()
2365 if self
.entityfilter_
is None: self
.entityfilter_
= CompiledQuery_EntityFilter()
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
2417 def IsInitialized(self
, debug_strs
=None):
2419 if (not self
.has_primaryscan_
):
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_
):
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
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()
2448 def ByteSizePartial(self
):
2450 if (self
.has_primaryscan_
):
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_
):
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()
2467 self
.clear_primaryscan()
2468 self
.clear_mergejoinscan()
2469 self
.clear_index_def()
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
):
2479 self
.primaryscan_
.OutputUnchecked(out
)
2481 for i
in xrange(len(self
.mergejoinscan_
)):
2483 self
.mergejoinscan_
[i
].OutputUnchecked(out
)
2485 if (self
.has_offset_
):
2487 out
.putVarInt32(self
.offset_
)
2488 if (self
.has_limit_
):
2490 out
.putVarInt32(self
.limit_
)
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_
):
2511 self
.primaryscan_
.OutputPartial(out
)
2513 for i
in xrange(len(self
.mergejoinscan_
)):
2515 self
.mergejoinscan_
[i
].OutputPartial(out
)
2517 if (self
.has_offset_
):
2519 out
.putVarInt32(self
.offset_
)
2520 if (self
.has_limit_
):
2522 out
.putVarInt32(self
.limit_
)
2523 if (self
.has_keys_only_
):
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()
2545 self
.mutable_primaryscan().TryMerge(d
)
2548 self
.add_mergejoinscan().TryMerge(d
)
2551 self
.set_offset(d
.getVarInt32())
2554 self
.set_limit(d
.getVarInt32())
2557 self
.set_keys_only(d
.getBoolean())
2560 self
.mutable_entityfilter().TryMerge(d
)
2563 length
= d
.getVarInt32()
2564 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2566 self
.mutable_index_def().TryMerge(tmp
)
2569 self
.add_property_name(d
.getPrefixedString())
2572 self
.set_distinct_infix_size(d
.getVarInt32())
2576 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2580 def __str__(self
, prefix
="", printElemNumber
=0):
2582 if self
.has_primaryscan_
:
2583 res
+=prefix
+"PrimaryScan {\n"
2584 res
+=self
.primaryscan_
.__str
__(prefix
+ " ", printElemNumber
)
2587 for e
in self
.mergejoinscan_
:
2589 if printElemNumber
: elm
="(%d)" % cnt
2590 res
+=prefix
+("MergeJoinScan%s {\n" % elm
)
2591 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
2594 if self
.has_index_def_
:
2595 res
+=prefix
+"index_def <\n"
2596 res
+=self
.index_def_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
2602 for e
in self
.property_name_
:
2604 if printElemNumber
: elm
="(%d)" % cnt
2605 res
+=prefix
+("property_name%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
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
)
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
2636 kdistinct_infix_size
= 25
2637 kEntityFilterGroup
= 13
2638 kEntityFilterdistinct
= 14
2639 kEntityFilterkind
= 17
2640 kEntityFilterancestor
= 18
2642 _TEXT
= _BuildTagLookupTable({
2647 4: "start_inclusive",
2660 19: "end_unapplied_log_timestamp_us",
2663 22: "start_postfix_value",
2664 23: "end_postfix_value",
2665 24: "property_name",
2666 25: "distinct_infix_size",
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
)
2698 _STYLE_CONTENT_TYPE
= """"""
2699 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.CompiledQuery'
2700 class CompiledCursor_PositionIndexValue(ProtocolBuffer
.ProtocolMessage
):
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
2715 def clear_property(self
):
2716 if self
.has_property_
:
2717 self
.has_property_
= 0
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
2744 def IsInitialized(self
, debug_strs
=None):
2746 if (not self
.has_value_
):
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
2755 if (self
.has_property_
): n
+= 2 + self
.lengthString(len(self
.property_
))
2756 n
+= self
.lengthString(self
.value_
.ByteSize())
2759 def ByteSizePartial(self
):
2761 if (self
.has_property_
): n
+= 2 + self
.lengthString(len(self
.property_
))
2762 if (self
.has_value_
):
2764 n
+= self
.lengthString(self
.value_
.ByteSizePartial())
2768 self
.clear_property()
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
):
2790 tt
= d
.getVarInt32()
2793 self
.set_property(d
.getPrefixedString())
2796 length
= d
.getVarInt32()
2797 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2799 self
.mutable_value().TryMerge(tmp
)
2803 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2807 def __str__(self
, prefix
="", printElemNumber
=0):
2809 if self
.has_property_
: res
+=prefix
+("property: %s\n" % self
.DebugFormatString(self
.property_
))
2811 res
+=prefix
+"value <\n"
2812 res
+=self
.value_
.__str
__(prefix
+ " ", printElemNumber
)
2816 class CompiledCursor_Position(ProtocolBuffer
.ProtocolMessage
):
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
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
)
2856 def clear_indexvalue(self
):
2857 self
.indexvalue_
= []
2859 if self
.key_
is None:
2860 self
.lazy_init_lock_
.acquire()
2862 if self
.key_
is None: self
.key_
= Reference()
2864 self
.lazy_init_lock_
.release()
2867 def mutable_key(self
): self
.has_key_
= 1; return self
.key()
2869 def clear_key(self
):
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
2911 def IsInitialized(self
, debug_strs
=None):
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
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
2927 def ByteSizePartial(self
):
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
2937 self
.clear_start_key()
2938 self
.clear_indexvalue()
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)
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)
2970 out
.putVarInt32(258)
2971 out
.putVarInt32(self
.key_
.ByteSizePartial())
2972 self
.key_
.OutputPartial(out
)
2974 def TryMerge(self
, d
):
2976 tt
= d
.getVarInt32()
2979 self
.set_start_key(d
.getPrefixedString())
2982 self
.set_start_inclusive(d
.getBoolean())
2985 self
.add_indexvalue().TryMerge(d
)
2988 length
= d
.getVarInt32()
2989 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2991 self
.mutable_key().TryMerge(tmp
)
2995 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2999 def __str__(self
, prefix
="", printElemNumber
=0):
3001 if self
.has_start_key_
: res
+=prefix
+("start_key: %s\n" % self
.DebugFormatString(self
.start_key_
))
3003 for e
in self
.indexvalue_
:
3005 if printElemNumber
: elm
="(%d)" % cnt
3006 res
+=prefix
+("IndexValue%s {\n" % elm
)
3007 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
3011 res
+=prefix
+"key <\n"
3012 res
+=self
.key_
.__str
__(prefix
+ " ", printElemNumber
)
3014 if self
.has_start_inclusive_
: res
+=prefix
+("start_inclusive: %s\n" % self
.DebugFormatBool(self
.start_inclusive_
))
3017 class CompiledCursor(ProtocolBuffer
.ProtocolMessage
):
3018 has_multiquery_index_
= 0
3019 multiquery_index_
= 0
3021 def __init__(self
, contents
=None):
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
)
3052 def clear_position(self
):
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
3069 def IsInitialized(self
, debug_strs
=None):
3071 for p
in self
.position_
:
3072 if not p
.IsInitialized(debug_strs
): initialized
=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()
3082 def ByteSizePartial(self
):
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()
3090 self
.clear_multiquery_index()
3091 self
.clear_position()
3093 def OutputUnchecked(self
, out
):
3094 if (self
.has_multiquery_index_
):
3096 out
.putVarInt32(self
.multiquery_index_
)
3097 for i
in xrange(len(self
.position_
)):
3099 self
.position_
[i
].OutputUnchecked(out
)
3102 def OutputPartial(self
, out
):
3103 if (self
.has_multiquery_index_
):
3105 out
.putVarInt32(self
.multiquery_index_
)
3106 for i
in xrange(len(self
.position_
)):
3108 self
.position_
[i
].OutputPartial(out
)
3111 def TryMerge(self
, d
):
3112 while d
.avail() > 0:
3113 tt
= d
.getVarInt32()
3115 self
.set_multiquery_index(d
.getVarInt32())
3118 self
.add_position().TryMerge(d
)
3122 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3126 def __str__(self
, prefix
="", printElemNumber
=0):
3128 if self
.has_multiquery_index_
: res
+=prefix
+("multiquery_index: %s\n" % self
.DebugFormatInt32(self
.multiquery_index_
))
3130 for e
in self
.position_
:
3132 if printElemNumber
: elm
="(%d)" % cnt
3133 res
+=prefix
+("Position%s {\n" % elm
)
3134 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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
3145 kPositionstart_key
= 27
3146 kPositionIndexValueGroup
= 29
3147 kPositionIndexValueproperty
= 30
3148 kPositionIndexValuevalue
= 31
3150 kPositionstart_inclusive
= 28
3152 _TEXT
= _BuildTagLookupTable({
3154 1: "multiquery_index",
3157 28: "start_inclusive",
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
)
3178 _STYLE_CONTENT_TYPE
= """"""
3179 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.CompiledCursor'
3180 class Cursor(ProtocolBuffer
.ProtocolMessage
):
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
3195 def clear_cursor(self
):
3196 if self
.has_cursor_
:
3197 self
.has_cursor_
= 0
3200 def has_cursor(self
): return self
.has_cursor_
3202 def app(self
): return self
.app_
3204 def set_app(self
, x
):
3208 def clear_app(self
):
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
3229 def IsInitialized(self
, debug_strs
=None):
3231 if (not self
.has_cursor_
):
3233 if debug_strs
is not None:
3234 debug_strs
.append('Required field: cursor not set.')
3239 if (self
.has_app_
): n
+= 1 + self
.lengthString(len(self
.app_
))
3242 def ByteSizePartial(self
):
3244 if (self
.has_cursor_
):
3246 if (self
.has_app_
): n
+= 1 + self
.lengthString(len(self
.app_
))
3253 def OutputUnchecked(self
, out
):
3255 out
.put64(self
.cursor_
)
3258 out
.putPrefixedString(self
.app_
)
3260 def OutputPartial(self
, out
):
3261 if (self
.has_cursor_
):
3263 out
.put64(self
.cursor_
)
3266 out
.putPrefixedString(self
.app_
)
3268 def TryMerge(self
, d
):
3269 while d
.avail() > 0:
3270 tt
= d
.getVarInt32()
3272 self
.set_cursor(d
.get64())
3275 self
.set_app(d
.getPrefixedString())
3279 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3283 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
3290 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3291 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3296 _TEXT
= _BuildTagLookupTable({
3302 _TYPES
= _BuildTagLookupTable({
3303 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3304 1: ProtocolBuffer
.Encoder
.DOUBLE
,
3305 2: ProtocolBuffer
.Encoder
.STRING
,
3306 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3310 _STYLE_CONTENT_TYPE
= """"""
3311 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.Cursor'
3312 class Error(ProtocolBuffer
.ProtocolMessage
):
3316 CONCURRENT_TRANSACTION
= 2
3320 PERMISSION_DENIED
= 6
3322 COMMITTED_BUT_STILL_APPLYING
= 8
3323 CAPABILITY_DISABLED
= 9
3324 TRY_ALTERNATE_BACKEND
= 10
3325 SAFE_TIME_TOO_OLD
= 11
3327 _ErrorCode_NAMES
= {
3329 2: "CONCURRENT_TRANSACTION",
3330 3: "INTERNAL_ERROR",
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):
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
3357 def IsInitialized(self
, debug_strs
=None):
3365 def ByteSizePartial(self
):
3372 def OutputUnchecked(self
, out
):
3375 def OutputPartial(self
, out
):
3378 def TryMerge(self
, d
):
3379 while d
.avail() > 0:
3380 tt
= d
.getVarInt32()
3383 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3387 def __str__(self
, prefix
="", printElemNumber
=0):
3392 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3393 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3396 _TEXT
= _BuildTagLookupTable({
3400 _TYPES
= _BuildTagLookupTable({
3401 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3402 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
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
3457 def IsInitialized(self
, debug_strs
=None):
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_
)
3467 def ByteSizePartial(self
):
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_
)
3474 self
.clear_requested_entity_puts()
3475 self
.clear_requested_entity_deletes()
3477 def OutputUnchecked(self
, out
):
3478 if (self
.has_requested_entity_puts_
):
3480 out
.putVarInt32(self
.requested_entity_puts_
)
3481 if (self
.has_requested_entity_deletes_
):
3483 out
.putVarInt32(self
.requested_entity_deletes_
)
3485 def OutputPartial(self
, out
):
3486 if (self
.has_requested_entity_puts_
):
3488 out
.putVarInt32(self
.requested_entity_puts_
)
3489 if (self
.has_requested_entity_deletes_
):
3491 out
.putVarInt32(self
.requested_entity_deletes_
)
3493 def TryMerge(self
, d
):
3495 tt
= d
.getVarInt32()
3498 self
.set_requested_entity_puts(d
.getVarInt32())
3501 self
.set_requested_entity_deletes(d
.getVarInt32())
3505 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3509 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
3515 class Cost(ProtocolBuffer
.ProtocolMessage
):
3516 has_index_writes_
= 0
3518 has_index_write_bytes_
= 0
3519 index_write_bytes_
= 0
3520 has_entity_writes_
= 0
3522 has_entity_write_bytes_
= 0
3523 entity_write_bytes_
= 0
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()
3591 if self
.commitcost_
is None: self
.commitcost_
= Cost_CommitCost()
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
3661 def IsInitialized(self
, debug_strs
=None):
3663 if (self
.has_commitcost_
and not self
.commitcost_
.IsInitialized(debug_strs
)): initialized
= 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_
)
3677 def ByteSizePartial(self
):
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_
)
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_
):
3700 out
.putVarInt32(self
.index_writes_
)
3701 if (self
.has_index_write_bytes_
):
3703 out
.putVarInt32(self
.index_write_bytes_
)
3704 if (self
.has_entity_writes_
):
3706 out
.putVarInt32(self
.entity_writes_
)
3707 if (self
.has_entity_write_bytes_
):
3709 out
.putVarInt32(self
.entity_write_bytes_
)
3710 if (self
.has_commitcost_
):
3712 self
.commitcost_
.OutputUnchecked(out
)
3714 if (self
.has_approximate_storage_delta_
):
3716 out
.putVarInt32(self
.approximate_storage_delta_
)
3717 if (self
.has_id_sequence_updates_
):
3719 out
.putVarInt32(self
.id_sequence_updates_
)
3721 def OutputPartial(self
, out
):
3722 if (self
.has_index_writes_
):
3724 out
.putVarInt32(self
.index_writes_
)
3725 if (self
.has_index_write_bytes_
):
3727 out
.putVarInt32(self
.index_write_bytes_
)
3728 if (self
.has_entity_writes_
):
3730 out
.putVarInt32(self
.entity_writes_
)
3731 if (self
.has_entity_write_bytes_
):
3733 out
.putVarInt32(self
.entity_write_bytes_
)
3734 if (self
.has_commitcost_
):
3736 self
.commitcost_
.OutputPartial(out
)
3738 if (self
.has_approximate_storage_delta_
):
3740 out
.putVarInt32(self
.approximate_storage_delta_
)
3741 if (self
.has_id_sequence_updates_
):
3743 out
.putVarInt32(self
.id_sequence_updates_
)
3745 def TryMerge(self
, d
):
3746 while d
.avail() > 0:
3747 tt
= d
.getVarInt32()
3749 self
.set_index_writes(d
.getVarInt32())
3752 self
.set_index_write_bytes(d
.getVarInt32())
3755 self
.set_entity_writes(d
.getVarInt32())
3758 self
.set_entity_write_bytes(d
.getVarInt32())
3761 self
.mutable_commitcost().TryMerge(d
)
3764 self
.set_approximate_storage_delta(d
.getVarInt32())
3767 self
.set_id_sequence_updates(d
.getVarInt32())
3771 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3775 def __str__(self
, prefix
="", printElemNumber
=0):
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
)
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_
))
3790 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3791 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3794 kindex_write_bytes
= 2
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({
3806 2: "index_write_bytes",
3808 4: "entity_write_bytes",
3810 6: "requested_entity_puts",
3811 7: "requested_entity_deletes",
3812 8: "approximate_storage_delta",
3813 9: "id_sequence_updates",
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
)
3831 _STYLE_CONTENT_TYPE
= """"""
3832 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.Cost'
3833 class GetRequest(ProtocolBuffer
.ProtocolMessage
):
3834 has_transaction_
= 0
3836 has_failover_ms_
= 0
3840 has_allow_deferred_
= 0
3843 def __init__(self
, contents
=None):
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_
3854 def mutable_key(self
, i
):
3862 def clear_key(self
):
3864 def transaction(self
):
3865 if self
.transaction_
is None:
3866 self
.lazy_init_lock_
.acquire()
3868 if self
.transaction_
is None: self
.transaction_
= Transaction()
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
3902 def clear_strong(self
):
3903 if self
.has_strong_
:
3904 self
.has_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
3946 def IsInitialized(self
, debug_strs
=None):
3949 if not p
.IsInitialized(debug_strs
): initialized
=0
3950 if (self
.has_transaction_
and not self
.transaction_
.IsInitialized(debug_strs
)): initialized
= 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
3963 def ByteSizePartial(self
):
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
3975 self
.clear_transaction()
3976 self
.clear_failover_ms()
3978 self
.clear_allow_deferred()
3980 def OutputUnchecked(self
, out
):
3981 for i
in xrange(len(self
.key_
)):
3983 out
.putVarInt32(self
.key_
[i
].ByteSize())
3984 self
.key_
[i
].OutputUnchecked(out
)
3985 if (self
.has_transaction_
):
3987 out
.putVarInt32(self
.transaction_
.ByteSize())
3988 self
.transaction_
.OutputUnchecked(out
)
3989 if (self
.has_failover_ms_
):
3991 out
.putVarInt64(self
.failover_ms_
)
3992 if (self
.has_strong_
):
3994 out
.putBoolean(self
.strong_
)
3995 if (self
.has_allow_deferred_
):
3997 out
.putBoolean(self
.allow_deferred_
)
3999 def OutputPartial(self
, out
):
4000 for i
in xrange(len(self
.key_
)):
4002 out
.putVarInt32(self
.key_
[i
].ByteSizePartial())
4003 self
.key_
[i
].OutputPartial(out
)
4004 if (self
.has_transaction_
):
4006 out
.putVarInt32(self
.transaction_
.ByteSizePartial())
4007 self
.transaction_
.OutputPartial(out
)
4008 if (self
.has_failover_ms_
):
4010 out
.putVarInt64(self
.failover_ms_
)
4011 if (self
.has_strong_
):
4013 out
.putBoolean(self
.strong_
)
4014 if (self
.has_allow_deferred_
):
4016 out
.putBoolean(self
.allow_deferred_
)
4018 def TryMerge(self
, d
):
4019 while d
.avail() > 0:
4020 tt
= d
.getVarInt32()
4022 length
= d
.getVarInt32()
4023 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4025 self
.add_key().TryMerge(tmp
)
4028 length
= d
.getVarInt32()
4029 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4031 self
.mutable_transaction().TryMerge(tmp
)
4034 self
.set_failover_ms(d
.getVarInt64())
4037 self
.set_strong(d
.getBoolean())
4040 self
.set_allow_deferred(d
.getBoolean())
4044 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4048 def __str__(self
, prefix
="", printElemNumber
=0):
4053 if printElemNumber
: elm
="(%d)" % cnt
4054 res
+=prefix
+("key%s <\n" % elm
)
4055 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4058 if self
.has_transaction_
:
4059 res
+=prefix
+"transaction <\n"
4060 res
+=self
.transaction_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
4068 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4069 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4077 _TEXT
= _BuildTagLookupTable({
4083 5: "allow_deferred",
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
)
4097 _STYLE_CONTENT_TYPE
= """"""
4098 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.GetRequest'
4099 class GetResponse_Entity(ProtocolBuffer
.ProtocolMessage
):
4107 def __init__(self
, contents
=None):
4108 self
.lazy_init_lock_
= thread
.allocate_lock()
4109 if contents
is not None: self
.MergeFromString(contents
)
4112 if self
.entity_
is None:
4113 self
.lazy_init_lock_
.acquire()
4115 if self
.entity_
is None: self
.entity_
= EntityProto()
4117 self
.lazy_init_lock_
.release()
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_
4131 if self
.key_
is None:
4132 self
.lazy_init_lock_
.acquire()
4134 if self
.key_
is None: self
.key_
= Reference()
4136 self
.lazy_init_lock_
.release()
4139 def mutable_key(self
): self
.has_key_
= 1; return self
.key()
4141 def clear_key(self
):
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
4155 def clear_version(self
):
4156 if self
.has_version_
:
4157 self
.has_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
4179 def IsInitialized(self
, debug_strs
=None):
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
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_
)
4192 def ByteSizePartial(self
):
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_
)
4202 self
.clear_version()
4204 def OutputUnchecked(self
, out
):
4205 if (self
.has_entity_
):
4207 out
.putVarInt32(self
.entity_
.ByteSize())
4208 self
.entity_
.OutputUnchecked(out
)
4209 if (self
.has_version_
):
4211 out
.putVarInt64(self
.version_
)
4214 out
.putVarInt32(self
.key_
.ByteSize())
4215 self
.key_
.OutputUnchecked(out
)
4217 def OutputPartial(self
, out
):
4218 if (self
.has_entity_
):
4220 out
.putVarInt32(self
.entity_
.ByteSizePartial())
4221 self
.entity_
.OutputPartial(out
)
4222 if (self
.has_version_
):
4224 out
.putVarInt64(self
.version_
)
4227 out
.putVarInt32(self
.key_
.ByteSizePartial())
4228 self
.key_
.OutputPartial(out
)
4230 def TryMerge(self
, d
):
4232 tt
= d
.getVarInt32()
4235 length
= d
.getVarInt32()
4236 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4238 self
.mutable_entity().TryMerge(tmp
)
4241 self
.set_version(d
.getVarInt64())
4244 length
= d
.getVarInt32()
4245 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4247 self
.mutable_key().TryMerge(tmp
)
4251 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4255 def __str__(self
, prefix
="", printElemNumber
=0):
4257 if self
.has_entity_
:
4258 res
+=prefix
+"entity <\n"
4259 res
+=self
.entity_
.__str
__(prefix
+ " ", printElemNumber
)
4262 res
+=prefix
+"key <\n"
4263 res
+=self
.key_
.__str
__(prefix
+ " ", printElemNumber
)
4265 if self
.has_version_
: res
+=prefix
+("version: %s\n" % self
.DebugFormatInt64(self
.version_
))
4268 class GetResponse(ProtocolBuffer
.ProtocolMessage
):
4272 def __init__(self
, contents
=None):
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
)
4291 def clear_entity(self
):
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
):
4304 self
.deferred_
.append(x
)
4307 def clear_deferred(self
):
4309 def in_order(self
): return self
.in_order_
4311 def set_in_order(self
, x
):
4312 self
.has_in_order_
= 1
4315 def clear_in_order(self
):
4316 if self
.has_in_order_
:
4317 self
.has_in_order_
= 0
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
4341 def IsInitialized(self
, debug_strs
=None):
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
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
4358 def ByteSizePartial(self
):
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
4369 self
.clear_deferred()
4370 self
.clear_in_order()
4372 def OutputUnchecked(self
, out
):
4373 for i
in xrange(len(self
.entity_
)):
4375 self
.entity_
[i
].OutputUnchecked(out
)
4377 for i
in xrange(len(self
.deferred_
)):
4379 out
.putVarInt32(self
.deferred_
[i
].ByteSize())
4380 self
.deferred_
[i
].OutputUnchecked(out
)
4381 if (self
.has_in_order_
):
4383 out
.putBoolean(self
.in_order_
)
4385 def OutputPartial(self
, out
):
4386 for i
in xrange(len(self
.entity_
)):
4388 self
.entity_
[i
].OutputPartial(out
)
4390 for i
in xrange(len(self
.deferred_
)):
4392 out
.putVarInt32(self
.deferred_
[i
].ByteSizePartial())
4393 self
.deferred_
[i
].OutputPartial(out
)
4394 if (self
.has_in_order_
):
4396 out
.putBoolean(self
.in_order_
)
4398 def TryMerge(self
, d
):
4399 while d
.avail() > 0:
4400 tt
= d
.getVarInt32()
4402 self
.add_entity().TryMerge(d
)
4405 length
= d
.getVarInt32()
4406 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4408 self
.add_deferred().TryMerge(tmp
)
4411 self
.set_in_order(d
.getBoolean())
4415 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4419 def __str__(self
, prefix
="", printElemNumber
=0):
4422 for e
in self
.entity_
:
4424 if printElemNumber
: elm
="(%d)" % cnt
4425 res
+=prefix
+("Entity%s {\n" % elm
)
4426 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4430 for e
in self
.deferred_
:
4432 if printElemNumber
: elm
="(%d)" % cnt
4433 res
+=prefix
+("deferred%s <\n" % elm
)
4434 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4437 if self
.has_in_order_
: res
+=prefix
+("in_order: %s\n" % self
.DebugFormatBool(self
.in_order_
))
4441 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4442 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4451 _TEXT
= _BuildTagLookupTable({
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
)
4473 _STYLE_CONTENT_TYPE
= """"""
4474 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.GetResponse'
4475 class PutRequest(ProtocolBuffer
.ProtocolMessage
):
4481 _AutoIdPolicy_NAMES
= {
4486 def AutoIdPolicy_Name(cls
, x
): return cls
._AutoIdPolicy
_NAMES
.get(x
, "")
4487 AutoIdPolicy_Name
= classmethod(AutoIdPolicy_Name
)
4489 has_transaction_
= 0
4495 has_mark_changes_
= 0
4497 has_auto_id_policy_
= 0
4500 def __init__(self
, contents
=None):
4502 self
.composite_index_
= []
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
):
4518 self
.entity_
.append(x
)
4521 def clear_entity(self
):
4523 def transaction(self
):
4524 if self
.transaction_
is None:
4525 self
.lazy_init_lock_
.acquire()
4527 if self
.transaction_
is None: self
.transaction_
= Transaction()
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
)
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
4564 def clear_trusted(self
):
4565 if self
.has_trusted_
:
4566 self
.has_trusted_
= 0
4569 def has_trusted(self
): return self
.has_trusted_
4571 def force(self
): return self
.force_
4573 def set_force(self
, x
):
4577 def clear_force(self
):
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
):
4608 self
.snapshot_
.append(x
)
4611 def clear_snapshot(self
):
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
4661 def IsInitialized(self
, debug_strs
=None):
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
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_
)
4687 def ByteSizePartial(self
):
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_
)
4704 self
.clear_transaction()
4705 self
.clear_composite_index()
4706 self
.clear_trusted()
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_
)):
4715 out
.putVarInt32(self
.entity_
[i
].ByteSize())
4716 self
.entity_
[i
].OutputUnchecked(out
)
4717 if (self
.has_transaction_
):
4719 out
.putVarInt32(self
.transaction_
.ByteSize())
4720 self
.transaction_
.OutputUnchecked(out
)
4721 for i
in xrange(len(self
.composite_index_
)):
4723 out
.putVarInt32(self
.composite_index_
[i
].ByteSize())
4724 self
.composite_index_
[i
].OutputUnchecked(out
)
4725 if (self
.has_trusted_
):
4727 out
.putBoolean(self
.trusted_
)
4728 if (self
.has_force_
):
4730 out
.putBoolean(self
.force_
)
4731 if (self
.has_mark_changes_
):
4733 out
.putBoolean(self
.mark_changes_
)
4734 for i
in xrange(len(self
.snapshot_
)):
4736 out
.putVarInt32(self
.snapshot_
[i
].ByteSize())
4737 self
.snapshot_
[i
].OutputUnchecked(out
)
4738 if (self
.has_auto_id_policy_
):
4740 out
.putVarInt32(self
.auto_id_policy_
)
4742 def OutputPartial(self
, out
):
4743 for i
in xrange(len(self
.entity_
)):
4745 out
.putVarInt32(self
.entity_
[i
].ByteSizePartial())
4746 self
.entity_
[i
].OutputPartial(out
)
4747 if (self
.has_transaction_
):
4749 out
.putVarInt32(self
.transaction_
.ByteSizePartial())
4750 self
.transaction_
.OutputPartial(out
)
4751 for i
in xrange(len(self
.composite_index_
)):
4753 out
.putVarInt32(self
.composite_index_
[i
].ByteSizePartial())
4754 self
.composite_index_
[i
].OutputPartial(out
)
4755 if (self
.has_trusted_
):
4757 out
.putBoolean(self
.trusted_
)
4758 if (self
.has_force_
):
4760 out
.putBoolean(self
.force_
)
4761 if (self
.has_mark_changes_
):
4763 out
.putBoolean(self
.mark_changes_
)
4764 for i
in xrange(len(self
.snapshot_
)):
4766 out
.putVarInt32(self
.snapshot_
[i
].ByteSizePartial())
4767 self
.snapshot_
[i
].OutputPartial(out
)
4768 if (self
.has_auto_id_policy_
):
4770 out
.putVarInt32(self
.auto_id_policy_
)
4772 def TryMerge(self
, d
):
4773 while d
.avail() > 0:
4774 tt
= d
.getVarInt32()
4776 length
= d
.getVarInt32()
4777 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4779 self
.add_entity().TryMerge(tmp
)
4782 length
= d
.getVarInt32()
4783 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4785 self
.mutable_transaction().TryMerge(tmp
)
4788 length
= d
.getVarInt32()
4789 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4791 self
.add_composite_index().TryMerge(tmp
)
4794 self
.set_trusted(d
.getBoolean())
4797 self
.set_force(d
.getBoolean())
4800 self
.set_mark_changes(d
.getBoolean())
4803 length
= d
.getVarInt32()
4804 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4806 self
.add_snapshot().TryMerge(tmp
)
4809 self
.set_auto_id_policy(d
.getVarInt32())
4813 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4817 def __str__(self
, prefix
="", printElemNumber
=0):
4820 for e
in self
.entity_
:
4822 if printElemNumber
: elm
="(%d)" % cnt
4823 res
+=prefix
+("entity%s <\n" % elm
)
4824 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4827 if self
.has_transaction_
:
4828 res
+=prefix
+"transaction <\n"
4829 res
+=self
.transaction_
.__str
__(prefix
+ " ", printElemNumber
)
4832 for e
in self
.composite_index_
:
4834 if printElemNumber
: elm
="(%d)" % cnt
4835 res
+=prefix
+("composite_index%s <\n" % elm
)
4836 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
4843 for e
in self
.snapshot_
:
4845 if printElemNumber
: elm
="(%d)" % cnt
4846 res
+=prefix
+("snapshot%s <\n" % elm
)
4847 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4850 if self
.has_auto_id_policy_
: res
+=prefix
+("auto_id_policy: %s\n" % self
.DebugFormatInt32(self
.auto_id_policy_
))
4854 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4855 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4859 kcomposite_index
= 3
4864 kauto_id_policy
= 10
4866 _TEXT
= _BuildTagLookupTable({
4870 3: "composite_index",
4875 10: "auto_id_policy",
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
)
4892 _STYLE_CONTENT_TYPE
= """"""
4893 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.PutRequest'
4894 class PutResponse(ProtocolBuffer
.ProtocolMessage
):
4898 def __init__(self
, contents
=None):
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_
4910 def mutable_key(self
, i
):
4918 def clear_key(self
):
4921 if self
.cost_
is None:
4922 self
.lazy_init_lock_
.acquire()
4924 if self
.cost_
is None: self
.cost_
= Cost()
4926 self
.lazy_init_lock_
.release()
4929 def mutable_cost(self
): self
.has_cost_
= 1; return self
.cost()
4931 def clear_cost(self
):
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
):
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
4973 def IsInitialized(self
, debug_strs
=None):
4976 if not p
.IsInitialized(debug_strs
): initialized
=0
4977 if (self
.has_cost_
and not self
.cost_
.IsInitialized(debug_strs
)): initialized
= 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
])
4989 def ByteSizePartial(self
):
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
])
5001 self
.clear_version()
5003 def OutputUnchecked(self
, out
):
5004 for i
in xrange(len(self
.key_
)):
5006 out
.putVarInt32(self
.key_
[i
].ByteSize())
5007 self
.key_
[i
].OutputUnchecked(out
)
5008 if (self
.has_cost_
):
5010 out
.putVarInt32(self
.cost_
.ByteSize())
5011 self
.cost_
.OutputUnchecked(out
)
5012 for i
in xrange(len(self
.version_
)):
5014 out
.putVarInt64(self
.version_
[i
])
5016 def OutputPartial(self
, out
):
5017 for i
in xrange(len(self
.key_
)):
5019 out
.putVarInt32(self
.key_
[i
].ByteSizePartial())
5020 self
.key_
[i
].OutputPartial(out
)
5021 if (self
.has_cost_
):
5023 out
.putVarInt32(self
.cost_
.ByteSizePartial())
5024 self
.cost_
.OutputPartial(out
)
5025 for i
in xrange(len(self
.version_
)):
5027 out
.putVarInt64(self
.version_
[i
])
5029 def TryMerge(self
, d
):
5030 while d
.avail() > 0:
5031 tt
= d
.getVarInt32()
5033 length
= d
.getVarInt32()
5034 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5036 self
.add_key().TryMerge(tmp
)
5039 length
= d
.getVarInt32()
5040 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5042 self
.mutable_cost().TryMerge(tmp
)
5045 self
.add_version(d
.getVarInt64())
5049 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
5053 def __str__(self
, prefix
="", printElemNumber
=0):
5058 if printElemNumber
: elm
="(%d)" % cnt
5059 res
+=prefix
+("key%s <\n" % elm
)
5060 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
5064 res
+=prefix
+"cost <\n"
5065 res
+=self
.cost_
.__str
__(prefix
+ " ", printElemNumber
)
5068 for e
in self
.version_
:
5070 if printElemNumber
: elm
="(%d)" % cnt
5071 res
+=prefix
+("version%s: %s\n" % (elm
, self
.DebugFormatInt64(e
)))
5076 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
5077 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
5083 _TEXT
= _BuildTagLookupTable({
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
)
5099 _STYLE_CONTENT_TYPE
= """"""
5100 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.PutResponse'
5101 class TouchRequest(ProtocolBuffer
.ProtocolMessage
):
5105 def __init__(self
, contents
=None):
5107 self
.composite_index_
= []
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_
5117 def mutable_key(self
, i
):
5125 def clear_key(self
):
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
)
5141 def clear_composite_index(self
):
5142 self
.composite_index_
= []
5143 def force(self
): return self
.force_
5145 def set_force(self
, x
):
5149 def clear_force(self
):
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
):
5167 self
.snapshot_
.append(x
)
5170 def clear_snapshot(self
):
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
5195 def IsInitialized(self
, debug_strs
=None):
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
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())
5216 def ByteSizePartial(self
):
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())
5229 self
.clear_composite_index()
5231 self
.clear_snapshot()
5233 def OutputUnchecked(self
, out
):
5234 for i
in xrange(len(self
.key_
)):
5236 out
.putVarInt32(self
.key_
[i
].ByteSize())
5237 self
.key_
[i
].OutputUnchecked(out
)
5238 for i
in xrange(len(self
.composite_index_
)):
5240 out
.putVarInt32(self
.composite_index_
[i
].ByteSize())
5241 self
.composite_index_
[i
].OutputUnchecked(out
)
5242 if (self
.has_force_
):
5244 out
.putBoolean(self
.force_
)
5245 for i
in xrange(len(self
.snapshot_
)):
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_
)):
5253 out
.putVarInt32(self
.key_
[i
].ByteSizePartial())
5254 self
.key_
[i
].OutputPartial(out
)
5255 for i
in xrange(len(self
.composite_index_
)):
5257 out
.putVarInt32(self
.composite_index_
[i
].ByteSizePartial())
5258 self
.composite_index_
[i
].OutputPartial(out
)
5259 if (self
.has_force_
):
5261 out
.putBoolean(self
.force_
)
5262 for i
in xrange(len(self
.snapshot_
)):
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()
5271 length
= d
.getVarInt32()
5272 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5274 self
.add_key().TryMerge(tmp
)
5277 length
= d
.getVarInt32()
5278 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5280 self
.add_composite_index().TryMerge(tmp
)
5283 self
.set_force(d
.getBoolean())
5286 length
= d
.getVarInt32()
5287 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5289 self
.add_snapshot().TryMerge(tmp
)
5293 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
5297 def __str__(self
, prefix
="", printElemNumber
=0):
5302 if printElemNumber
: elm
="(%d)" % cnt
5303 res
+=prefix
+("key%s <\n" % elm
)
5304 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
5308 for e
in self
.composite_index_
:
5310 if printElemNumber
: elm
="(%d)" % cnt
5311 res
+=prefix
+("composite_index%s <\n" % elm
)
5312 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
5315 if self
.has_force_
: res
+=prefix
+("force: %s\n" % self
.DebugFormatBool(self
.force_
))
5317 for e
in self
.snapshot_
:
5319 if printElemNumber
: elm
="(%d)" % cnt
5320 res
+=prefix
+("snapshot%s <\n" % elm
)
5321 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
5327 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
5328 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
5331 kcomposite_index
= 2
5335 _TEXT
= _BuildTagLookupTable({
5338 2: "composite_index",
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
)
5353 _STYLE_CONTENT_TYPE
= """"""
5354 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.TouchRequest'
5355 class TouchResponse(ProtocolBuffer
.ProtocolMessage
):
5359 def __init__(self
, contents
=None):
5360 self
.lazy_init_lock_
= thread
.allocate_lock()
5361 if contents
is not None: self
.MergeFromString(contents
)
5364 if self
.cost_
is None:
5365 self
.lazy_init_lock_
.acquire()
5367 if self
.cost_
is None: self
.cost_
= Cost()
5369 self
.lazy_init_lock_
.release()
5372 def mutable_cost(self
): self
.has_cost_
= 1; return self
.cost()
5374 def clear_cost(self
):
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
5393 def IsInitialized(self
, debug_strs
=None):
5395 if (self
.has_cost_
and not self
.cost_
.IsInitialized(debug_strs
)): initialized
= 0
5400 if (self
.has_cost_
): n
+= 1 + self
.lengthString(self
.cost_
.ByteSize())
5403 def ByteSizePartial(self
):
5405 if (self
.has_cost_
): n
+= 1 + self
.lengthString(self
.cost_
.ByteSizePartial())
5411 def OutputUnchecked(self
, out
):
5412 if (self
.has_cost_
):
5414 out
.putVarInt32(self
.cost_
.ByteSize())
5415 self
.cost_
.OutputUnchecked(out
)
5417 def OutputPartial(self
, out
):
5418 if (self
.has_cost_
):
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()
5427 length
= d
.getVarInt32()
5428 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5430 self
.mutable_cost().TryMerge(tmp
)
5434 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
5438 def __str__(self
, prefix
="", printElemNumber
=0):
5441 res
+=prefix
+"cost <\n"
5442 res
+=self
.cost_
.__str
__(prefix
+ " ", printElemNumber
)
5447 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
5448 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
5452 _TEXT
= _BuildTagLookupTable({
5457 _TYPES
= _BuildTagLookupTable({
5458 0: ProtocolBuffer
.Encoder
.NUMERIC
,
5459 1: ProtocolBuffer
.Encoder
.STRING
,
5460 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
5464 _STYLE_CONTENT_TYPE
= """"""
5465 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.TouchResponse'
5466 class DeleteRequest(ProtocolBuffer
.ProtocolMessage
):
5467 has_transaction_
= 0
5473 has_mark_changes_
= 0
5476 def __init__(self
, contents
=None):
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_
5488 def mutable_key(self
, i
):
5496 def clear_key(self
):
5498 def transaction(self
):
5499 if self
.transaction_
is None:
5500 self
.lazy_init_lock_
.acquire()
5502 if self
.transaction_
is None: self
.transaction_
= Transaction()
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
5523 def clear_trusted(self
):
5524 if self
.has_trusted_
:
5525 self
.has_trusted_
= 0
5528 def has_trusted(self
): return self
.has_trusted_
5530 def force(self
): return self
.force_
5532 def set_force(self
, x
):
5536 def clear_force(self
):
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
):
5567 self
.snapshot_
.append(x
)
5570 def clear_snapshot(self
):
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
5600 def IsInitialized(self
, debug_strs
=None):
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
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())
5621 def ByteSizePartial(self
):
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())
5635 self
.clear_transaction()
5636 self
.clear_trusted()
5638 self
.clear_mark_changes()
5639 self
.clear_snapshot()
5641 def OutputUnchecked(self
, out
):
5642 if (self
.has_trusted_
):
5644 out
.putBoolean(self
.trusted_
)
5645 if (self
.has_transaction_
):
5647 out
.putVarInt32(self
.transaction_
.ByteSize())
5648 self
.transaction_
.OutputUnchecked(out
)
5649 for i
in xrange(len(self
.key_
)):
5651 out
.putVarInt32(self
.key_
[i
].ByteSize())
5652 self
.key_
[i
].OutputUnchecked(out
)
5653 if (self
.has_force_
):
5655 out
.putBoolean(self
.force_
)
5656 if (self
.has_mark_changes_
):
5658 out
.putBoolean(self
.mark_changes_
)
5659 for i
in xrange(len(self
.snapshot_
)):
5661 out
.putVarInt32(self
.snapshot_
[i
].ByteSize())
5662 self
.snapshot_
[i
].OutputUnchecked(out
)
5664 def OutputPartial(self
, out
):
5665 if (self
.has_trusted_
):
5667 out
.putBoolean(self
.trusted_
)
5668 if (self
.has_transaction_
):
5670 out
.putVarInt32(self
.transaction_
.ByteSizePartial())
5671 self
.transaction_
.OutputPartial(out
)
5672 for i
in xrange(len(self
.key_
)):
5674 out
.putVarInt32(self
.key_
[i
].ByteSizePartial())
5675 self
.key_
[i
].OutputPartial(out
)
5676 if (self
.has_force_
):
5678 out
.putBoolean(self
.force_
)
5679 if (self
.has_mark_changes_
):
5681 out
.putBoolean(self
.mark_changes_
)
5682 for i
in xrange(len(self
.snapshot_
)):
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()
5691 self
.set_trusted(d
.getBoolean())
5694 length
= d
.getVarInt32()
5695 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5697 self
.mutable_transaction().TryMerge(tmp
)
5700 length
= d
.getVarInt32()
5701 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5703 self
.add_key().TryMerge(tmp
)
5706 self
.set_force(d
.getBoolean())
5709 self
.set_mark_changes(d
.getBoolean())
5712 length
= d
.getVarInt32()
5713 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5715 self
.add_snapshot().TryMerge(tmp
)
5719 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
5723 def __str__(self
, prefix
="", printElemNumber
=0):
5728 if printElemNumber
: elm
="(%d)" % cnt
5729 res
+=prefix
+("key%s <\n" % elm
)
5730 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
5733 if self
.has_transaction_
:
5734 res
+=prefix
+"transaction <\n"
5735 res
+=self
.transaction_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
5741 for e
in self
.snapshot_
:
5743 if printElemNumber
: elm
="(%d)" % cnt
5744 res
+=prefix
+("snapshot%s <\n" % elm
)
5745 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
5751 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
5752 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
5761 _TEXT
= _BuildTagLookupTable({
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
)
5783 _STYLE_CONTENT_TYPE
= """"""
5784 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.DeleteRequest'
5785 class DeleteResponse(ProtocolBuffer
.ProtocolMessage
):
5789 def __init__(self
, contents
=None):
5791 self
.lazy_init_lock_
= thread
.allocate_lock()
5792 if contents
is not None: self
.MergeFromString(contents
)
5795 if self
.cost_
is None:
5796 self
.lazy_init_lock_
.acquire()
5798 if self
.cost_
is None: self
.cost_
= Cost()
5800 self
.lazy_init_lock_
.release()
5803 def mutable_cost(self
): self
.has_cost_
= 1; return self
.cost()
5805 def clear_cost(self
):
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
):
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
5843 def IsInitialized(self
, debug_strs
=None):
5845 if (self
.has_cost_
and not self
.cost_
.IsInitialized(debug_strs
)): initialized
= 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
])
5855 def ByteSizePartial(self
):
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
])
5864 self
.clear_version()
5866 def OutputUnchecked(self
, out
):
5867 if (self
.has_cost_
):
5869 out
.putVarInt32(self
.cost_
.ByteSize())
5870 self
.cost_
.OutputUnchecked(out
)
5871 for i
in xrange(len(self
.version_
)):
5873 out
.putVarInt64(self
.version_
[i
])
5875 def OutputPartial(self
, out
):
5876 if (self
.has_cost_
):
5878 out
.putVarInt32(self
.cost_
.ByteSizePartial())
5879 self
.cost_
.OutputPartial(out
)
5880 for i
in xrange(len(self
.version_
)):
5882 out
.putVarInt64(self
.version_
[i
])
5884 def TryMerge(self
, d
):
5885 while d
.avail() > 0:
5886 tt
= d
.getVarInt32()
5888 length
= d
.getVarInt32()
5889 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
5891 self
.mutable_cost().TryMerge(tmp
)
5894 self
.add_version(d
.getVarInt64())
5898 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
5902 def __str__(self
, prefix
="", printElemNumber
=0):
5905 res
+=prefix
+"cost <\n"
5906 res
+=self
.cost_
.__str
__(prefix
+ " ", printElemNumber
)
5909 for e
in self
.version_
:
5911 if printElemNumber
: elm
="(%d)" % cnt
5912 res
+=prefix
+("version%s: %s\n" % (elm
, self
.DebugFormatInt64(e
)))
5917 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
5918 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
5923 _TEXT
= _BuildTagLookupTable({
5929 _TYPES
= _BuildTagLookupTable({
5930 0: ProtocolBuffer
.Encoder
.NUMERIC
,
5931 1: ProtocolBuffer
.Encoder
.STRING
,
5932 3: ProtocolBuffer
.Encoder
.NUMERIC
,
5933 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
5937 _STYLE_CONTENT_TYPE
= """"""
5938 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.DeleteResponse'
5939 class NextRequest(ProtocolBuffer
.ProtocolMessage
):
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
):
5966 def clear_count(self
):
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
5979 def clear_offset(self
):
5980 if self
.has_offset_
:
5981 self
.has_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
5992 def clear_compile(self
):
5993 if self
.has_compile_
:
5994 self
.has_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
6019 def IsInitialized(self
, debug_strs
=None):
6021 if (not self
.has_cursor_
):
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
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
6036 def ByteSizePartial(self
):
6038 if (self
.has_cursor_
):
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
6050 self
.clear_compile()
6052 def OutputUnchecked(self
, out
):
6054 out
.putVarInt32(self
.cursor_
.ByteSize())
6055 self
.cursor_
.OutputUnchecked(out
)
6056 if (self
.has_count_
):
6058 out
.putVarInt32(self
.count_
)
6059 if (self
.has_compile_
):
6061 out
.putBoolean(self
.compile_
)
6062 if (self
.has_offset_
):
6064 out
.putVarInt32(self
.offset_
)
6066 def OutputPartial(self
, out
):
6067 if (self
.has_cursor_
):
6069 out
.putVarInt32(self
.cursor_
.ByteSizePartial())
6070 self
.cursor_
.OutputPartial(out
)
6071 if (self
.has_count_
):
6073 out
.putVarInt32(self
.count_
)
6074 if (self
.has_compile_
):
6076 out
.putBoolean(self
.compile_
)
6077 if (self
.has_offset_
):
6079 out
.putVarInt32(self
.offset_
)
6081 def TryMerge(self
, d
):
6082 while d
.avail() > 0:
6083 tt
= d
.getVarInt32()
6085 length
= d
.getVarInt32()
6086 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6088 self
.mutable_cursor().TryMerge(tmp
)
6091 self
.set_count(d
.getVarInt32())
6094 self
.set_compile(d
.getBoolean())
6097 self
.set_offset(d
.getVarInt32())
6101 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
6105 def __str__(self
, prefix
="", printElemNumber
=0):
6107 if self
.has_cursor_
:
6108 res
+=prefix
+"cursor <\n"
6109 res
+=self
.cursor_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
6117 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
6118 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
6125 _TEXT
= _BuildTagLookupTable({
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
)
6143 _STYLE_CONTENT_TYPE
= """"""
6144 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.NextRequest'
6145 class QueryResult(ProtocolBuffer
.ProtocolMessage
):
6148 has_skipped_results_
= 0
6149 skipped_results_
= 0
6150 has_more_results_
= 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):
6167 self
.lazy_init_lock_
= thread
.allocate_lock()
6168 if contents
is not None: self
.MergeFromString(contents
)
6171 if self
.cursor_
is None:
6172 self
.lazy_init_lock_
.acquire()
6174 if self
.cursor_
is None: self
.cursor_
= Cursor()
6176 self
.lazy_init_lock_
.release()
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
):
6200 self
.result_
.append(x
)
6203 def clear_result(self
):
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
6237 def clear_keys_only(self
):
6238 if self
.has_keys_only_
:
6239 self
.has_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
6263 def clear_small_ops(self
):
6264 if self
.has_small_ops_
:
6265 self
.has_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()
6274 if self
.compiled_query_
is None: self
.compiled_query_
= CompiledQuery()
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()
6293 if self
.compiled_cursor_
is None: self
.compiled_cursor_
= CompiledCursor()
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_
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
)
6322 def clear_index(self
):
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
):
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
6383 def IsInitialized(self
, debug_strs
=None):
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_
):
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
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
])
6415 def ByteSizePartial(self
):
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_
):
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
])
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()
6445 self
.clear_version()
6447 def OutputUnchecked(self
, out
):
6448 if (self
.has_cursor_
):
6450 out
.putVarInt32(self
.cursor_
.ByteSize())
6451 self
.cursor_
.OutputUnchecked(out
)
6452 for i
in xrange(len(self
.result_
)):
6454 out
.putVarInt32(self
.result_
[i
].ByteSize())
6455 self
.result_
[i
].OutputUnchecked(out
)
6457 out
.putBoolean(self
.more_results_
)
6458 if (self
.has_keys_only_
):
6460 out
.putBoolean(self
.keys_only_
)
6461 if (self
.has_compiled_query_
):
6463 out
.putVarInt32(self
.compiled_query_
.ByteSize())
6464 self
.compiled_query_
.OutputUnchecked(out
)
6465 if (self
.has_compiled_cursor_
):
6467 out
.putVarInt32(self
.compiled_cursor_
.ByteSize())
6468 self
.compiled_cursor_
.OutputUnchecked(out
)
6469 if (self
.has_skipped_results_
):
6471 out
.putVarInt32(self
.skipped_results_
)
6472 for i
in xrange(len(self
.index_
)):
6474 out
.putVarInt32(self
.index_
[i
].ByteSize())
6475 self
.index_
[i
].OutputUnchecked(out
)
6476 if (self
.has_index_only_
):
6478 out
.putBoolean(self
.index_only_
)
6479 if (self
.has_small_ops_
):
6481 out
.putBoolean(self
.small_ops_
)
6482 for i
in xrange(len(self
.version_
)):
6484 out
.putVarInt64(self
.version_
[i
])
6486 def OutputPartial(self
, out
):
6487 if (self
.has_cursor_
):
6489 out
.putVarInt32(self
.cursor_
.ByteSizePartial())
6490 self
.cursor_
.OutputPartial(out
)
6491 for i
in xrange(len(self
.result_
)):
6493 out
.putVarInt32(self
.result_
[i
].ByteSizePartial())
6494 self
.result_
[i
].OutputPartial(out
)
6495 if (self
.has_more_results_
):
6497 out
.putBoolean(self
.more_results_
)
6498 if (self
.has_keys_only_
):
6500 out
.putBoolean(self
.keys_only_
)
6501 if (self
.has_compiled_query_
):
6503 out
.putVarInt32(self
.compiled_query_
.ByteSizePartial())
6504 self
.compiled_query_
.OutputPartial(out
)
6505 if (self
.has_compiled_cursor_
):
6507 out
.putVarInt32(self
.compiled_cursor_
.ByteSizePartial())
6508 self
.compiled_cursor_
.OutputPartial(out
)
6509 if (self
.has_skipped_results_
):
6511 out
.putVarInt32(self
.skipped_results_
)
6512 for i
in xrange(len(self
.index_
)):
6514 out
.putVarInt32(self
.index_
[i
].ByteSizePartial())
6515 self
.index_
[i
].OutputPartial(out
)
6516 if (self
.has_index_only_
):
6518 out
.putBoolean(self
.index_only_
)
6519 if (self
.has_small_ops_
):
6521 out
.putBoolean(self
.small_ops_
)
6522 for i
in xrange(len(self
.version_
)):
6524 out
.putVarInt64(self
.version_
[i
])
6526 def TryMerge(self
, d
):
6527 while d
.avail() > 0:
6528 tt
= d
.getVarInt32()
6530 length
= d
.getVarInt32()
6531 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6533 self
.mutable_cursor().TryMerge(tmp
)
6536 length
= d
.getVarInt32()
6537 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6539 self
.add_result().TryMerge(tmp
)
6542 self
.set_more_results(d
.getBoolean())
6545 self
.set_keys_only(d
.getBoolean())
6548 length
= d
.getVarInt32()
6549 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6551 self
.mutable_compiled_query().TryMerge(tmp
)
6554 length
= d
.getVarInt32()
6555 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6557 self
.mutable_compiled_cursor().TryMerge(tmp
)
6560 self
.set_skipped_results(d
.getVarInt32())
6563 length
= d
.getVarInt32()
6564 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6566 self
.add_index().TryMerge(tmp
)
6569 self
.set_index_only(d
.getBoolean())
6572 self
.set_small_ops(d
.getBoolean())
6575 self
.add_version(d
.getVarInt64())
6579 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
6583 def __str__(self
, prefix
="", printElemNumber
=0):
6585 if self
.has_cursor_
:
6586 res
+=prefix
+"cursor <\n"
6587 res
+=self
.cursor_
.__str
__(prefix
+ " ", printElemNumber
)
6590 for e
in self
.result_
:
6592 if printElemNumber
: elm
="(%d)" % cnt
6593 res
+=prefix
+("result%s <\n" % elm
)
6594 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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
)
6606 if self
.has_compiled_cursor_
:
6607 res
+=prefix
+"compiled_cursor <\n"
6608 res
+=self
.compiled_cursor_
.__str
__(prefix
+ " ", printElemNumber
)
6611 for e
in self
.index_
:
6613 if printElemNumber
: elm
="(%d)" % cnt
6614 res
+=prefix
+("index%s <\n" % elm
)
6615 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
6619 for e
in self
.version_
:
6621 if printElemNumber
: elm
="(%d)" % cnt
6622 res
+=prefix
+("version%s: %s\n" % (elm
, self
.DebugFormatInt64(e
)))
6627 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
6628 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
6632 kskipped_results
= 7
6638 kcompiled_cursor
= 6
6642 _TEXT
= _BuildTagLookupTable({
6648 5: "compiled_query",
6649 6: "compiled_cursor",
6650 7: "skipped_results",
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
)
6674 _STYLE_CONTENT_TYPE
= """"""
6675 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.QueryResult'
6676 class AllocateIdsRequest(ProtocolBuffer
.ProtocolMessage
):
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
):
6701 def clear_size(self
):
6706 def has_size(self
): return self
.has_size_
6708 def max(self
): return self
.max_
6710 def set_max(self
, x
):
6714 def clear_max(self
):
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
6738 def IsInitialized(self
, debug_strs
=None):
6740 if (not self
.has_model_key_
):
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
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_
)
6754 def ByteSizePartial(self
):
6756 if (self
.has_model_key_
):
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_
)
6764 self
.clear_model_key()
6768 def OutputUnchecked(self
, out
):
6770 out
.putVarInt32(self
.model_key_
.ByteSize())
6771 self
.model_key_
.OutputUnchecked(out
)
6772 if (self
.has_size_
):
6774 out
.putVarInt64(self
.size_
)
6777 out
.putVarInt64(self
.max_
)
6779 def OutputPartial(self
, out
):
6780 if (self
.has_model_key_
):
6782 out
.putVarInt32(self
.model_key_
.ByteSizePartial())
6783 self
.model_key_
.OutputPartial(out
)
6784 if (self
.has_size_
):
6786 out
.putVarInt64(self
.size_
)
6789 out
.putVarInt64(self
.max_
)
6791 def TryMerge(self
, d
):
6792 while d
.avail() > 0:
6793 tt
= d
.getVarInt32()
6795 length
= d
.getVarInt32()
6796 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6798 self
.mutable_model_key().TryMerge(tmp
)
6801 self
.set_size(d
.getVarInt64())
6804 self
.set_max(d
.getVarInt64())
6808 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
6812 def __str__(self
, prefix
="", printElemNumber
=0):
6814 if self
.has_model_key_
:
6815 res
+=prefix
+"model_key <\n"
6816 res
+=self
.model_key_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
6823 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
6824 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
6830 _TEXT
= _BuildTagLookupTable({
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
)
6846 _STYLE_CONTENT_TYPE
= """"""
6847 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.AllocateIdsRequest'
6848 class AllocateIdsResponse(ProtocolBuffer
.ProtocolMessage
):
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
):
6866 def clear_start(self
):
6871 def has_start(self
): return self
.has_start_
6873 def end(self
): return self
.end_
6875 def set_end(self
, x
):
6879 def clear_end(self
):
6884 def has_end(self
): return self
.has_end_
6887 if self
.cost_
is None:
6888 self
.lazy_init_lock_
.acquire()
6890 if self
.cost_
is None: self
.cost_
= Cost()
6892 self
.lazy_init_lock_
.release()
6895 def mutable_cost(self
): self
.has_cost_
= 1; return self
.cost()
6897 def clear_cost(self
):
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
6922 def IsInitialized(self
, debug_strs
=None):
6924 if (not self
.has_start_
):
6926 if debug_strs
is not None:
6927 debug_strs
.append('Required field: start not set.')
6928 if (not self
.has_end_
):
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
6937 n
+= self
.lengthVarInt64(self
.start_
)
6938 n
+= self
.lengthVarInt64(self
.end_
)
6939 if (self
.has_cost_
): n
+= 1 + self
.lengthString(self
.cost_
.ByteSize())
6942 def ByteSizePartial(self
):
6944 if (self
.has_start_
):
6946 n
+= self
.lengthVarInt64(self
.start_
)
6949 n
+= self
.lengthVarInt64(self
.end_
)
6950 if (self
.has_cost_
): n
+= 1 + self
.lengthString(self
.cost_
.ByteSizePartial())
6958 def OutputUnchecked(self
, out
):
6960 out
.putVarInt64(self
.start_
)
6962 out
.putVarInt64(self
.end_
)
6963 if (self
.has_cost_
):
6965 out
.putVarInt32(self
.cost_
.ByteSize())
6966 self
.cost_
.OutputUnchecked(out
)
6968 def OutputPartial(self
, out
):
6969 if (self
.has_start_
):
6971 out
.putVarInt64(self
.start_
)
6974 out
.putVarInt64(self
.end_
)
6975 if (self
.has_cost_
):
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()
6984 self
.set_start(d
.getVarInt64())
6987 self
.set_end(d
.getVarInt64())
6990 length
= d
.getVarInt32()
6991 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
6993 self
.mutable_cost().TryMerge(tmp
)
6997 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7001 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
7006 res
+=prefix
+"cost <\n"
7007 res
+=self
.cost_
.__str
__(prefix
+ " ", printElemNumber
)
7012 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
7013 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
7019 _TEXT
= _BuildTagLookupTable({
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
)
7035 _STYLE_CONTENT_TYPE
= """"""
7036 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.AllocateIdsResponse'
7037 class CompositeIndices(ProtocolBuffer
.ProtocolMessage
):
7039 def __init__(self
, contents
=None):
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_
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
)
7057 def clear_index(self
):
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
7071 def IsInitialized(self
, debug_strs
=None):
7073 for p
in self
.index_
:
7074 if not p
.IsInitialized(debug_strs
): initialized
=0
7079 n
+= 1 * len(self
.index_
)
7080 for i
in xrange(len(self
.index_
)): n
+= self
.lengthString(self
.index_
[i
].ByteSize())
7083 def ByteSizePartial(self
):
7085 n
+= 1 * len(self
.index_
)
7086 for i
in xrange(len(self
.index_
)): n
+= self
.lengthString(self
.index_
[i
].ByteSizePartial())
7092 def OutputUnchecked(self
, out
):
7093 for i
in xrange(len(self
.index_
)):
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_
)):
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()
7108 length
= d
.getVarInt32()
7109 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
7111 self
.add_index().TryMerge(tmp
)
7115 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7119 def __str__(self
, prefix
="", printElemNumber
=0):
7122 for e
in self
.index_
:
7124 if printElemNumber
: elm
="(%d)" % cnt
7125 res
+=prefix
+("index%s <\n" % elm
)
7126 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
7132 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
7133 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
7137 _TEXT
= _BuildTagLookupTable({
7142 _TYPES
= _BuildTagLookupTable({
7143 0: ProtocolBuffer
.Encoder
.NUMERIC
,
7144 1: ProtocolBuffer
.Encoder
.STRING
,
7145 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
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()
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
):
7178 self
.action_
.append(x
)
7181 def clear_action(self
):
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
7198 def IsInitialized(self
, debug_strs
=None):
7200 if (not self
.has_transaction_
):
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
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())
7216 def ByteSizePartial(self
):
7218 if (self
.has_transaction_
):
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())
7226 self
.clear_transaction()
7229 def OutputUnchecked(self
, out
):
7231 out
.putVarInt32(self
.transaction_
.ByteSize())
7232 self
.transaction_
.OutputUnchecked(out
)
7233 for i
in xrange(len(self
.action_
)):
7235 out
.putVarInt32(self
.action_
[i
].ByteSize())
7236 self
.action_
[i
].OutputUnchecked(out
)
7238 def OutputPartial(self
, out
):
7239 if (self
.has_transaction_
):
7241 out
.putVarInt32(self
.transaction_
.ByteSizePartial())
7242 self
.transaction_
.OutputPartial(out
)
7243 for i
in xrange(len(self
.action_
)):
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()
7252 length
= d
.getVarInt32()
7253 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
7255 self
.mutable_transaction().TryMerge(tmp
)
7258 length
= d
.getVarInt32()
7259 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
7261 self
.add_action().TryMerge(tmp
)
7265 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7269 def __str__(self
, prefix
="", printElemNumber
=0):
7271 if self
.has_transaction_
:
7272 res
+=prefix
+"transaction <\n"
7273 res
+=self
.transaction_
.__str
__(prefix
+ " ", printElemNumber
)
7276 for e
in self
.action_
:
7278 if printElemNumber
: elm
="(%d)" % cnt
7279 res
+=prefix
+("action%s <\n" % elm
)
7280 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
7286 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
7287 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
7292 _TEXT
= _BuildTagLookupTable({
7298 _TYPES
= _BuildTagLookupTable({
7299 0: ProtocolBuffer
.Encoder
.NUMERIC
,
7300 1: ProtocolBuffer
.Encoder
.STRING
,
7301 2: ProtocolBuffer
.Encoder
.STRING
,
7302 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
7306 _STYLE_CONTENT_TYPE
= """"""
7307 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.AddActionsRequest'
7308 class AddActionsResponse(ProtocolBuffer
.ProtocolMessage
):
7310 def __init__(self
, contents
=None):
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
7322 def IsInitialized(self
, debug_strs
=None):
7330 def ByteSizePartial(self
):
7337 def OutputUnchecked(self
, out
):
7340 def OutputPartial(self
, out
):
7343 def TryMerge(self
, d
):
7344 while d
.avail() > 0:
7345 tt
= d
.getVarInt32()
7348 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7352 def __str__(self
, prefix
="", printElemNumber
=0):
7357 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
7358 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
7361 _TEXT
= _BuildTagLookupTable({
7365 _TYPES
= _BuildTagLookupTable({
7366 0: ProtocolBuffer
.Encoder
.NUMERIC
,
7367 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
7371 _STYLE_CONTENT_TYPE
= """"""
7372 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.AddActionsResponse'
7373 class BeginTransactionRequest(ProtocolBuffer
.ProtocolMessage
):
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
):
7388 def clear_app(self
):
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
7422 def IsInitialized(self
, debug_strs
=None):
7424 if (not self
.has_app_
):
7426 if debug_strs
is not None:
7427 debug_strs
.append('Required field: app not set.')
7432 n
+= self
.lengthString(len(self
.app_
))
7433 if (self
.has_allow_multiple_eg_
): n
+= 2
7436 def ByteSizePartial(self
):
7440 n
+= self
.lengthString(len(self
.app_
))
7441 if (self
.has_allow_multiple_eg_
): n
+= 2
7446 self
.clear_allow_multiple_eg()
7448 def OutputUnchecked(self
, out
):
7450 out
.putPrefixedString(self
.app_
)
7451 if (self
.has_allow_multiple_eg_
):
7453 out
.putBoolean(self
.allow_multiple_eg_
)
7455 def OutputPartial(self
, out
):
7458 out
.putPrefixedString(self
.app_
)
7459 if (self
.has_allow_multiple_eg_
):
7461 out
.putBoolean(self
.allow_multiple_eg_
)
7463 def TryMerge(self
, d
):
7464 while d
.avail() > 0:
7465 tt
= d
.getVarInt32()
7467 self
.set_app(d
.getPrefixedString())
7470 self
.set_allow_multiple_eg(d
.getBoolean())
7474 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7478 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
7485 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
7486 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
7489 kallow_multiple_eg
= 2
7491 _TEXT
= _BuildTagLookupTable({
7494 2: "allow_multiple_eg",
7497 _TYPES
= _BuildTagLookupTable({
7498 0: ProtocolBuffer
.Encoder
.NUMERIC
,
7499 1: ProtocolBuffer
.Encoder
.STRING
,
7500 2: ProtocolBuffer
.Encoder
.NUMERIC
,
7501 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
7505 _STYLE_CONTENT_TYPE
= """"""
7506 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.BeginTransactionRequest'
7507 class CommitResponse_Version(ProtocolBuffer
.ProtocolMessage
):
7508 has_root_entity_key_
= 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
7530 def clear_version(self
):
7531 if self
.has_version_
:
7532 self
.has_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
7551 def IsInitialized(self
, debug_strs
=None):
7553 if (not self
.has_root_entity_key_
):
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_
):
7560 if debug_strs
is not None:
7561 debug_strs
.append('Required field: version not set.')
7566 n
+= self
.lengthString(self
.root_entity_key_
.ByteSize())
7567 n
+= self
.lengthVarInt64(self
.version_
)
7570 def ByteSizePartial(self
):
7572 if (self
.has_root_entity_key_
):
7574 n
+= self
.lengthString(self
.root_entity_key_
.ByteSizePartial())
7575 if (self
.has_version_
):
7577 n
+= self
.lengthVarInt64(self
.version_
)
7581 self
.clear_root_entity_key()
7582 self
.clear_version()
7584 def OutputUnchecked(self
, out
):
7586 out
.putVarInt32(self
.root_entity_key_
.ByteSize())
7587 self
.root_entity_key_
.OutputUnchecked(out
)
7589 out
.putVarInt64(self
.version_
)
7591 def OutputPartial(self
, out
):
7592 if (self
.has_root_entity_key_
):
7594 out
.putVarInt32(self
.root_entity_key_
.ByteSizePartial())
7595 self
.root_entity_key_
.OutputPartial(out
)
7596 if (self
.has_version_
):
7598 out
.putVarInt64(self
.version_
)
7600 def TryMerge(self
, d
):
7602 tt
= d
.getVarInt32()
7605 length
= d
.getVarInt32()
7606 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
7608 self
.mutable_root_entity_key().TryMerge(tmp
)
7611 self
.set_version(d
.getVarInt64())
7615 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7619 def __str__(self
, prefix
="", printElemNumber
=0):
7621 if self
.has_root_entity_key_
:
7622 res
+=prefix
+"root_entity_key <\n"
7623 res
+=self
.root_entity_key_
.__str
__(prefix
+ " ", printElemNumber
)
7625 if self
.has_version_
: res
+=prefix
+("version: %s\n" % self
.DebugFormatInt64(self
.version_
))
7628 class CommitResponse(ProtocolBuffer
.ProtocolMessage
):
7632 def __init__(self
, contents
=None):
7634 self
.lazy_init_lock_
= thread
.allocate_lock()
7635 if contents
is not None: self
.MergeFromString(contents
)
7638 if self
.cost_
is None:
7639 self
.lazy_init_lock_
.acquire()
7641 if self
.cost_
is None: self
.cost_
= Cost()
7643 self
.lazy_init_lock_
.release()
7646 def mutable_cost(self
): self
.has_cost_
= 1; return self
.cost()
7648 def clear_cost(self
):
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
)
7670 def clear_version(self
):
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
7687 def IsInitialized(self
, debug_strs
=None):
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
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()
7701 def ByteSizePartial(self
):
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()
7710 self
.clear_version()
7712 def OutputUnchecked(self
, out
):
7713 if (self
.has_cost_
):
7715 out
.putVarInt32(self
.cost_
.ByteSize())
7716 self
.cost_
.OutputUnchecked(out
)
7717 for i
in xrange(len(self
.version_
)):
7719 self
.version_
[i
].OutputUnchecked(out
)
7722 def OutputPartial(self
, out
):
7723 if (self
.has_cost_
):
7725 out
.putVarInt32(self
.cost_
.ByteSizePartial())
7726 self
.cost_
.OutputPartial(out
)
7727 for i
in xrange(len(self
.version_
)):
7729 self
.version_
[i
].OutputPartial(out
)
7732 def TryMerge(self
, d
):
7733 while d
.avail() > 0:
7734 tt
= d
.getVarInt32()
7736 length
= d
.getVarInt32()
7737 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
7739 self
.mutable_cost().TryMerge(tmp
)
7742 self
.add_version().TryMerge(d
)
7746 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
7750 def __str__(self
, prefix
="", printElemNumber
=0):
7753 res
+=prefix
+"cost <\n"
7754 res
+=self
.cost_
.__str
__(prefix
+ " ", printElemNumber
)
7757 for e
in self
.version_
:
7759 if printElemNumber
: elm
="(%d)" % cnt
7760 res
+=prefix
+("Version%s {\n" % elm
)
7761 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
7767 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
7768 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
7772 kVersionroot_entity_key
= 4
7775 _TEXT
= _BuildTagLookupTable({
7779 4: "root_entity_key",
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
)
7793 _STYLE_CONTENT_TYPE
= """"""
7794 _PROTO_DESCRIPTOR_NAME
= 'apphosting_datastore_v3.CommitResponse'
7795 if _extension_runtime
:
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']