Update Google App Engine to 1.2.2 in thirdparty folder.
[Melange.git] / thirdparty / google_appengine / google / appengine / datastore / datastore_pb.py
blob6630b2129516701d3d34900a42496d140ab0e3c1
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 from google.net.proto import ProtocolBuffer
19 import array
20 import dummy_thread as thread
22 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
23 unusednames=printElemNumber,debug_strs no-special"""
25 from google.appengine.api.api_base_pb import Integer64Proto;
26 from google.appengine.api.api_base_pb import StringProto;
27 from google.appengine.api.api_base_pb import VoidProto;
28 from google.appengine.datastore.entity_pb import CompositeIndex
29 from google.appengine.datastore.entity_pb import EntityProto
30 from google.appengine.datastore.entity_pb import Index
31 from google.appengine.datastore.entity_pb import Property
32 from google.appengine.datastore.entity_pb import Reference
33 class Transaction(ProtocolBuffer.ProtocolMessage):
34 has_handle_ = 0
35 handle_ = 0
37 def __init__(self, contents=None):
38 if contents is not None: self.MergeFromString(contents)
40 def handle(self): return self.handle_
42 def set_handle(self, x):
43 self.has_handle_ = 1
44 self.handle_ = x
46 def clear_handle(self):
47 if self.has_handle_:
48 self.has_handle_ = 0
49 self.handle_ = 0
51 def has_handle(self): return self.has_handle_
54 def MergeFrom(self, x):
55 assert x is not self
56 if (x.has_handle()): self.set_handle(x.handle())
58 def Equals(self, x):
59 if x is self: return 1
60 if self.has_handle_ != x.has_handle_: return 0
61 if self.has_handle_ and self.handle_ != x.handle_: return 0
62 return 1
64 def IsInitialized(self, debug_strs=None):
65 initialized = 1
66 if (not self.has_handle_):
67 initialized = 0
68 if debug_strs is not None:
69 debug_strs.append('Required field: handle not set.')
70 return initialized
72 def ByteSize(self):
73 n = 0
74 return n + 9
76 def Clear(self):
77 self.clear_handle()
79 def OutputUnchecked(self, out):
80 out.putVarInt32(9)
81 out.put64(self.handle_)
83 def TryMerge(self, d):
84 while d.avail() > 0:
85 tt = d.getVarInt32()
86 if tt == 9:
87 self.set_handle(d.get64())
88 continue
89 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
90 d.skipData(tt)
93 def __str__(self, prefix="", printElemNumber=0):
94 res=""
95 if self.has_handle_: res+=prefix+("handle: %s\n" % self.DebugFormatFixed64(self.handle_))
96 return res
98 khandle = 1
100 _TEXT = (
101 "ErrorCode",
102 "handle",
105 _TYPES = (
106 ProtocolBuffer.Encoder.NUMERIC,
107 ProtocolBuffer.Encoder.DOUBLE,
111 _STYLE = """"""
112 _STYLE_CONTENT_TYPE = """"""
113 class Query_Filter(ProtocolBuffer.ProtocolMessage):
115 LESS_THAN = 1
116 LESS_THAN_OR_EQUAL = 2
117 GREATER_THAN = 3
118 GREATER_THAN_OR_EQUAL = 4
119 EQUAL = 5
120 IN = 6
121 EXISTS = 7
123 _Operator_NAMES = {
124 1: "LESS_THAN",
125 2: "LESS_THAN_OR_EQUAL",
126 3: "GREATER_THAN",
127 4: "GREATER_THAN_OR_EQUAL",
128 5: "EQUAL",
129 6: "IN",
130 7: "EXISTS",
133 def Operator_Name(cls, x): return cls._Operator_NAMES.get(x, "")
134 Operator_Name = classmethod(Operator_Name)
136 has_op_ = 0
137 op_ = 0
139 def __init__(self, contents=None):
140 self.property_ = []
141 if contents is not None: self.MergeFromString(contents)
143 def op(self): return self.op_
145 def set_op(self, x):
146 self.has_op_ = 1
147 self.op_ = x
149 def clear_op(self):
150 if self.has_op_:
151 self.has_op_ = 0
152 self.op_ = 0
154 def has_op(self): return self.has_op_
156 def property_size(self): return len(self.property_)
157 def property_list(self): return self.property_
159 def property(self, i):
160 return self.property_[i]
162 def mutable_property(self, i):
163 return self.property_[i]
165 def add_property(self):
166 x = Property()
167 self.property_.append(x)
168 return x
170 def clear_property(self):
171 self.property_ = []
173 def MergeFrom(self, x):
174 assert x is not self
175 if (x.has_op()): self.set_op(x.op())
176 for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i))
178 def Equals(self, x):
179 if x is self: return 1
180 if self.has_op_ != x.has_op_: return 0
181 if self.has_op_ and self.op_ != x.op_: return 0
182 if len(self.property_) != len(x.property_): return 0
183 for e1, e2 in zip(self.property_, x.property_):
184 if e1 != e2: return 0
185 return 1
187 def IsInitialized(self, debug_strs=None):
188 initialized = 1
189 if (not self.has_op_):
190 initialized = 0
191 if debug_strs is not None:
192 debug_strs.append('Required field: op not set.')
193 for p in self.property_:
194 if not p.IsInitialized(debug_strs): initialized=0
195 return initialized
197 def ByteSize(self):
198 n = 0
199 n += self.lengthVarInt64(self.op_)
200 n += 1 * len(self.property_)
201 for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSize())
202 return n + 1
204 def Clear(self):
205 self.clear_op()
206 self.clear_property()
208 def OutputUnchecked(self, out):
209 out.putVarInt32(48)
210 out.putVarInt32(self.op_)
211 for i in xrange(len(self.property_)):
212 out.putVarInt32(114)
213 out.putVarInt32(self.property_[i].ByteSize())
214 self.property_[i].OutputUnchecked(out)
216 def TryMerge(self, d):
217 while 1:
218 tt = d.getVarInt32()
219 if tt == 36: break
220 if tt == 48:
221 self.set_op(d.getVarInt32())
222 continue
223 if tt == 114:
224 length = d.getVarInt32()
225 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
226 d.skip(length)
227 self.add_property().TryMerge(tmp)
228 continue
229 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
230 d.skipData(tt)
233 def __str__(self, prefix="", printElemNumber=0):
234 res=""
235 if self.has_op_: res+=prefix+("op: %s\n" % self.DebugFormatInt32(self.op_))
236 cnt=0
237 for e in self.property_:
238 elm=""
239 if printElemNumber: elm="(%d)" % cnt
240 res+=prefix+("property%s <\n" % elm)
241 res+=e.__str__(prefix + " ", printElemNumber)
242 res+=prefix+">\n"
243 cnt+=1
244 return res
246 class Query_Order(ProtocolBuffer.ProtocolMessage):
248 ASCENDING = 1
249 DESCENDING = 2
251 _Direction_NAMES = {
252 1: "ASCENDING",
253 2: "DESCENDING",
256 def Direction_Name(cls, x): return cls._Direction_NAMES.get(x, "")
257 Direction_Name = classmethod(Direction_Name)
259 has_property_ = 0
260 property_ = ""
261 has_direction_ = 0
262 direction_ = 1
264 def __init__(self, contents=None):
265 if contents is not None: self.MergeFromString(contents)
267 def property(self): return self.property_
269 def set_property(self, x):
270 self.has_property_ = 1
271 self.property_ = x
273 def clear_property(self):
274 if self.has_property_:
275 self.has_property_ = 0
276 self.property_ = ""
278 def has_property(self): return self.has_property_
280 def direction(self): return self.direction_
282 def set_direction(self, x):
283 self.has_direction_ = 1
284 self.direction_ = x
286 def clear_direction(self):
287 if self.has_direction_:
288 self.has_direction_ = 0
289 self.direction_ = 1
291 def has_direction(self): return self.has_direction_
294 def MergeFrom(self, x):
295 assert x is not self
296 if (x.has_property()): self.set_property(x.property())
297 if (x.has_direction()): self.set_direction(x.direction())
299 def Equals(self, x):
300 if x is self: return 1
301 if self.has_property_ != x.has_property_: return 0
302 if self.has_property_ and self.property_ != x.property_: return 0
303 if self.has_direction_ != x.has_direction_: return 0
304 if self.has_direction_ and self.direction_ != x.direction_: return 0
305 return 1
307 def IsInitialized(self, debug_strs=None):
308 initialized = 1
309 if (not self.has_property_):
310 initialized = 0
311 if debug_strs is not None:
312 debug_strs.append('Required field: property not set.')
313 return initialized
315 def ByteSize(self):
316 n = 0
317 n += self.lengthString(len(self.property_))
318 if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_)
319 return n + 1
321 def Clear(self):
322 self.clear_property()
323 self.clear_direction()
325 def OutputUnchecked(self, out):
326 out.putVarInt32(82)
327 out.putPrefixedString(self.property_)
328 if (self.has_direction_):
329 out.putVarInt32(88)
330 out.putVarInt32(self.direction_)
332 def TryMerge(self, d):
333 while 1:
334 tt = d.getVarInt32()
335 if tt == 76: break
336 if tt == 82:
337 self.set_property(d.getPrefixedString())
338 continue
339 if tt == 88:
340 self.set_direction(d.getVarInt32())
341 continue
342 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
343 d.skipData(tt)
346 def __str__(self, prefix="", printElemNumber=0):
347 res=""
348 if self.has_property_: res+=prefix+("property: %s\n" % self.DebugFormatString(self.property_))
349 if self.has_direction_: res+=prefix+("direction: %s\n" % self.DebugFormatInt32(self.direction_))
350 return res
352 class Query(ProtocolBuffer.ProtocolMessage):
354 ORDER_FIRST = 1
355 ANCESTOR_FIRST = 2
356 FILTER_FIRST = 3
358 _Hint_NAMES = {
359 1: "ORDER_FIRST",
360 2: "ANCESTOR_FIRST",
361 3: "FILTER_FIRST",
364 def Hint_Name(cls, x): return cls._Hint_NAMES.get(x, "")
365 Hint_Name = classmethod(Hint_Name)
367 has_app_ = 0
368 app_ = ""
369 has_kind_ = 0
370 kind_ = ""
371 has_ancestor_ = 0
372 ancestor_ = None
373 has_search_query_ = 0
374 search_query_ = ""
375 has_hint_ = 0
376 hint_ = 0
377 has_offset_ = 0
378 offset_ = 0
379 has_limit_ = 0
380 limit_ = 0
381 has_require_perfect_plan_ = 0
382 require_perfect_plan_ = 0
383 has_keys_only_ = 0
384 keys_only_ = 0
386 def __init__(self, contents=None):
387 self.filter_ = []
388 self.order_ = []
389 self.composite_index_ = []
390 self.lazy_init_lock_ = thread.allocate_lock()
391 if contents is not None: self.MergeFromString(contents)
393 def app(self): return self.app_
395 def set_app(self, x):
396 self.has_app_ = 1
397 self.app_ = x
399 def clear_app(self):
400 if self.has_app_:
401 self.has_app_ = 0
402 self.app_ = ""
404 def has_app(self): return self.has_app_
406 def kind(self): return self.kind_
408 def set_kind(self, x):
409 self.has_kind_ = 1
410 self.kind_ = x
412 def clear_kind(self):
413 if self.has_kind_:
414 self.has_kind_ = 0
415 self.kind_ = ""
417 def has_kind(self): return self.has_kind_
419 def ancestor(self):
420 if self.ancestor_ is None:
421 self.lazy_init_lock_.acquire()
422 try:
423 if self.ancestor_ is None: self.ancestor_ = Reference()
424 finally:
425 self.lazy_init_lock_.release()
426 return self.ancestor_
428 def mutable_ancestor(self): self.has_ancestor_ = 1; return self.ancestor()
430 def clear_ancestor(self):
431 if self.has_ancestor_:
432 self.has_ancestor_ = 0;
433 if self.ancestor_ is not None: self.ancestor_.Clear()
435 def has_ancestor(self): return self.has_ancestor_
437 def filter_size(self): return len(self.filter_)
438 def filter_list(self): return self.filter_
440 def filter(self, i):
441 return self.filter_[i]
443 def mutable_filter(self, i):
444 return self.filter_[i]
446 def add_filter(self):
447 x = Query_Filter()
448 self.filter_.append(x)
449 return x
451 def clear_filter(self):
452 self.filter_ = []
453 def search_query(self): return self.search_query_
455 def set_search_query(self, x):
456 self.has_search_query_ = 1
457 self.search_query_ = x
459 def clear_search_query(self):
460 if self.has_search_query_:
461 self.has_search_query_ = 0
462 self.search_query_ = ""
464 def has_search_query(self): return self.has_search_query_
466 def order_size(self): return len(self.order_)
467 def order_list(self): return self.order_
469 def order(self, i):
470 return self.order_[i]
472 def mutable_order(self, i):
473 return self.order_[i]
475 def add_order(self):
476 x = Query_Order()
477 self.order_.append(x)
478 return x
480 def clear_order(self):
481 self.order_ = []
482 def hint(self): return self.hint_
484 def set_hint(self, x):
485 self.has_hint_ = 1
486 self.hint_ = x
488 def clear_hint(self):
489 if self.has_hint_:
490 self.has_hint_ = 0
491 self.hint_ = 0
493 def has_hint(self): return self.has_hint_
495 def offset(self): return self.offset_
497 def set_offset(self, x):
498 self.has_offset_ = 1
499 self.offset_ = x
501 def clear_offset(self):
502 if self.has_offset_:
503 self.has_offset_ = 0
504 self.offset_ = 0
506 def has_offset(self): return self.has_offset_
508 def limit(self): return self.limit_
510 def set_limit(self, x):
511 self.has_limit_ = 1
512 self.limit_ = x
514 def clear_limit(self):
515 if self.has_limit_:
516 self.has_limit_ = 0
517 self.limit_ = 0
519 def has_limit(self): return self.has_limit_
521 def composite_index_size(self): return len(self.composite_index_)
522 def composite_index_list(self): return self.composite_index_
524 def composite_index(self, i):
525 return self.composite_index_[i]
527 def mutable_composite_index(self, i):
528 return self.composite_index_[i]
530 def add_composite_index(self):
531 x = CompositeIndex()
532 self.composite_index_.append(x)
533 return x
535 def clear_composite_index(self):
536 self.composite_index_ = []
537 def require_perfect_plan(self): return self.require_perfect_plan_
539 def set_require_perfect_plan(self, x):
540 self.has_require_perfect_plan_ = 1
541 self.require_perfect_plan_ = x
543 def clear_require_perfect_plan(self):
544 if self.has_require_perfect_plan_:
545 self.has_require_perfect_plan_ = 0
546 self.require_perfect_plan_ = 0
548 def has_require_perfect_plan(self): return self.has_require_perfect_plan_
550 def keys_only(self): return self.keys_only_
552 def set_keys_only(self, x):
553 self.has_keys_only_ = 1
554 self.keys_only_ = x
556 def clear_keys_only(self):
557 if self.has_keys_only_:
558 self.has_keys_only_ = 0
559 self.keys_only_ = 0
561 def has_keys_only(self): return self.has_keys_only_
564 def MergeFrom(self, x):
565 assert x is not self
566 if (x.has_app()): self.set_app(x.app())
567 if (x.has_kind()): self.set_kind(x.kind())
568 if (x.has_ancestor()): self.mutable_ancestor().MergeFrom(x.ancestor())
569 for i in xrange(x.filter_size()): self.add_filter().CopyFrom(x.filter(i))
570 if (x.has_search_query()): self.set_search_query(x.search_query())
571 for i in xrange(x.order_size()): self.add_order().CopyFrom(x.order(i))
572 if (x.has_hint()): self.set_hint(x.hint())
573 if (x.has_offset()): self.set_offset(x.offset())
574 if (x.has_limit()): self.set_limit(x.limit())
575 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
576 if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan())
577 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
579 def Equals(self, x):
580 if x is self: return 1
581 if self.has_app_ != x.has_app_: return 0
582 if self.has_app_ and self.app_ != x.app_: return 0
583 if self.has_kind_ != x.has_kind_: return 0
584 if self.has_kind_ and self.kind_ != x.kind_: return 0
585 if self.has_ancestor_ != x.has_ancestor_: return 0
586 if self.has_ancestor_ and self.ancestor_ != x.ancestor_: return 0
587 if len(self.filter_) != len(x.filter_): return 0
588 for e1, e2 in zip(self.filter_, x.filter_):
589 if e1 != e2: return 0
590 if self.has_search_query_ != x.has_search_query_: return 0
591 if self.has_search_query_ and self.search_query_ != x.search_query_: return 0
592 if len(self.order_) != len(x.order_): return 0
593 for e1, e2 in zip(self.order_, x.order_):
594 if e1 != e2: return 0
595 if self.has_hint_ != x.has_hint_: return 0
596 if self.has_hint_ and self.hint_ != x.hint_: return 0
597 if self.has_offset_ != x.has_offset_: return 0
598 if self.has_offset_ and self.offset_ != x.offset_: return 0
599 if self.has_limit_ != x.has_limit_: return 0
600 if self.has_limit_ and self.limit_ != x.limit_: return 0
601 if len(self.composite_index_) != len(x.composite_index_): return 0
602 for e1, e2 in zip(self.composite_index_, x.composite_index_):
603 if e1 != e2: return 0
604 if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0
605 if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0
606 if self.has_keys_only_ != x.has_keys_only_: return 0
607 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
608 return 1
610 def IsInitialized(self, debug_strs=None):
611 initialized = 1
612 if (not self.has_app_):
613 initialized = 0
614 if debug_strs is not None:
615 debug_strs.append('Required field: app not set.')
616 if (self.has_ancestor_ and not self.ancestor_.IsInitialized(debug_strs)): initialized = 0
617 for p in self.filter_:
618 if not p.IsInitialized(debug_strs): initialized=0
619 for p in self.order_:
620 if not p.IsInitialized(debug_strs): initialized=0
621 for p in self.composite_index_:
622 if not p.IsInitialized(debug_strs): initialized=0
623 return initialized
625 def ByteSize(self):
626 n = 0
627 n += self.lengthString(len(self.app_))
628 if (self.has_kind_): n += 1 + self.lengthString(len(self.kind_))
629 if (self.has_ancestor_): n += 2 + self.lengthString(self.ancestor_.ByteSize())
630 n += 2 * len(self.filter_)
631 for i in xrange(len(self.filter_)): n += self.filter_[i].ByteSize()
632 if (self.has_search_query_): n += 1 + self.lengthString(len(self.search_query_))
633 n += 2 * len(self.order_)
634 for i in xrange(len(self.order_)): n += self.order_[i].ByteSize()
635 if (self.has_hint_): n += 2 + self.lengthVarInt64(self.hint_)
636 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
637 if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_)
638 n += 2 * len(self.composite_index_)
639 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
640 if (self.has_require_perfect_plan_): n += 3
641 if (self.has_keys_only_): n += 3
642 return n + 1
644 def Clear(self):
645 self.clear_app()
646 self.clear_kind()
647 self.clear_ancestor()
648 self.clear_filter()
649 self.clear_search_query()
650 self.clear_order()
651 self.clear_hint()
652 self.clear_offset()
653 self.clear_limit()
654 self.clear_composite_index()
655 self.clear_require_perfect_plan()
656 self.clear_keys_only()
658 def OutputUnchecked(self, out):
659 out.putVarInt32(10)
660 out.putPrefixedString(self.app_)
661 if (self.has_kind_):
662 out.putVarInt32(26)
663 out.putPrefixedString(self.kind_)
664 for i in xrange(len(self.filter_)):
665 out.putVarInt32(35)
666 self.filter_[i].OutputUnchecked(out)
667 out.putVarInt32(36)
668 if (self.has_search_query_):
669 out.putVarInt32(66)
670 out.putPrefixedString(self.search_query_)
671 for i in xrange(len(self.order_)):
672 out.putVarInt32(75)
673 self.order_[i].OutputUnchecked(out)
674 out.putVarInt32(76)
675 if (self.has_offset_):
676 out.putVarInt32(96)
677 out.putVarInt32(self.offset_)
678 if (self.has_limit_):
679 out.putVarInt32(128)
680 out.putVarInt32(self.limit_)
681 if (self.has_ancestor_):
682 out.putVarInt32(138)
683 out.putVarInt32(self.ancestor_.ByteSize())
684 self.ancestor_.OutputUnchecked(out)
685 if (self.has_hint_):
686 out.putVarInt32(144)
687 out.putVarInt32(self.hint_)
688 for i in xrange(len(self.composite_index_)):
689 out.putVarInt32(154)
690 out.putVarInt32(self.composite_index_[i].ByteSize())
691 self.composite_index_[i].OutputUnchecked(out)
692 if (self.has_require_perfect_plan_):
693 out.putVarInt32(160)
694 out.putBoolean(self.require_perfect_plan_)
695 if (self.has_keys_only_):
696 out.putVarInt32(168)
697 out.putBoolean(self.keys_only_)
699 def TryMerge(self, d):
700 while d.avail() > 0:
701 tt = d.getVarInt32()
702 if tt == 10:
703 self.set_app(d.getPrefixedString())
704 continue
705 if tt == 26:
706 self.set_kind(d.getPrefixedString())
707 continue
708 if tt == 35:
709 self.add_filter().TryMerge(d)
710 continue
711 if tt == 66:
712 self.set_search_query(d.getPrefixedString())
713 continue
714 if tt == 75:
715 self.add_order().TryMerge(d)
716 continue
717 if tt == 96:
718 self.set_offset(d.getVarInt32())
719 continue
720 if tt == 128:
721 self.set_limit(d.getVarInt32())
722 continue
723 if tt == 138:
724 length = d.getVarInt32()
725 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
726 d.skip(length)
727 self.mutable_ancestor().TryMerge(tmp)
728 continue
729 if tt == 144:
730 self.set_hint(d.getVarInt32())
731 continue
732 if tt == 154:
733 length = d.getVarInt32()
734 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
735 d.skip(length)
736 self.add_composite_index().TryMerge(tmp)
737 continue
738 if tt == 160:
739 self.set_require_perfect_plan(d.getBoolean())
740 continue
741 if tt == 168:
742 self.set_keys_only(d.getBoolean())
743 continue
744 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
745 d.skipData(tt)
748 def __str__(self, prefix="", printElemNumber=0):
749 res=""
750 if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_))
751 if self.has_kind_: res+=prefix+("kind: %s\n" % self.DebugFormatString(self.kind_))
752 if self.has_ancestor_:
753 res+=prefix+"ancestor <\n"
754 res+=self.ancestor_.__str__(prefix + " ", printElemNumber)
755 res+=prefix+">\n"
756 cnt=0
757 for e in self.filter_:
758 elm=""
759 if printElemNumber: elm="(%d)" % cnt
760 res+=prefix+("Filter%s {\n" % elm)
761 res+=e.__str__(prefix + " ", printElemNumber)
762 res+=prefix+"}\n"
763 cnt+=1
764 if self.has_search_query_: res+=prefix+("search_query: %s\n" % self.DebugFormatString(self.search_query_))
765 cnt=0
766 for e in self.order_:
767 elm=""
768 if printElemNumber: elm="(%d)" % cnt
769 res+=prefix+("Order%s {\n" % elm)
770 res+=e.__str__(prefix + " ", printElemNumber)
771 res+=prefix+"}\n"
772 cnt+=1
773 if self.has_hint_: res+=prefix+("hint: %s\n" % self.DebugFormatInt32(self.hint_))
774 if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
775 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
776 cnt=0
777 for e in self.composite_index_:
778 elm=""
779 if printElemNumber: elm="(%d)" % cnt
780 res+=prefix+("composite_index%s <\n" % elm)
781 res+=e.__str__(prefix + " ", printElemNumber)
782 res+=prefix+">\n"
783 cnt+=1
784 if self.has_require_perfect_plan_: res+=prefix+("require_perfect_plan: %s\n" % self.DebugFormatBool(self.require_perfect_plan_))
785 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
786 return res
788 kapp = 1
789 kkind = 3
790 kancestor = 17
791 kFilterGroup = 4
792 kFilterop = 6
793 kFilterproperty = 14
794 ksearch_query = 8
795 kOrderGroup = 9
796 kOrderproperty = 10
797 kOrderdirection = 11
798 khint = 18
799 koffset = 12
800 klimit = 16
801 kcomposite_index = 19
802 krequire_perfect_plan = 20
803 kkeys_only = 21
805 _TEXT = (
806 "ErrorCode",
807 "app",
808 None,
809 "kind",
810 "Filter",
811 None,
812 "op",
813 None,
814 "search_query",
815 "Order",
816 "property",
817 "direction",
818 "offset",
819 None,
820 "property",
821 None,
822 "limit",
823 "ancestor",
824 "hint",
825 "composite_index",
826 "require_perfect_plan",
827 "keys_only",
830 _TYPES = (
831 ProtocolBuffer.Encoder.NUMERIC,
832 ProtocolBuffer.Encoder.STRING,
834 ProtocolBuffer.Encoder.MAX_TYPE,
836 ProtocolBuffer.Encoder.STRING,
838 ProtocolBuffer.Encoder.STARTGROUP,
840 ProtocolBuffer.Encoder.MAX_TYPE,
842 ProtocolBuffer.Encoder.NUMERIC,
844 ProtocolBuffer.Encoder.MAX_TYPE,
846 ProtocolBuffer.Encoder.STRING,
848 ProtocolBuffer.Encoder.STARTGROUP,
850 ProtocolBuffer.Encoder.STRING,
852 ProtocolBuffer.Encoder.NUMERIC,
854 ProtocolBuffer.Encoder.NUMERIC,
856 ProtocolBuffer.Encoder.MAX_TYPE,
858 ProtocolBuffer.Encoder.STRING,
860 ProtocolBuffer.Encoder.MAX_TYPE,
862 ProtocolBuffer.Encoder.NUMERIC,
864 ProtocolBuffer.Encoder.STRING,
866 ProtocolBuffer.Encoder.NUMERIC,
868 ProtocolBuffer.Encoder.STRING,
870 ProtocolBuffer.Encoder.NUMERIC,
872 ProtocolBuffer.Encoder.NUMERIC,
876 _STYLE = """"""
877 _STYLE_CONTENT_TYPE = """"""
878 class QueryExplanation(ProtocolBuffer.ProtocolMessage):
879 has_native_ancestor_ = 0
880 native_ancestor_ = 0
881 has_native_offset_ = 0
882 native_offset_ = 0
883 has_native_limit_ = 0
884 native_limit_ = 0
886 def __init__(self, contents=None):
887 self.native_index_ = []
888 if contents is not None: self.MergeFromString(contents)
890 def native_ancestor(self): return self.native_ancestor_
892 def set_native_ancestor(self, x):
893 self.has_native_ancestor_ = 1
894 self.native_ancestor_ = x
896 def clear_native_ancestor(self):
897 if self.has_native_ancestor_:
898 self.has_native_ancestor_ = 0
899 self.native_ancestor_ = 0
901 def has_native_ancestor(self): return self.has_native_ancestor_
903 def native_index_size(self): return len(self.native_index_)
904 def native_index_list(self): return self.native_index_
906 def native_index(self, i):
907 return self.native_index_[i]
909 def mutable_native_index(self, i):
910 return self.native_index_[i]
912 def add_native_index(self):
913 x = Index()
914 self.native_index_.append(x)
915 return x
917 def clear_native_index(self):
918 self.native_index_ = []
919 def native_offset(self): return self.native_offset_
921 def set_native_offset(self, x):
922 self.has_native_offset_ = 1
923 self.native_offset_ = x
925 def clear_native_offset(self):
926 if self.has_native_offset_:
927 self.has_native_offset_ = 0
928 self.native_offset_ = 0
930 def has_native_offset(self): return self.has_native_offset_
932 def native_limit(self): return self.native_limit_
934 def set_native_limit(self, x):
935 self.has_native_limit_ = 1
936 self.native_limit_ = x
938 def clear_native_limit(self):
939 if self.has_native_limit_:
940 self.has_native_limit_ = 0
941 self.native_limit_ = 0
943 def has_native_limit(self): return self.has_native_limit_
946 def MergeFrom(self, x):
947 assert x is not self
948 if (x.has_native_ancestor()): self.set_native_ancestor(x.native_ancestor())
949 for i in xrange(x.native_index_size()): self.add_native_index().CopyFrom(x.native_index(i))
950 if (x.has_native_offset()): self.set_native_offset(x.native_offset())
951 if (x.has_native_limit()): self.set_native_limit(x.native_limit())
953 def Equals(self, x):
954 if x is self: return 1
955 if self.has_native_ancestor_ != x.has_native_ancestor_: return 0
956 if self.has_native_ancestor_ and self.native_ancestor_ != x.native_ancestor_: return 0
957 if len(self.native_index_) != len(x.native_index_): return 0
958 for e1, e2 in zip(self.native_index_, x.native_index_):
959 if e1 != e2: return 0
960 if self.has_native_offset_ != x.has_native_offset_: return 0
961 if self.has_native_offset_ and self.native_offset_ != x.native_offset_: return 0
962 if self.has_native_limit_ != x.has_native_limit_: return 0
963 if self.has_native_limit_ and self.native_limit_ != x.native_limit_: return 0
964 return 1
966 def IsInitialized(self, debug_strs=None):
967 initialized = 1
968 for p in self.native_index_:
969 if not p.IsInitialized(debug_strs): initialized=0
970 return initialized
972 def ByteSize(self):
973 n = 0
974 if (self.has_native_ancestor_): n += 2
975 n += 1 * len(self.native_index_)
976 for i in xrange(len(self.native_index_)): n += self.lengthString(self.native_index_[i].ByteSize())
977 if (self.has_native_offset_): n += 1 + self.lengthVarInt64(self.native_offset_)
978 if (self.has_native_limit_): n += 1 + self.lengthVarInt64(self.native_limit_)
979 return n + 0
981 def Clear(self):
982 self.clear_native_ancestor()
983 self.clear_native_index()
984 self.clear_native_offset()
985 self.clear_native_limit()
987 def OutputUnchecked(self, out):
988 if (self.has_native_ancestor_):
989 out.putVarInt32(8)
990 out.putBoolean(self.native_ancestor_)
991 for i in xrange(len(self.native_index_)):
992 out.putVarInt32(18)
993 out.putVarInt32(self.native_index_[i].ByteSize())
994 self.native_index_[i].OutputUnchecked(out)
995 if (self.has_native_offset_):
996 out.putVarInt32(24)
997 out.putVarInt32(self.native_offset_)
998 if (self.has_native_limit_):
999 out.putVarInt32(32)
1000 out.putVarInt32(self.native_limit_)
1002 def TryMerge(self, d):
1003 while d.avail() > 0:
1004 tt = d.getVarInt32()
1005 if tt == 8:
1006 self.set_native_ancestor(d.getBoolean())
1007 continue
1008 if tt == 18:
1009 length = d.getVarInt32()
1010 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1011 d.skip(length)
1012 self.add_native_index().TryMerge(tmp)
1013 continue
1014 if tt == 24:
1015 self.set_native_offset(d.getVarInt32())
1016 continue
1017 if tt == 32:
1018 self.set_native_limit(d.getVarInt32())
1019 continue
1020 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1021 d.skipData(tt)
1024 def __str__(self, prefix="", printElemNumber=0):
1025 res=""
1026 if self.has_native_ancestor_: res+=prefix+("native_ancestor: %s\n" % self.DebugFormatBool(self.native_ancestor_))
1027 cnt=0
1028 for e in self.native_index_:
1029 elm=""
1030 if printElemNumber: elm="(%d)" % cnt
1031 res+=prefix+("native_index%s <\n" % elm)
1032 res+=e.__str__(prefix + " ", printElemNumber)
1033 res+=prefix+">\n"
1034 cnt+=1
1035 if self.has_native_offset_: res+=prefix+("native_offset: %s\n" % self.DebugFormatInt32(self.native_offset_))
1036 if self.has_native_limit_: res+=prefix+("native_limit: %s\n" % self.DebugFormatInt32(self.native_limit_))
1037 return res
1039 knative_ancestor = 1
1040 knative_index = 2
1041 knative_offset = 3
1042 knative_limit = 4
1044 _TEXT = (
1045 "ErrorCode",
1046 "native_ancestor",
1047 "native_index",
1048 "native_offset",
1049 "native_limit",
1052 _TYPES = (
1053 ProtocolBuffer.Encoder.NUMERIC,
1054 ProtocolBuffer.Encoder.NUMERIC,
1056 ProtocolBuffer.Encoder.STRING,
1058 ProtocolBuffer.Encoder.NUMERIC,
1060 ProtocolBuffer.Encoder.NUMERIC,
1064 _STYLE = """"""
1065 _STYLE_CONTENT_TYPE = """"""
1066 class Cursor(ProtocolBuffer.ProtocolMessage):
1067 has_cursor_ = 0
1068 cursor_ = 0
1070 def __init__(self, contents=None):
1071 if contents is not None: self.MergeFromString(contents)
1073 def cursor(self): return self.cursor_
1075 def set_cursor(self, x):
1076 self.has_cursor_ = 1
1077 self.cursor_ = x
1079 def clear_cursor(self):
1080 if self.has_cursor_:
1081 self.has_cursor_ = 0
1082 self.cursor_ = 0
1084 def has_cursor(self): return self.has_cursor_
1087 def MergeFrom(self, x):
1088 assert x is not self
1089 if (x.has_cursor()): self.set_cursor(x.cursor())
1091 def Equals(self, x):
1092 if x is self: return 1
1093 if self.has_cursor_ != x.has_cursor_: return 0
1094 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
1095 return 1
1097 def IsInitialized(self, debug_strs=None):
1098 initialized = 1
1099 if (not self.has_cursor_):
1100 initialized = 0
1101 if debug_strs is not None:
1102 debug_strs.append('Required field: cursor not set.')
1103 return initialized
1105 def ByteSize(self):
1106 n = 0
1107 return n + 9
1109 def Clear(self):
1110 self.clear_cursor()
1112 def OutputUnchecked(self, out):
1113 out.putVarInt32(9)
1114 out.put64(self.cursor_)
1116 def TryMerge(self, d):
1117 while d.avail() > 0:
1118 tt = d.getVarInt32()
1119 if tt == 9:
1120 self.set_cursor(d.get64())
1121 continue
1122 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1123 d.skipData(tt)
1126 def __str__(self, prefix="", printElemNumber=0):
1127 res=""
1128 if self.has_cursor_: res+=prefix+("cursor: %s\n" % self.DebugFormatFixed64(self.cursor_))
1129 return res
1131 kcursor = 1
1133 _TEXT = (
1134 "ErrorCode",
1135 "cursor",
1138 _TYPES = (
1139 ProtocolBuffer.Encoder.NUMERIC,
1140 ProtocolBuffer.Encoder.DOUBLE,
1144 _STYLE = """"""
1145 _STYLE_CONTENT_TYPE = """"""
1146 class Error(ProtocolBuffer.ProtocolMessage):
1148 BAD_REQUEST = 1
1149 CONCURRENT_TRANSACTION = 2
1150 INTERNAL_ERROR = 3
1151 NEED_INDEX = 4
1152 TIMEOUT = 5
1154 _ErrorCode_NAMES = {
1155 1: "BAD_REQUEST",
1156 2: "CONCURRENT_TRANSACTION",
1157 3: "INTERNAL_ERROR",
1158 4: "NEED_INDEX",
1159 5: "TIMEOUT",
1162 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "")
1163 ErrorCode_Name = classmethod(ErrorCode_Name)
1166 def __init__(self, contents=None):
1167 pass
1168 if contents is not None: self.MergeFromString(contents)
1171 def MergeFrom(self, x):
1172 assert x is not self
1174 def Equals(self, x):
1175 if x is self: return 1
1176 return 1
1178 def IsInitialized(self, debug_strs=None):
1179 initialized = 1
1180 return initialized
1182 def ByteSize(self):
1183 n = 0
1184 return n + 0
1186 def Clear(self):
1187 pass
1189 def OutputUnchecked(self, out):
1190 pass
1192 def TryMerge(self, d):
1193 while d.avail() > 0:
1194 tt = d.getVarInt32()
1195 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1196 d.skipData(tt)
1199 def __str__(self, prefix="", printElemNumber=0):
1200 res=""
1201 return res
1204 _TEXT = (
1205 "ErrorCode",
1208 _TYPES = (
1209 ProtocolBuffer.Encoder.NUMERIC,
1212 _STYLE = """"""
1213 _STYLE_CONTENT_TYPE = """"""
1214 class Cost(ProtocolBuffer.ProtocolMessage):
1215 has_index_writes_ = 0
1216 index_writes_ = 0
1217 has_index_write_bytes_ = 0
1218 index_write_bytes_ = 0
1219 has_entity_writes_ = 0
1220 entity_writes_ = 0
1221 has_entity_write_bytes_ = 0
1222 entity_write_bytes_ = 0
1224 def __init__(self, contents=None):
1225 if contents is not None: self.MergeFromString(contents)
1227 def index_writes(self): return self.index_writes_
1229 def set_index_writes(self, x):
1230 self.has_index_writes_ = 1
1231 self.index_writes_ = x
1233 def clear_index_writes(self):
1234 if self.has_index_writes_:
1235 self.has_index_writes_ = 0
1236 self.index_writes_ = 0
1238 def has_index_writes(self): return self.has_index_writes_
1240 def index_write_bytes(self): return self.index_write_bytes_
1242 def set_index_write_bytes(self, x):
1243 self.has_index_write_bytes_ = 1
1244 self.index_write_bytes_ = x
1246 def clear_index_write_bytes(self):
1247 if self.has_index_write_bytes_:
1248 self.has_index_write_bytes_ = 0
1249 self.index_write_bytes_ = 0
1251 def has_index_write_bytes(self): return self.has_index_write_bytes_
1253 def entity_writes(self): return self.entity_writes_
1255 def set_entity_writes(self, x):
1256 self.has_entity_writes_ = 1
1257 self.entity_writes_ = x
1259 def clear_entity_writes(self):
1260 if self.has_entity_writes_:
1261 self.has_entity_writes_ = 0
1262 self.entity_writes_ = 0
1264 def has_entity_writes(self): return self.has_entity_writes_
1266 def entity_write_bytes(self): return self.entity_write_bytes_
1268 def set_entity_write_bytes(self, x):
1269 self.has_entity_write_bytes_ = 1
1270 self.entity_write_bytes_ = x
1272 def clear_entity_write_bytes(self):
1273 if self.has_entity_write_bytes_:
1274 self.has_entity_write_bytes_ = 0
1275 self.entity_write_bytes_ = 0
1277 def has_entity_write_bytes(self): return self.has_entity_write_bytes_
1280 def MergeFrom(self, x):
1281 assert x is not self
1282 if (x.has_index_writes()): self.set_index_writes(x.index_writes())
1283 if (x.has_index_write_bytes()): self.set_index_write_bytes(x.index_write_bytes())
1284 if (x.has_entity_writes()): self.set_entity_writes(x.entity_writes())
1285 if (x.has_entity_write_bytes()): self.set_entity_write_bytes(x.entity_write_bytes())
1287 def Equals(self, x):
1288 if x is self: return 1
1289 if self.has_index_writes_ != x.has_index_writes_: return 0
1290 if self.has_index_writes_ and self.index_writes_ != x.index_writes_: return 0
1291 if self.has_index_write_bytes_ != x.has_index_write_bytes_: return 0
1292 if self.has_index_write_bytes_ and self.index_write_bytes_ != x.index_write_bytes_: return 0
1293 if self.has_entity_writes_ != x.has_entity_writes_: return 0
1294 if self.has_entity_writes_ and self.entity_writes_ != x.entity_writes_: return 0
1295 if self.has_entity_write_bytes_ != x.has_entity_write_bytes_: return 0
1296 if self.has_entity_write_bytes_ and self.entity_write_bytes_ != x.entity_write_bytes_: return 0
1297 return 1
1299 def IsInitialized(self, debug_strs=None):
1300 initialized = 1
1301 return initialized
1303 def ByteSize(self):
1304 n = 0
1305 if (self.has_index_writes_): n += 1 + self.lengthVarInt64(self.index_writes_)
1306 if (self.has_index_write_bytes_): n += 1 + self.lengthVarInt64(self.index_write_bytes_)
1307 if (self.has_entity_writes_): n += 1 + self.lengthVarInt64(self.entity_writes_)
1308 if (self.has_entity_write_bytes_): n += 1 + self.lengthVarInt64(self.entity_write_bytes_)
1309 return n + 0
1311 def Clear(self):
1312 self.clear_index_writes()
1313 self.clear_index_write_bytes()
1314 self.clear_entity_writes()
1315 self.clear_entity_write_bytes()
1317 def OutputUnchecked(self, out):
1318 if (self.has_index_writes_):
1319 out.putVarInt32(8)
1320 out.putVarInt32(self.index_writes_)
1321 if (self.has_index_write_bytes_):
1322 out.putVarInt32(16)
1323 out.putVarInt32(self.index_write_bytes_)
1324 if (self.has_entity_writes_):
1325 out.putVarInt32(24)
1326 out.putVarInt32(self.entity_writes_)
1327 if (self.has_entity_write_bytes_):
1328 out.putVarInt32(32)
1329 out.putVarInt32(self.entity_write_bytes_)
1331 def TryMerge(self, d):
1332 while d.avail() > 0:
1333 tt = d.getVarInt32()
1334 if tt == 8:
1335 self.set_index_writes(d.getVarInt32())
1336 continue
1337 if tt == 16:
1338 self.set_index_write_bytes(d.getVarInt32())
1339 continue
1340 if tt == 24:
1341 self.set_entity_writes(d.getVarInt32())
1342 continue
1343 if tt == 32:
1344 self.set_entity_write_bytes(d.getVarInt32())
1345 continue
1346 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1347 d.skipData(tt)
1350 def __str__(self, prefix="", printElemNumber=0):
1351 res=""
1352 if self.has_index_writes_: res+=prefix+("index_writes: %s\n" % self.DebugFormatInt32(self.index_writes_))
1353 if self.has_index_write_bytes_: res+=prefix+("index_write_bytes: %s\n" % self.DebugFormatInt32(self.index_write_bytes_))
1354 if self.has_entity_writes_: res+=prefix+("entity_writes: %s\n" % self.DebugFormatInt32(self.entity_writes_))
1355 if self.has_entity_write_bytes_: res+=prefix+("entity_write_bytes: %s\n" % self.DebugFormatInt32(self.entity_write_bytes_))
1356 return res
1358 kindex_writes = 1
1359 kindex_write_bytes = 2
1360 kentity_writes = 3
1361 kentity_write_bytes = 4
1363 _TEXT = (
1364 "ErrorCode",
1365 "index_writes",
1366 "index_write_bytes",
1367 "entity_writes",
1368 "entity_write_bytes",
1371 _TYPES = (
1372 ProtocolBuffer.Encoder.NUMERIC,
1373 ProtocolBuffer.Encoder.NUMERIC,
1375 ProtocolBuffer.Encoder.NUMERIC,
1377 ProtocolBuffer.Encoder.NUMERIC,
1379 ProtocolBuffer.Encoder.NUMERIC,
1383 _STYLE = """"""
1384 _STYLE_CONTENT_TYPE = """"""
1385 class GetRequest(ProtocolBuffer.ProtocolMessage):
1386 has_transaction_ = 0
1387 transaction_ = None
1389 def __init__(self, contents=None):
1390 self.key_ = []
1391 self.lazy_init_lock_ = thread.allocate_lock()
1392 if contents is not None: self.MergeFromString(contents)
1394 def key_size(self): return len(self.key_)
1395 def key_list(self): return self.key_
1397 def key(self, i):
1398 return self.key_[i]
1400 def mutable_key(self, i):
1401 return self.key_[i]
1403 def add_key(self):
1404 x = Reference()
1405 self.key_.append(x)
1406 return x
1408 def clear_key(self):
1409 self.key_ = []
1410 def transaction(self):
1411 if self.transaction_ is None:
1412 self.lazy_init_lock_.acquire()
1413 try:
1414 if self.transaction_ is None: self.transaction_ = Transaction()
1415 finally:
1416 self.lazy_init_lock_.release()
1417 return self.transaction_
1419 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
1421 def clear_transaction(self):
1422 if self.has_transaction_:
1423 self.has_transaction_ = 0;
1424 if self.transaction_ is not None: self.transaction_.Clear()
1426 def has_transaction(self): return self.has_transaction_
1429 def MergeFrom(self, x):
1430 assert x is not self
1431 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
1432 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
1434 def Equals(self, x):
1435 if x is self: return 1
1436 if len(self.key_) != len(x.key_): return 0
1437 for e1, e2 in zip(self.key_, x.key_):
1438 if e1 != e2: return 0
1439 if self.has_transaction_ != x.has_transaction_: return 0
1440 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
1441 return 1
1443 def IsInitialized(self, debug_strs=None):
1444 initialized = 1
1445 for p in self.key_:
1446 if not p.IsInitialized(debug_strs): initialized=0
1447 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
1448 return initialized
1450 def ByteSize(self):
1451 n = 0
1452 n += 1 * len(self.key_)
1453 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
1454 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
1455 return n + 0
1457 def Clear(self):
1458 self.clear_key()
1459 self.clear_transaction()
1461 def OutputUnchecked(self, out):
1462 for i in xrange(len(self.key_)):
1463 out.putVarInt32(10)
1464 out.putVarInt32(self.key_[i].ByteSize())
1465 self.key_[i].OutputUnchecked(out)
1466 if (self.has_transaction_):
1467 out.putVarInt32(18)
1468 out.putVarInt32(self.transaction_.ByteSize())
1469 self.transaction_.OutputUnchecked(out)
1471 def TryMerge(self, d):
1472 while d.avail() > 0:
1473 tt = d.getVarInt32()
1474 if tt == 10:
1475 length = d.getVarInt32()
1476 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1477 d.skip(length)
1478 self.add_key().TryMerge(tmp)
1479 continue
1480 if tt == 18:
1481 length = d.getVarInt32()
1482 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1483 d.skip(length)
1484 self.mutable_transaction().TryMerge(tmp)
1485 continue
1486 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1487 d.skipData(tt)
1490 def __str__(self, prefix="", printElemNumber=0):
1491 res=""
1492 cnt=0
1493 for e in self.key_:
1494 elm=""
1495 if printElemNumber: elm="(%d)" % cnt
1496 res+=prefix+("key%s <\n" % elm)
1497 res+=e.__str__(prefix + " ", printElemNumber)
1498 res+=prefix+">\n"
1499 cnt+=1
1500 if self.has_transaction_:
1501 res+=prefix+"transaction <\n"
1502 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
1503 res+=prefix+">\n"
1504 return res
1506 kkey = 1
1507 ktransaction = 2
1509 _TEXT = (
1510 "ErrorCode",
1511 "key",
1512 "transaction",
1515 _TYPES = (
1516 ProtocolBuffer.Encoder.NUMERIC,
1517 ProtocolBuffer.Encoder.STRING,
1519 ProtocolBuffer.Encoder.STRING,
1523 _STYLE = """"""
1524 _STYLE_CONTENT_TYPE = """"""
1525 class GetResponse_Entity(ProtocolBuffer.ProtocolMessage):
1526 has_entity_ = 0
1527 entity_ = None
1529 def __init__(self, contents=None):
1530 self.lazy_init_lock_ = thread.allocate_lock()
1531 if contents is not None: self.MergeFromString(contents)
1533 def entity(self):
1534 if self.entity_ is None:
1535 self.lazy_init_lock_.acquire()
1536 try:
1537 if self.entity_ is None: self.entity_ = EntityProto()
1538 finally:
1539 self.lazy_init_lock_.release()
1540 return self.entity_
1542 def mutable_entity(self): self.has_entity_ = 1; return self.entity()
1544 def clear_entity(self):
1545 if self.has_entity_:
1546 self.has_entity_ = 0;
1547 if self.entity_ is not None: self.entity_.Clear()
1549 def has_entity(self): return self.has_entity_
1552 def MergeFrom(self, x):
1553 assert x is not self
1554 if (x.has_entity()): self.mutable_entity().MergeFrom(x.entity())
1556 def Equals(self, x):
1557 if x is self: return 1
1558 if self.has_entity_ != x.has_entity_: return 0
1559 if self.has_entity_ and self.entity_ != x.entity_: return 0
1560 return 1
1562 def IsInitialized(self, debug_strs=None):
1563 initialized = 1
1564 if (self.has_entity_ and not self.entity_.IsInitialized(debug_strs)): initialized = 0
1565 return initialized
1567 def ByteSize(self):
1568 n = 0
1569 if (self.has_entity_): n += 1 + self.lengthString(self.entity_.ByteSize())
1570 return n + 0
1572 def Clear(self):
1573 self.clear_entity()
1575 def OutputUnchecked(self, out):
1576 if (self.has_entity_):
1577 out.putVarInt32(18)
1578 out.putVarInt32(self.entity_.ByteSize())
1579 self.entity_.OutputUnchecked(out)
1581 def TryMerge(self, d):
1582 while 1:
1583 tt = d.getVarInt32()
1584 if tt == 12: break
1585 if tt == 18:
1586 length = d.getVarInt32()
1587 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1588 d.skip(length)
1589 self.mutable_entity().TryMerge(tmp)
1590 continue
1591 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1592 d.skipData(tt)
1595 def __str__(self, prefix="", printElemNumber=0):
1596 res=""
1597 if self.has_entity_:
1598 res+=prefix+"entity <\n"
1599 res+=self.entity_.__str__(prefix + " ", printElemNumber)
1600 res+=prefix+">\n"
1601 return res
1603 class GetResponse(ProtocolBuffer.ProtocolMessage):
1605 def __init__(self, contents=None):
1606 self.entity_ = []
1607 if contents is not None: self.MergeFromString(contents)
1609 def entity_size(self): return len(self.entity_)
1610 def entity_list(self): return self.entity_
1612 def entity(self, i):
1613 return self.entity_[i]
1615 def mutable_entity(self, i):
1616 return self.entity_[i]
1618 def add_entity(self):
1619 x = GetResponse_Entity()
1620 self.entity_.append(x)
1621 return x
1623 def clear_entity(self):
1624 self.entity_ = []
1626 def MergeFrom(self, x):
1627 assert x is not self
1628 for i in xrange(x.entity_size()): self.add_entity().CopyFrom(x.entity(i))
1630 def Equals(self, x):
1631 if x is self: return 1
1632 if len(self.entity_) != len(x.entity_): return 0
1633 for e1, e2 in zip(self.entity_, x.entity_):
1634 if e1 != e2: return 0
1635 return 1
1637 def IsInitialized(self, debug_strs=None):
1638 initialized = 1
1639 for p in self.entity_:
1640 if not p.IsInitialized(debug_strs): initialized=0
1641 return initialized
1643 def ByteSize(self):
1644 n = 0
1645 n += 2 * len(self.entity_)
1646 for i in xrange(len(self.entity_)): n += self.entity_[i].ByteSize()
1647 return n + 0
1649 def Clear(self):
1650 self.clear_entity()
1652 def OutputUnchecked(self, out):
1653 for i in xrange(len(self.entity_)):
1654 out.putVarInt32(11)
1655 self.entity_[i].OutputUnchecked(out)
1656 out.putVarInt32(12)
1658 def TryMerge(self, d):
1659 while d.avail() > 0:
1660 tt = d.getVarInt32()
1661 if tt == 11:
1662 self.add_entity().TryMerge(d)
1663 continue
1664 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1665 d.skipData(tt)
1668 def __str__(self, prefix="", printElemNumber=0):
1669 res=""
1670 cnt=0
1671 for e in self.entity_:
1672 elm=""
1673 if printElemNumber: elm="(%d)" % cnt
1674 res+=prefix+("Entity%s {\n" % elm)
1675 res+=e.__str__(prefix + " ", printElemNumber)
1676 res+=prefix+"}\n"
1677 cnt+=1
1678 return res
1680 kEntityGroup = 1
1681 kEntityentity = 2
1683 _TEXT = (
1684 "ErrorCode",
1685 "Entity",
1686 "entity",
1689 _TYPES = (
1690 ProtocolBuffer.Encoder.NUMERIC,
1691 ProtocolBuffer.Encoder.STARTGROUP,
1693 ProtocolBuffer.Encoder.STRING,
1697 _STYLE = """"""
1698 _STYLE_CONTENT_TYPE = """"""
1699 class PutRequest(ProtocolBuffer.ProtocolMessage):
1700 has_transaction_ = 0
1701 transaction_ = None
1702 has_trusted_ = 0
1703 trusted_ = 0
1705 def __init__(self, contents=None):
1706 self.entity_ = []
1707 self.composite_index_ = []
1708 self.lazy_init_lock_ = thread.allocate_lock()
1709 if contents is not None: self.MergeFromString(contents)
1711 def entity_size(self): return len(self.entity_)
1712 def entity_list(self): return self.entity_
1714 def entity(self, i):
1715 return self.entity_[i]
1717 def mutable_entity(self, i):
1718 return self.entity_[i]
1720 def add_entity(self):
1721 x = EntityProto()
1722 self.entity_.append(x)
1723 return x
1725 def clear_entity(self):
1726 self.entity_ = []
1727 def transaction(self):
1728 if self.transaction_ is None:
1729 self.lazy_init_lock_.acquire()
1730 try:
1731 if self.transaction_ is None: self.transaction_ = Transaction()
1732 finally:
1733 self.lazy_init_lock_.release()
1734 return self.transaction_
1736 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
1738 def clear_transaction(self):
1739 if self.has_transaction_:
1740 self.has_transaction_ = 0;
1741 if self.transaction_ is not None: self.transaction_.Clear()
1743 def has_transaction(self): return self.has_transaction_
1745 def composite_index_size(self): return len(self.composite_index_)
1746 def composite_index_list(self): return self.composite_index_
1748 def composite_index(self, i):
1749 return self.composite_index_[i]
1751 def mutable_composite_index(self, i):
1752 return self.composite_index_[i]
1754 def add_composite_index(self):
1755 x = CompositeIndex()
1756 self.composite_index_.append(x)
1757 return x
1759 def clear_composite_index(self):
1760 self.composite_index_ = []
1761 def trusted(self): return self.trusted_
1763 def set_trusted(self, x):
1764 self.has_trusted_ = 1
1765 self.trusted_ = x
1767 def clear_trusted(self):
1768 if self.has_trusted_:
1769 self.has_trusted_ = 0
1770 self.trusted_ = 0
1772 def has_trusted(self): return self.has_trusted_
1775 def MergeFrom(self, x):
1776 assert x is not self
1777 for i in xrange(x.entity_size()): self.add_entity().CopyFrom(x.entity(i))
1778 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
1779 for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
1780 if (x.has_trusted()): self.set_trusted(x.trusted())
1782 def Equals(self, x):
1783 if x is self: return 1
1784 if len(self.entity_) != len(x.entity_): return 0
1785 for e1, e2 in zip(self.entity_, x.entity_):
1786 if e1 != e2: return 0
1787 if self.has_transaction_ != x.has_transaction_: return 0
1788 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
1789 if len(self.composite_index_) != len(x.composite_index_): return 0
1790 for e1, e2 in zip(self.composite_index_, x.composite_index_):
1791 if e1 != e2: return 0
1792 if self.has_trusted_ != x.has_trusted_: return 0
1793 if self.has_trusted_ and self.trusted_ != x.trusted_: return 0
1794 return 1
1796 def IsInitialized(self, debug_strs=None):
1797 initialized = 1
1798 for p in self.entity_:
1799 if not p.IsInitialized(debug_strs): initialized=0
1800 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
1801 for p in self.composite_index_:
1802 if not p.IsInitialized(debug_strs): initialized=0
1803 return initialized
1805 def ByteSize(self):
1806 n = 0
1807 n += 1 * len(self.entity_)
1808 for i in xrange(len(self.entity_)): n += self.lengthString(self.entity_[i].ByteSize())
1809 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
1810 n += 1 * len(self.composite_index_)
1811 for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
1812 if (self.has_trusted_): n += 2
1813 return n + 0
1815 def Clear(self):
1816 self.clear_entity()
1817 self.clear_transaction()
1818 self.clear_composite_index()
1819 self.clear_trusted()
1821 def OutputUnchecked(self, out):
1822 for i in xrange(len(self.entity_)):
1823 out.putVarInt32(10)
1824 out.putVarInt32(self.entity_[i].ByteSize())
1825 self.entity_[i].OutputUnchecked(out)
1826 if (self.has_transaction_):
1827 out.putVarInt32(18)
1828 out.putVarInt32(self.transaction_.ByteSize())
1829 self.transaction_.OutputUnchecked(out)
1830 for i in xrange(len(self.composite_index_)):
1831 out.putVarInt32(26)
1832 out.putVarInt32(self.composite_index_[i].ByteSize())
1833 self.composite_index_[i].OutputUnchecked(out)
1834 if (self.has_trusted_):
1835 out.putVarInt32(32)
1836 out.putBoolean(self.trusted_)
1838 def TryMerge(self, d):
1839 while d.avail() > 0:
1840 tt = d.getVarInt32()
1841 if tt == 10:
1842 length = d.getVarInt32()
1843 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1844 d.skip(length)
1845 self.add_entity().TryMerge(tmp)
1846 continue
1847 if tt == 18:
1848 length = d.getVarInt32()
1849 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1850 d.skip(length)
1851 self.mutable_transaction().TryMerge(tmp)
1852 continue
1853 if tt == 26:
1854 length = d.getVarInt32()
1855 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1856 d.skip(length)
1857 self.add_composite_index().TryMerge(tmp)
1858 continue
1859 if tt == 32:
1860 self.set_trusted(d.getBoolean())
1861 continue
1862 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1863 d.skipData(tt)
1866 def __str__(self, prefix="", printElemNumber=0):
1867 res=""
1868 cnt=0
1869 for e in self.entity_:
1870 elm=""
1871 if printElemNumber: elm="(%d)" % cnt
1872 res+=prefix+("entity%s <\n" % elm)
1873 res+=e.__str__(prefix + " ", printElemNumber)
1874 res+=prefix+">\n"
1875 cnt+=1
1876 if self.has_transaction_:
1877 res+=prefix+"transaction <\n"
1878 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
1879 res+=prefix+">\n"
1880 cnt=0
1881 for e in self.composite_index_:
1882 elm=""
1883 if printElemNumber: elm="(%d)" % cnt
1884 res+=prefix+("composite_index%s <\n" % elm)
1885 res+=e.__str__(prefix + " ", printElemNumber)
1886 res+=prefix+">\n"
1887 cnt+=1
1888 if self.has_trusted_: res+=prefix+("trusted: %s\n" % self.DebugFormatBool(self.trusted_))
1889 return res
1891 kentity = 1
1892 ktransaction = 2
1893 kcomposite_index = 3
1894 ktrusted = 4
1896 _TEXT = (
1897 "ErrorCode",
1898 "entity",
1899 "transaction",
1900 "composite_index",
1901 "trusted",
1904 _TYPES = (
1905 ProtocolBuffer.Encoder.NUMERIC,
1906 ProtocolBuffer.Encoder.STRING,
1908 ProtocolBuffer.Encoder.STRING,
1910 ProtocolBuffer.Encoder.STRING,
1912 ProtocolBuffer.Encoder.NUMERIC,
1916 _STYLE = """"""
1917 _STYLE_CONTENT_TYPE = """"""
1918 class PutResponse(ProtocolBuffer.ProtocolMessage):
1919 has_cost_ = 0
1920 cost_ = None
1922 def __init__(self, contents=None):
1923 self.key_ = []
1924 self.lazy_init_lock_ = thread.allocate_lock()
1925 if contents is not None: self.MergeFromString(contents)
1927 def key_size(self): return len(self.key_)
1928 def key_list(self): return self.key_
1930 def key(self, i):
1931 return self.key_[i]
1933 def mutable_key(self, i):
1934 return self.key_[i]
1936 def add_key(self):
1937 x = Reference()
1938 self.key_.append(x)
1939 return x
1941 def clear_key(self):
1942 self.key_ = []
1943 def cost(self):
1944 if self.cost_ is None:
1945 self.lazy_init_lock_.acquire()
1946 try:
1947 if self.cost_ is None: self.cost_ = Cost()
1948 finally:
1949 self.lazy_init_lock_.release()
1950 return self.cost_
1952 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
1954 def clear_cost(self):
1955 if self.has_cost_:
1956 self.has_cost_ = 0;
1957 if self.cost_ is not None: self.cost_.Clear()
1959 def has_cost(self): return self.has_cost_
1962 def MergeFrom(self, x):
1963 assert x is not self
1964 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
1965 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
1967 def Equals(self, x):
1968 if x is self: return 1
1969 if len(self.key_) != len(x.key_): return 0
1970 for e1, e2 in zip(self.key_, x.key_):
1971 if e1 != e2: return 0
1972 if self.has_cost_ != x.has_cost_: return 0
1973 if self.has_cost_ and self.cost_ != x.cost_: return 0
1974 return 1
1976 def IsInitialized(self, debug_strs=None):
1977 initialized = 1
1978 for p in self.key_:
1979 if not p.IsInitialized(debug_strs): initialized=0
1980 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
1981 return initialized
1983 def ByteSize(self):
1984 n = 0
1985 n += 1 * len(self.key_)
1986 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
1987 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
1988 return n + 0
1990 def Clear(self):
1991 self.clear_key()
1992 self.clear_cost()
1994 def OutputUnchecked(self, out):
1995 for i in xrange(len(self.key_)):
1996 out.putVarInt32(10)
1997 out.putVarInt32(self.key_[i].ByteSize())
1998 self.key_[i].OutputUnchecked(out)
1999 if (self.has_cost_):
2000 out.putVarInt32(18)
2001 out.putVarInt32(self.cost_.ByteSize())
2002 self.cost_.OutputUnchecked(out)
2004 def TryMerge(self, d):
2005 while d.avail() > 0:
2006 tt = d.getVarInt32()
2007 if tt == 10:
2008 length = d.getVarInt32()
2009 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2010 d.skip(length)
2011 self.add_key().TryMerge(tmp)
2012 continue
2013 if tt == 18:
2014 length = d.getVarInt32()
2015 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2016 d.skip(length)
2017 self.mutable_cost().TryMerge(tmp)
2018 continue
2019 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2020 d.skipData(tt)
2023 def __str__(self, prefix="", printElemNumber=0):
2024 res=""
2025 cnt=0
2026 for e in self.key_:
2027 elm=""
2028 if printElemNumber: elm="(%d)" % cnt
2029 res+=prefix+("key%s <\n" % elm)
2030 res+=e.__str__(prefix + " ", printElemNumber)
2031 res+=prefix+">\n"
2032 cnt+=1
2033 if self.has_cost_:
2034 res+=prefix+"cost <\n"
2035 res+=self.cost_.__str__(prefix + " ", printElemNumber)
2036 res+=prefix+">\n"
2037 return res
2039 kkey = 1
2040 kcost = 2
2042 _TEXT = (
2043 "ErrorCode",
2044 "key",
2045 "cost",
2048 _TYPES = (
2049 ProtocolBuffer.Encoder.NUMERIC,
2050 ProtocolBuffer.Encoder.STRING,
2052 ProtocolBuffer.Encoder.STRING,
2056 _STYLE = """"""
2057 _STYLE_CONTENT_TYPE = """"""
2058 class DeleteRequest(ProtocolBuffer.ProtocolMessage):
2059 has_transaction_ = 0
2060 transaction_ = None
2061 has_trusted_ = 0
2062 trusted_ = 0
2064 def __init__(self, contents=None):
2065 self.key_ = []
2066 self.lazy_init_lock_ = thread.allocate_lock()
2067 if contents is not None: self.MergeFromString(contents)
2069 def key_size(self): return len(self.key_)
2070 def key_list(self): return self.key_
2072 def key(self, i):
2073 return self.key_[i]
2075 def mutable_key(self, i):
2076 return self.key_[i]
2078 def add_key(self):
2079 x = Reference()
2080 self.key_.append(x)
2081 return x
2083 def clear_key(self):
2084 self.key_ = []
2085 def transaction(self):
2086 if self.transaction_ is None:
2087 self.lazy_init_lock_.acquire()
2088 try:
2089 if self.transaction_ is None: self.transaction_ = Transaction()
2090 finally:
2091 self.lazy_init_lock_.release()
2092 return self.transaction_
2094 def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
2096 def clear_transaction(self):
2097 if self.has_transaction_:
2098 self.has_transaction_ = 0;
2099 if self.transaction_ is not None: self.transaction_.Clear()
2101 def has_transaction(self): return self.has_transaction_
2103 def trusted(self): return self.trusted_
2105 def set_trusted(self, x):
2106 self.has_trusted_ = 1
2107 self.trusted_ = x
2109 def clear_trusted(self):
2110 if self.has_trusted_:
2111 self.has_trusted_ = 0
2112 self.trusted_ = 0
2114 def has_trusted(self): return self.has_trusted_
2117 def MergeFrom(self, x):
2118 assert x is not self
2119 for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
2120 if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
2121 if (x.has_trusted()): self.set_trusted(x.trusted())
2123 def Equals(self, x):
2124 if x is self: return 1
2125 if len(self.key_) != len(x.key_): return 0
2126 for e1, e2 in zip(self.key_, x.key_):
2127 if e1 != e2: return 0
2128 if self.has_transaction_ != x.has_transaction_: return 0
2129 if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
2130 if self.has_trusted_ != x.has_trusted_: return 0
2131 if self.has_trusted_ and self.trusted_ != x.trusted_: return 0
2132 return 1
2134 def IsInitialized(self, debug_strs=None):
2135 initialized = 1
2136 for p in self.key_:
2137 if not p.IsInitialized(debug_strs): initialized=0
2138 if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
2139 return initialized
2141 def ByteSize(self):
2142 n = 0
2143 n += 1 * len(self.key_)
2144 for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
2145 if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
2146 if (self.has_trusted_): n += 2
2147 return n + 0
2149 def Clear(self):
2150 self.clear_key()
2151 self.clear_transaction()
2152 self.clear_trusted()
2154 def OutputUnchecked(self, out):
2155 if (self.has_trusted_):
2156 out.putVarInt32(32)
2157 out.putBoolean(self.trusted_)
2158 if (self.has_transaction_):
2159 out.putVarInt32(42)
2160 out.putVarInt32(self.transaction_.ByteSize())
2161 self.transaction_.OutputUnchecked(out)
2162 for i in xrange(len(self.key_)):
2163 out.putVarInt32(50)
2164 out.putVarInt32(self.key_[i].ByteSize())
2165 self.key_[i].OutputUnchecked(out)
2167 def TryMerge(self, d):
2168 while d.avail() > 0:
2169 tt = d.getVarInt32()
2170 if tt == 32:
2171 self.set_trusted(d.getBoolean())
2172 continue
2173 if tt == 42:
2174 length = d.getVarInt32()
2175 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2176 d.skip(length)
2177 self.mutable_transaction().TryMerge(tmp)
2178 continue
2179 if tt == 50:
2180 length = d.getVarInt32()
2181 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2182 d.skip(length)
2183 self.add_key().TryMerge(tmp)
2184 continue
2185 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2186 d.skipData(tt)
2189 def __str__(self, prefix="", printElemNumber=0):
2190 res=""
2191 cnt=0
2192 for e in self.key_:
2193 elm=""
2194 if printElemNumber: elm="(%d)" % cnt
2195 res+=prefix+("key%s <\n" % elm)
2196 res+=e.__str__(prefix + " ", printElemNumber)
2197 res+=prefix+">\n"
2198 cnt+=1
2199 if self.has_transaction_:
2200 res+=prefix+"transaction <\n"
2201 res+=self.transaction_.__str__(prefix + " ", printElemNumber)
2202 res+=prefix+">\n"
2203 if self.has_trusted_: res+=prefix+("trusted: %s\n" % self.DebugFormatBool(self.trusted_))
2204 return res
2206 kkey = 6
2207 ktransaction = 5
2208 ktrusted = 4
2210 _TEXT = (
2211 "ErrorCode",
2212 None,
2213 None,
2214 None,
2215 "trusted",
2216 "transaction",
2217 "key",
2220 _TYPES = (
2221 ProtocolBuffer.Encoder.NUMERIC,
2222 ProtocolBuffer.Encoder.MAX_TYPE,
2224 ProtocolBuffer.Encoder.MAX_TYPE,
2226 ProtocolBuffer.Encoder.MAX_TYPE,
2228 ProtocolBuffer.Encoder.NUMERIC,
2230 ProtocolBuffer.Encoder.STRING,
2232 ProtocolBuffer.Encoder.STRING,
2236 _STYLE = """"""
2237 _STYLE_CONTENT_TYPE = """"""
2238 class DeleteResponse(ProtocolBuffer.ProtocolMessage):
2239 has_cost_ = 0
2240 cost_ = None
2242 def __init__(self, contents=None):
2243 self.lazy_init_lock_ = thread.allocate_lock()
2244 if contents is not None: self.MergeFromString(contents)
2246 def cost(self):
2247 if self.cost_ is None:
2248 self.lazy_init_lock_.acquire()
2249 try:
2250 if self.cost_ is None: self.cost_ = Cost()
2251 finally:
2252 self.lazy_init_lock_.release()
2253 return self.cost_
2255 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
2257 def clear_cost(self):
2258 if self.has_cost_:
2259 self.has_cost_ = 0;
2260 if self.cost_ is not None: self.cost_.Clear()
2262 def has_cost(self): return self.has_cost_
2265 def MergeFrom(self, x):
2266 assert x is not self
2267 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
2269 def Equals(self, x):
2270 if x is self: return 1
2271 if self.has_cost_ != x.has_cost_: return 0
2272 if self.has_cost_ and self.cost_ != x.cost_: return 0
2273 return 1
2275 def IsInitialized(self, debug_strs=None):
2276 initialized = 1
2277 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
2278 return initialized
2280 def ByteSize(self):
2281 n = 0
2282 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
2283 return n + 0
2285 def Clear(self):
2286 self.clear_cost()
2288 def OutputUnchecked(self, out):
2289 if (self.has_cost_):
2290 out.putVarInt32(10)
2291 out.putVarInt32(self.cost_.ByteSize())
2292 self.cost_.OutputUnchecked(out)
2294 def TryMerge(self, d):
2295 while d.avail() > 0:
2296 tt = d.getVarInt32()
2297 if tt == 10:
2298 length = d.getVarInt32()
2299 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2300 d.skip(length)
2301 self.mutable_cost().TryMerge(tmp)
2302 continue
2303 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2304 d.skipData(tt)
2307 def __str__(self, prefix="", printElemNumber=0):
2308 res=""
2309 if self.has_cost_:
2310 res+=prefix+"cost <\n"
2311 res+=self.cost_.__str__(prefix + " ", printElemNumber)
2312 res+=prefix+">\n"
2313 return res
2315 kcost = 1
2317 _TEXT = (
2318 "ErrorCode",
2319 "cost",
2322 _TYPES = (
2323 ProtocolBuffer.Encoder.NUMERIC,
2324 ProtocolBuffer.Encoder.STRING,
2328 _STYLE = """"""
2329 _STYLE_CONTENT_TYPE = """"""
2330 class NextRequest(ProtocolBuffer.ProtocolMessage):
2331 has_cursor_ = 0
2332 has_count_ = 0
2333 count_ = 1
2335 def __init__(self, contents=None):
2336 self.cursor_ = Cursor()
2337 if contents is not None: self.MergeFromString(contents)
2339 def cursor(self): return self.cursor_
2341 def mutable_cursor(self): self.has_cursor_ = 1; return self.cursor_
2343 def clear_cursor(self):self.has_cursor_ = 0; self.cursor_.Clear()
2345 def has_cursor(self): return self.has_cursor_
2347 def count(self): return self.count_
2349 def set_count(self, x):
2350 self.has_count_ = 1
2351 self.count_ = x
2353 def clear_count(self):
2354 if self.has_count_:
2355 self.has_count_ = 0
2356 self.count_ = 1
2358 def has_count(self): return self.has_count_
2361 def MergeFrom(self, x):
2362 assert x is not self
2363 if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor())
2364 if (x.has_count()): self.set_count(x.count())
2366 def Equals(self, x):
2367 if x is self: return 1
2368 if self.has_cursor_ != x.has_cursor_: return 0
2369 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
2370 if self.has_count_ != x.has_count_: return 0
2371 if self.has_count_ and self.count_ != x.count_: return 0
2372 return 1
2374 def IsInitialized(self, debug_strs=None):
2375 initialized = 1
2376 if (not self.has_cursor_):
2377 initialized = 0
2378 if debug_strs is not None:
2379 debug_strs.append('Required field: cursor not set.')
2380 elif not self.cursor_.IsInitialized(debug_strs): initialized = 0
2381 return initialized
2383 def ByteSize(self):
2384 n = 0
2385 n += self.lengthString(self.cursor_.ByteSize())
2386 if (self.has_count_): n += 1 + self.lengthVarInt64(self.count_)
2387 return n + 1
2389 def Clear(self):
2390 self.clear_cursor()
2391 self.clear_count()
2393 def OutputUnchecked(self, out):
2394 out.putVarInt32(10)
2395 out.putVarInt32(self.cursor_.ByteSize())
2396 self.cursor_.OutputUnchecked(out)
2397 if (self.has_count_):
2398 out.putVarInt32(16)
2399 out.putVarInt32(self.count_)
2401 def TryMerge(self, d):
2402 while d.avail() > 0:
2403 tt = d.getVarInt32()
2404 if tt == 10:
2405 length = d.getVarInt32()
2406 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2407 d.skip(length)
2408 self.mutable_cursor().TryMerge(tmp)
2409 continue
2410 if tt == 16:
2411 self.set_count(d.getVarInt32())
2412 continue
2413 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2414 d.skipData(tt)
2417 def __str__(self, prefix="", printElemNumber=0):
2418 res=""
2419 if self.has_cursor_:
2420 res+=prefix+"cursor <\n"
2421 res+=self.cursor_.__str__(prefix + " ", printElemNumber)
2422 res+=prefix+">\n"
2423 if self.has_count_: res+=prefix+("count: %s\n" % self.DebugFormatInt32(self.count_))
2424 return res
2426 kcursor = 1
2427 kcount = 2
2429 _TEXT = (
2430 "ErrorCode",
2431 "cursor",
2432 "count",
2435 _TYPES = (
2436 ProtocolBuffer.Encoder.NUMERIC,
2437 ProtocolBuffer.Encoder.STRING,
2439 ProtocolBuffer.Encoder.NUMERIC,
2443 _STYLE = """"""
2444 _STYLE_CONTENT_TYPE = """"""
2445 class QueryResult(ProtocolBuffer.ProtocolMessage):
2446 has_cursor_ = 0
2447 cursor_ = None
2448 has_more_results_ = 0
2449 more_results_ = 0
2450 has_keys_only_ = 0
2451 keys_only_ = 0
2453 def __init__(self, contents=None):
2454 self.result_ = []
2455 self.lazy_init_lock_ = thread.allocate_lock()
2456 if contents is not None: self.MergeFromString(contents)
2458 def cursor(self):
2459 if self.cursor_ is None:
2460 self.lazy_init_lock_.acquire()
2461 try:
2462 if self.cursor_ is None: self.cursor_ = Cursor()
2463 finally:
2464 self.lazy_init_lock_.release()
2465 return self.cursor_
2467 def mutable_cursor(self): self.has_cursor_ = 1; return self.cursor()
2469 def clear_cursor(self):
2470 if self.has_cursor_:
2471 self.has_cursor_ = 0;
2472 if self.cursor_ is not None: self.cursor_.Clear()
2474 def has_cursor(self): return self.has_cursor_
2476 def result_size(self): return len(self.result_)
2477 def result_list(self): return self.result_
2479 def result(self, i):
2480 return self.result_[i]
2482 def mutable_result(self, i):
2483 return self.result_[i]
2485 def add_result(self):
2486 x = EntityProto()
2487 self.result_.append(x)
2488 return x
2490 def clear_result(self):
2491 self.result_ = []
2492 def more_results(self): return self.more_results_
2494 def set_more_results(self, x):
2495 self.has_more_results_ = 1
2496 self.more_results_ = x
2498 def clear_more_results(self):
2499 if self.has_more_results_:
2500 self.has_more_results_ = 0
2501 self.more_results_ = 0
2503 def has_more_results(self): return self.has_more_results_
2505 def keys_only(self): return self.keys_only_
2507 def set_keys_only(self, x):
2508 self.has_keys_only_ = 1
2509 self.keys_only_ = x
2511 def clear_keys_only(self):
2512 if self.has_keys_only_:
2513 self.has_keys_only_ = 0
2514 self.keys_only_ = 0
2516 def has_keys_only(self): return self.has_keys_only_
2519 def MergeFrom(self, x):
2520 assert x is not self
2521 if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor())
2522 for i in xrange(x.result_size()): self.add_result().CopyFrom(x.result(i))
2523 if (x.has_more_results()): self.set_more_results(x.more_results())
2524 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
2526 def Equals(self, x):
2527 if x is self: return 1
2528 if self.has_cursor_ != x.has_cursor_: return 0
2529 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
2530 if len(self.result_) != len(x.result_): return 0
2531 for e1, e2 in zip(self.result_, x.result_):
2532 if e1 != e2: return 0
2533 if self.has_more_results_ != x.has_more_results_: return 0
2534 if self.has_more_results_ and self.more_results_ != x.more_results_: return 0
2535 if self.has_keys_only_ != x.has_keys_only_: return 0
2536 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
2537 return 1
2539 def IsInitialized(self, debug_strs=None):
2540 initialized = 1
2541 if (self.has_cursor_ and not self.cursor_.IsInitialized(debug_strs)): initialized = 0
2542 for p in self.result_:
2543 if not p.IsInitialized(debug_strs): initialized=0
2544 if (not self.has_more_results_):
2545 initialized = 0
2546 if debug_strs is not None:
2547 debug_strs.append('Required field: more_results not set.')
2548 return initialized
2550 def ByteSize(self):
2551 n = 0
2552 if (self.has_cursor_): n += 1 + self.lengthString(self.cursor_.ByteSize())
2553 n += 1 * len(self.result_)
2554 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSize())
2555 if (self.has_keys_only_): n += 2
2556 return n + 2
2558 def Clear(self):
2559 self.clear_cursor()
2560 self.clear_result()
2561 self.clear_more_results()
2562 self.clear_keys_only()
2564 def OutputUnchecked(self, out):
2565 if (self.has_cursor_):
2566 out.putVarInt32(10)
2567 out.putVarInt32(self.cursor_.ByteSize())
2568 self.cursor_.OutputUnchecked(out)
2569 for i in xrange(len(self.result_)):
2570 out.putVarInt32(18)
2571 out.putVarInt32(self.result_[i].ByteSize())
2572 self.result_[i].OutputUnchecked(out)
2573 out.putVarInt32(24)
2574 out.putBoolean(self.more_results_)
2575 if (self.has_keys_only_):
2576 out.putVarInt32(32)
2577 out.putBoolean(self.keys_only_)
2579 def TryMerge(self, d):
2580 while d.avail() > 0:
2581 tt = d.getVarInt32()
2582 if tt == 10:
2583 length = d.getVarInt32()
2584 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2585 d.skip(length)
2586 self.mutable_cursor().TryMerge(tmp)
2587 continue
2588 if tt == 18:
2589 length = d.getVarInt32()
2590 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2591 d.skip(length)
2592 self.add_result().TryMerge(tmp)
2593 continue
2594 if tt == 24:
2595 self.set_more_results(d.getBoolean())
2596 continue
2597 if tt == 32:
2598 self.set_keys_only(d.getBoolean())
2599 continue
2600 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2601 d.skipData(tt)
2604 def __str__(self, prefix="", printElemNumber=0):
2605 res=""
2606 if self.has_cursor_:
2607 res+=prefix+"cursor <\n"
2608 res+=self.cursor_.__str__(prefix + " ", printElemNumber)
2609 res+=prefix+">\n"
2610 cnt=0
2611 for e in self.result_:
2612 elm=""
2613 if printElemNumber: elm="(%d)" % cnt
2614 res+=prefix+("result%s <\n" % elm)
2615 res+=e.__str__(prefix + " ", printElemNumber)
2616 res+=prefix+">\n"
2617 cnt+=1
2618 if self.has_more_results_: res+=prefix+("more_results: %s\n" % self.DebugFormatBool(self.more_results_))
2619 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
2620 return res
2622 kcursor = 1
2623 kresult = 2
2624 kmore_results = 3
2625 kkeys_only = 4
2627 _TEXT = (
2628 "ErrorCode",
2629 "cursor",
2630 "result",
2631 "more_results",
2632 "keys_only",
2635 _TYPES = (
2636 ProtocolBuffer.Encoder.NUMERIC,
2637 ProtocolBuffer.Encoder.STRING,
2639 ProtocolBuffer.Encoder.STRING,
2641 ProtocolBuffer.Encoder.NUMERIC,
2643 ProtocolBuffer.Encoder.NUMERIC,
2647 _STYLE = """"""
2648 _STYLE_CONTENT_TYPE = """"""
2649 class Schema(ProtocolBuffer.ProtocolMessage):
2651 def __init__(self, contents=None):
2652 self.kind_ = []
2653 if contents is not None: self.MergeFromString(contents)
2655 def kind_size(self): return len(self.kind_)
2656 def kind_list(self): return self.kind_
2658 def kind(self, i):
2659 return self.kind_[i]
2661 def mutable_kind(self, i):
2662 return self.kind_[i]
2664 def add_kind(self):
2665 x = EntityProto()
2666 self.kind_.append(x)
2667 return x
2669 def clear_kind(self):
2670 self.kind_ = []
2672 def MergeFrom(self, x):
2673 assert x is not self
2674 for i in xrange(x.kind_size()): self.add_kind().CopyFrom(x.kind(i))
2676 def Equals(self, x):
2677 if x is self: return 1
2678 if len(self.kind_) != len(x.kind_): return 0
2679 for e1, e2 in zip(self.kind_, x.kind_):
2680 if e1 != e2: return 0
2681 return 1
2683 def IsInitialized(self, debug_strs=None):
2684 initialized = 1
2685 for p in self.kind_:
2686 if not p.IsInitialized(debug_strs): initialized=0
2687 return initialized
2689 def ByteSize(self):
2690 n = 0
2691 n += 1 * len(self.kind_)
2692 for i in xrange(len(self.kind_)): n += self.lengthString(self.kind_[i].ByteSize())
2693 return n + 0
2695 def Clear(self):
2696 self.clear_kind()
2698 def OutputUnchecked(self, out):
2699 for i in xrange(len(self.kind_)):
2700 out.putVarInt32(10)
2701 out.putVarInt32(self.kind_[i].ByteSize())
2702 self.kind_[i].OutputUnchecked(out)
2704 def TryMerge(self, d):
2705 while d.avail() > 0:
2706 tt = d.getVarInt32()
2707 if tt == 10:
2708 length = d.getVarInt32()
2709 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2710 d.skip(length)
2711 self.add_kind().TryMerge(tmp)
2712 continue
2713 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2714 d.skipData(tt)
2717 def __str__(self, prefix="", printElemNumber=0):
2718 res=""
2719 cnt=0
2720 for e in self.kind_:
2721 elm=""
2722 if printElemNumber: elm="(%d)" % cnt
2723 res+=prefix+("kind%s <\n" % elm)
2724 res+=e.__str__(prefix + " ", printElemNumber)
2725 res+=prefix+">\n"
2726 cnt+=1
2727 return res
2729 kkind = 1
2731 _TEXT = (
2732 "ErrorCode",
2733 "kind",
2736 _TYPES = (
2737 ProtocolBuffer.Encoder.NUMERIC,
2738 ProtocolBuffer.Encoder.STRING,
2742 _STYLE = """"""
2743 _STYLE_CONTENT_TYPE = """"""
2744 class CompositeIndices(ProtocolBuffer.ProtocolMessage):
2746 def __init__(self, contents=None):
2747 self.index_ = []
2748 if contents is not None: self.MergeFromString(contents)
2750 def index_size(self): return len(self.index_)
2751 def index_list(self): return self.index_
2753 def index(self, i):
2754 return self.index_[i]
2756 def mutable_index(self, i):
2757 return self.index_[i]
2759 def add_index(self):
2760 x = CompositeIndex()
2761 self.index_.append(x)
2762 return x
2764 def clear_index(self):
2765 self.index_ = []
2767 def MergeFrom(self, x):
2768 assert x is not self
2769 for i in xrange(x.index_size()): self.add_index().CopyFrom(x.index(i))
2771 def Equals(self, x):
2772 if x is self: return 1
2773 if len(self.index_) != len(x.index_): return 0
2774 for e1, e2 in zip(self.index_, x.index_):
2775 if e1 != e2: return 0
2776 return 1
2778 def IsInitialized(self, debug_strs=None):
2779 initialized = 1
2780 for p in self.index_:
2781 if not p.IsInitialized(debug_strs): initialized=0
2782 return initialized
2784 def ByteSize(self):
2785 n = 0
2786 n += 1 * len(self.index_)
2787 for i in xrange(len(self.index_)): n += self.lengthString(self.index_[i].ByteSize())
2788 return n + 0
2790 def Clear(self):
2791 self.clear_index()
2793 def OutputUnchecked(self, out):
2794 for i in xrange(len(self.index_)):
2795 out.putVarInt32(10)
2796 out.putVarInt32(self.index_[i].ByteSize())
2797 self.index_[i].OutputUnchecked(out)
2799 def TryMerge(self, d):
2800 while d.avail() > 0:
2801 tt = d.getVarInt32()
2802 if tt == 10:
2803 length = d.getVarInt32()
2804 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2805 d.skip(length)
2806 self.add_index().TryMerge(tmp)
2807 continue
2808 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2809 d.skipData(tt)
2812 def __str__(self, prefix="", printElemNumber=0):
2813 res=""
2814 cnt=0
2815 for e in self.index_:
2816 elm=""
2817 if printElemNumber: elm="(%d)" % cnt
2818 res+=prefix+("index%s <\n" % elm)
2819 res+=e.__str__(prefix + " ", printElemNumber)
2820 res+=prefix+">\n"
2821 cnt+=1
2822 return res
2824 kindex = 1
2826 _TEXT = (
2827 "ErrorCode",
2828 "index",
2831 _TYPES = (
2832 ProtocolBuffer.Encoder.NUMERIC,
2833 ProtocolBuffer.Encoder.STRING,
2837 _STYLE = """"""
2838 _STYLE_CONTENT_TYPE = """"""
2839 class CommitResponse(ProtocolBuffer.ProtocolMessage):
2840 has_cost_ = 0
2841 cost_ = None
2843 def __init__(self, contents=None):
2844 self.lazy_init_lock_ = thread.allocate_lock()
2845 if contents is not None: self.MergeFromString(contents)
2847 def cost(self):
2848 if self.cost_ is None:
2849 self.lazy_init_lock_.acquire()
2850 try:
2851 if self.cost_ is None: self.cost_ = Cost()
2852 finally:
2853 self.lazy_init_lock_.release()
2854 return self.cost_
2856 def mutable_cost(self): self.has_cost_ = 1; return self.cost()
2858 def clear_cost(self):
2859 if self.has_cost_:
2860 self.has_cost_ = 0;
2861 if self.cost_ is not None: self.cost_.Clear()
2863 def has_cost(self): return self.has_cost_
2866 def MergeFrom(self, x):
2867 assert x is not self
2868 if (x.has_cost()): self.mutable_cost().MergeFrom(x.cost())
2870 def Equals(self, x):
2871 if x is self: return 1
2872 if self.has_cost_ != x.has_cost_: return 0
2873 if self.has_cost_ and self.cost_ != x.cost_: return 0
2874 return 1
2876 def IsInitialized(self, debug_strs=None):
2877 initialized = 1
2878 if (self.has_cost_ and not self.cost_.IsInitialized(debug_strs)): initialized = 0
2879 return initialized
2881 def ByteSize(self):
2882 n = 0
2883 if (self.has_cost_): n += 1 + self.lengthString(self.cost_.ByteSize())
2884 return n + 0
2886 def Clear(self):
2887 self.clear_cost()
2889 def OutputUnchecked(self, out):
2890 if (self.has_cost_):
2891 out.putVarInt32(10)
2892 out.putVarInt32(self.cost_.ByteSize())
2893 self.cost_.OutputUnchecked(out)
2895 def TryMerge(self, d):
2896 while d.avail() > 0:
2897 tt = d.getVarInt32()
2898 if tt == 10:
2899 length = d.getVarInt32()
2900 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2901 d.skip(length)
2902 self.mutable_cost().TryMerge(tmp)
2903 continue
2904 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2905 d.skipData(tt)
2908 def __str__(self, prefix="", printElemNumber=0):
2909 res=""
2910 if self.has_cost_:
2911 res+=prefix+"cost <\n"
2912 res+=self.cost_.__str__(prefix + " ", printElemNumber)
2913 res+=prefix+">\n"
2914 return res
2916 kcost = 1
2918 _TEXT = (
2919 "ErrorCode",
2920 "cost",
2923 _TYPES = (
2924 ProtocolBuffer.Encoder.NUMERIC,
2925 ProtocolBuffer.Encoder.STRING,
2929 _STYLE = """"""
2930 _STYLE_CONTENT_TYPE = """"""
2932 __all__ = ['Transaction','Query','Query_Filter','Query_Order','QueryExplanation','Cursor','Error','Cost','GetRequest','GetResponse','GetResponse_Entity','PutRequest','PutResponse','DeleteRequest','DeleteResponse','NextRequest','QueryResult','Schema','CompositeIndices','CommitResponse']