App Engine Python SDK version 1.8.1
[gae.git] / python / google / appengine / api / search / search_service_pb.py
blob2c22b587119e17822fc99e834fd64fefd97df2fd
1 #!/usr/bin/env python
3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from google.net.proto import ProtocolBuffer
21 import array
22 import dummy_thread as thread
24 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
25 unusednames=printElemNumber,debug_strs no-special"""
27 if hasattr(ProtocolBuffer, 'ExtendableProtocolMessage'):
28 _extension_runtime = True
29 _ExtendableProtocolMessage = ProtocolBuffer.ExtendableProtocolMessage
30 else:
31 _extension_runtime = False
32 _ExtendableProtocolMessage = ProtocolBuffer.ProtocolMessage
34 from google.appengine.datastore.document_pb import *
35 import google.appengine.datastore.document_pb
36 class SearchServiceError(ProtocolBuffer.ProtocolMessage):
39 OK = 0
40 INVALID_REQUEST = 1
41 TRANSIENT_ERROR = 2
42 INTERNAL_ERROR = 3
43 PERMISSION_DENIED = 4
45 _ErrorCode_NAMES = {
46 0: "OK",
47 1: "INVALID_REQUEST",
48 2: "TRANSIENT_ERROR",
49 3: "INTERNAL_ERROR",
50 4: "PERMISSION_DENIED",
53 def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "")
54 ErrorCode_Name = classmethod(ErrorCode_Name)
57 def __init__(self, contents=None):
58 pass
59 if contents is not None: self.MergeFromString(contents)
62 def MergeFrom(self, x):
63 assert x is not self
65 def Equals(self, x):
66 if x is self: return 1
67 return 1
69 def IsInitialized(self, debug_strs=None):
70 initialized = 1
71 return initialized
73 def ByteSize(self):
74 n = 0
75 return n
77 def ByteSizePartial(self):
78 n = 0
79 return n
81 def Clear(self):
82 pass
84 def OutputUnchecked(self, out):
85 pass
87 def OutputPartial(self, out):
88 pass
90 def TryMerge(self, d):
91 while d.avail() > 0:
92 tt = d.getVarInt32()
95 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
96 d.skipData(tt)
99 def __str__(self, prefix="", printElemNumber=0):
100 res=""
101 return res
104 def _BuildTagLookupTable(sparse, maxtag, default=None):
105 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
108 _TEXT = _BuildTagLookupTable({
109 0: "ErrorCode",
110 }, 0)
112 _TYPES = _BuildTagLookupTable({
113 0: ProtocolBuffer.Encoder.NUMERIC,
114 }, 0, ProtocolBuffer.Encoder.MAX_TYPE)
117 _STYLE = """"""
118 _STYLE_CONTENT_TYPE = """"""
119 _PROTO_DESCRIPTOR_NAME = 'apphosting.SearchServiceError'
120 class RequestStatus(ProtocolBuffer.ProtocolMessage):
121 has_code_ = 0
122 code_ = 0
123 has_error_detail_ = 0
124 error_detail_ = ""
126 def __init__(self, contents=None):
127 if contents is not None: self.MergeFromString(contents)
129 def code(self): return self.code_
131 def set_code(self, x):
132 self.has_code_ = 1
133 self.code_ = x
135 def clear_code(self):
136 if self.has_code_:
137 self.has_code_ = 0
138 self.code_ = 0
140 def has_code(self): return self.has_code_
142 def error_detail(self): return self.error_detail_
144 def set_error_detail(self, x):
145 self.has_error_detail_ = 1
146 self.error_detail_ = x
148 def clear_error_detail(self):
149 if self.has_error_detail_:
150 self.has_error_detail_ = 0
151 self.error_detail_ = ""
153 def has_error_detail(self): return self.has_error_detail_
156 def MergeFrom(self, x):
157 assert x is not self
158 if (x.has_code()): self.set_code(x.code())
159 if (x.has_error_detail()): self.set_error_detail(x.error_detail())
161 def Equals(self, x):
162 if x is self: return 1
163 if self.has_code_ != x.has_code_: return 0
164 if self.has_code_ and self.code_ != x.code_: return 0
165 if self.has_error_detail_ != x.has_error_detail_: return 0
166 if self.has_error_detail_ and self.error_detail_ != x.error_detail_: return 0
167 return 1
169 def IsInitialized(self, debug_strs=None):
170 initialized = 1
171 if (not self.has_code_):
172 initialized = 0
173 if debug_strs is not None:
174 debug_strs.append('Required field: code not set.')
175 return initialized
177 def ByteSize(self):
178 n = 0
179 n += self.lengthVarInt64(self.code_)
180 if (self.has_error_detail_): n += 1 + self.lengthString(len(self.error_detail_))
181 return n + 1
183 def ByteSizePartial(self):
184 n = 0
185 if (self.has_code_):
186 n += 1
187 n += self.lengthVarInt64(self.code_)
188 if (self.has_error_detail_): n += 1 + self.lengthString(len(self.error_detail_))
189 return n
191 def Clear(self):
192 self.clear_code()
193 self.clear_error_detail()
195 def OutputUnchecked(self, out):
196 out.putVarInt32(8)
197 out.putVarInt32(self.code_)
198 if (self.has_error_detail_):
199 out.putVarInt32(18)
200 out.putPrefixedString(self.error_detail_)
202 def OutputPartial(self, out):
203 if (self.has_code_):
204 out.putVarInt32(8)
205 out.putVarInt32(self.code_)
206 if (self.has_error_detail_):
207 out.putVarInt32(18)
208 out.putPrefixedString(self.error_detail_)
210 def TryMerge(self, d):
211 while d.avail() > 0:
212 tt = d.getVarInt32()
213 if tt == 8:
214 self.set_code(d.getVarInt32())
215 continue
216 if tt == 18:
217 self.set_error_detail(d.getPrefixedString())
218 continue
221 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
222 d.skipData(tt)
225 def __str__(self, prefix="", printElemNumber=0):
226 res=""
227 if self.has_code_: res+=prefix+("code: %s\n" % self.DebugFormatInt32(self.code_))
228 if self.has_error_detail_: res+=prefix+("error_detail: %s\n" % self.DebugFormatString(self.error_detail_))
229 return res
232 def _BuildTagLookupTable(sparse, maxtag, default=None):
233 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
235 kcode = 1
236 kerror_detail = 2
238 _TEXT = _BuildTagLookupTable({
239 0: "ErrorCode",
240 1: "code",
241 2: "error_detail",
242 }, 2)
244 _TYPES = _BuildTagLookupTable({
245 0: ProtocolBuffer.Encoder.NUMERIC,
246 1: ProtocolBuffer.Encoder.NUMERIC,
247 2: ProtocolBuffer.Encoder.STRING,
248 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
251 _STYLE = """"""
252 _STYLE_CONTENT_TYPE = """"""
253 _PROTO_DESCRIPTOR_NAME = 'apphosting.RequestStatus'
254 class IndexSpec(ProtocolBuffer.ProtocolMessage):
257 GLOBAL = 0
258 PER_DOCUMENT = 1
260 _Consistency_NAMES = {
261 0: "GLOBAL",
262 1: "PER_DOCUMENT",
265 def Consistency_Name(cls, x): return cls._Consistency_NAMES.get(x, "")
266 Consistency_Name = classmethod(Consistency_Name)
270 SEARCH = 0
271 DATASTORE = 1
272 CLOUD_STORAGE = 2
274 _Source_NAMES = {
275 0: "SEARCH",
276 1: "DATASTORE",
277 2: "CLOUD_STORAGE",
280 def Source_Name(cls, x): return cls._Source_NAMES.get(x, "")
281 Source_Name = classmethod(Source_Name)
285 PRIORITY = 0
286 BACKGROUND = 1
288 _Mode_NAMES = {
289 0: "PRIORITY",
290 1: "BACKGROUND",
293 def Mode_Name(cls, x): return cls._Mode_NAMES.get(x, "")
294 Mode_Name = classmethod(Mode_Name)
296 has_name_ = 0
297 name_ = ""
298 has_consistency_ = 0
299 consistency_ = 1
300 has_namespace_ = 0
301 namespace_ = ""
302 has_version_ = 0
303 version_ = 0
304 has_source_ = 0
305 source_ = 0
306 has_mode_ = 0
307 mode_ = 0
309 def __init__(self, contents=None):
310 if contents is not None: self.MergeFromString(contents)
312 def name(self): return self.name_
314 def set_name(self, x):
315 self.has_name_ = 1
316 self.name_ = x
318 def clear_name(self):
319 if self.has_name_:
320 self.has_name_ = 0
321 self.name_ = ""
323 def has_name(self): return self.has_name_
325 def consistency(self): return self.consistency_
327 def set_consistency(self, x):
328 self.has_consistency_ = 1
329 self.consistency_ = x
331 def clear_consistency(self):
332 if self.has_consistency_:
333 self.has_consistency_ = 0
334 self.consistency_ = 1
336 def has_consistency(self): return self.has_consistency_
338 def namespace(self): return self.namespace_
340 def set_namespace(self, x):
341 self.has_namespace_ = 1
342 self.namespace_ = x
344 def clear_namespace(self):
345 if self.has_namespace_:
346 self.has_namespace_ = 0
347 self.namespace_ = ""
349 def has_namespace(self): return self.has_namespace_
351 def version(self): return self.version_
353 def set_version(self, x):
354 self.has_version_ = 1
355 self.version_ = x
357 def clear_version(self):
358 if self.has_version_:
359 self.has_version_ = 0
360 self.version_ = 0
362 def has_version(self): return self.has_version_
364 def source(self): return self.source_
366 def set_source(self, x):
367 self.has_source_ = 1
368 self.source_ = x
370 def clear_source(self):
371 if self.has_source_:
372 self.has_source_ = 0
373 self.source_ = 0
375 def has_source(self): return self.has_source_
377 def mode(self): return self.mode_
379 def set_mode(self, x):
380 self.has_mode_ = 1
381 self.mode_ = x
383 def clear_mode(self):
384 if self.has_mode_:
385 self.has_mode_ = 0
386 self.mode_ = 0
388 def has_mode(self): return self.has_mode_
391 def MergeFrom(self, x):
392 assert x is not self
393 if (x.has_name()): self.set_name(x.name())
394 if (x.has_consistency()): self.set_consistency(x.consistency())
395 if (x.has_namespace()): self.set_namespace(x.namespace())
396 if (x.has_version()): self.set_version(x.version())
397 if (x.has_source()): self.set_source(x.source())
398 if (x.has_mode()): self.set_mode(x.mode())
400 def Equals(self, x):
401 if x is self: return 1
402 if self.has_name_ != x.has_name_: return 0
403 if self.has_name_ and self.name_ != x.name_: return 0
404 if self.has_consistency_ != x.has_consistency_: return 0
405 if self.has_consistency_ and self.consistency_ != x.consistency_: return 0
406 if self.has_namespace_ != x.has_namespace_: return 0
407 if self.has_namespace_ and self.namespace_ != x.namespace_: return 0
408 if self.has_version_ != x.has_version_: return 0
409 if self.has_version_ and self.version_ != x.version_: return 0
410 if self.has_source_ != x.has_source_: return 0
411 if self.has_source_ and self.source_ != x.source_: return 0
412 if self.has_mode_ != x.has_mode_: return 0
413 if self.has_mode_ and self.mode_ != x.mode_: return 0
414 return 1
416 def IsInitialized(self, debug_strs=None):
417 initialized = 1
418 if (not self.has_name_):
419 initialized = 0
420 if debug_strs is not None:
421 debug_strs.append('Required field: name not set.')
422 return initialized
424 def ByteSize(self):
425 n = 0
426 n += self.lengthString(len(self.name_))
427 if (self.has_consistency_): n += 1 + self.lengthVarInt64(self.consistency_)
428 if (self.has_namespace_): n += 1 + self.lengthString(len(self.namespace_))
429 if (self.has_version_): n += 1 + self.lengthVarInt64(self.version_)
430 if (self.has_source_): n += 1 + self.lengthVarInt64(self.source_)
431 if (self.has_mode_): n += 1 + self.lengthVarInt64(self.mode_)
432 return n + 1
434 def ByteSizePartial(self):
435 n = 0
436 if (self.has_name_):
437 n += 1
438 n += self.lengthString(len(self.name_))
439 if (self.has_consistency_): n += 1 + self.lengthVarInt64(self.consistency_)
440 if (self.has_namespace_): n += 1 + self.lengthString(len(self.namespace_))
441 if (self.has_version_): n += 1 + self.lengthVarInt64(self.version_)
442 if (self.has_source_): n += 1 + self.lengthVarInt64(self.source_)
443 if (self.has_mode_): n += 1 + self.lengthVarInt64(self.mode_)
444 return n
446 def Clear(self):
447 self.clear_name()
448 self.clear_consistency()
449 self.clear_namespace()
450 self.clear_version()
451 self.clear_source()
452 self.clear_mode()
454 def OutputUnchecked(self, out):
455 out.putVarInt32(10)
456 out.putPrefixedString(self.name_)
457 if (self.has_consistency_):
458 out.putVarInt32(16)
459 out.putVarInt32(self.consistency_)
460 if (self.has_namespace_):
461 out.putVarInt32(26)
462 out.putPrefixedString(self.namespace_)
463 if (self.has_version_):
464 out.putVarInt32(32)
465 out.putVarInt32(self.version_)
466 if (self.has_source_):
467 out.putVarInt32(40)
468 out.putVarInt32(self.source_)
469 if (self.has_mode_):
470 out.putVarInt32(48)
471 out.putVarInt32(self.mode_)
473 def OutputPartial(self, out):
474 if (self.has_name_):
475 out.putVarInt32(10)
476 out.putPrefixedString(self.name_)
477 if (self.has_consistency_):
478 out.putVarInt32(16)
479 out.putVarInt32(self.consistency_)
480 if (self.has_namespace_):
481 out.putVarInt32(26)
482 out.putPrefixedString(self.namespace_)
483 if (self.has_version_):
484 out.putVarInt32(32)
485 out.putVarInt32(self.version_)
486 if (self.has_source_):
487 out.putVarInt32(40)
488 out.putVarInt32(self.source_)
489 if (self.has_mode_):
490 out.putVarInt32(48)
491 out.putVarInt32(self.mode_)
493 def TryMerge(self, d):
494 while d.avail() > 0:
495 tt = d.getVarInt32()
496 if tt == 10:
497 self.set_name(d.getPrefixedString())
498 continue
499 if tt == 16:
500 self.set_consistency(d.getVarInt32())
501 continue
502 if tt == 26:
503 self.set_namespace(d.getPrefixedString())
504 continue
505 if tt == 32:
506 self.set_version(d.getVarInt32())
507 continue
508 if tt == 40:
509 self.set_source(d.getVarInt32())
510 continue
511 if tt == 48:
512 self.set_mode(d.getVarInt32())
513 continue
516 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
517 d.skipData(tt)
520 def __str__(self, prefix="", printElemNumber=0):
521 res=""
522 if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
523 if self.has_consistency_: res+=prefix+("consistency: %s\n" % self.DebugFormatInt32(self.consistency_))
524 if self.has_namespace_: res+=prefix+("namespace: %s\n" % self.DebugFormatString(self.namespace_))
525 if self.has_version_: res+=prefix+("version: %s\n" % self.DebugFormatInt32(self.version_))
526 if self.has_source_: res+=prefix+("source: %s\n" % self.DebugFormatInt32(self.source_))
527 if self.has_mode_: res+=prefix+("mode: %s\n" % self.DebugFormatInt32(self.mode_))
528 return res
531 def _BuildTagLookupTable(sparse, maxtag, default=None):
532 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
534 kname = 1
535 kconsistency = 2
536 knamespace = 3
537 kversion = 4
538 ksource = 5
539 kmode = 6
541 _TEXT = _BuildTagLookupTable({
542 0: "ErrorCode",
543 1: "name",
544 2: "consistency",
545 3: "namespace",
546 4: "version",
547 5: "source",
548 6: "mode",
549 }, 6)
551 _TYPES = _BuildTagLookupTable({
552 0: ProtocolBuffer.Encoder.NUMERIC,
553 1: ProtocolBuffer.Encoder.STRING,
554 2: ProtocolBuffer.Encoder.NUMERIC,
555 3: ProtocolBuffer.Encoder.STRING,
556 4: ProtocolBuffer.Encoder.NUMERIC,
557 5: ProtocolBuffer.Encoder.NUMERIC,
558 6: ProtocolBuffer.Encoder.NUMERIC,
559 }, 6, ProtocolBuffer.Encoder.MAX_TYPE)
562 _STYLE = """"""
563 _STYLE_CONTENT_TYPE = """"""
564 _PROTO_DESCRIPTOR_NAME = 'apphosting.IndexSpec'
565 class IndexMetadata(ProtocolBuffer.ProtocolMessage):
566 has_index_spec_ = 0
568 def __init__(self, contents=None):
569 self.index_spec_ = IndexSpec()
570 self.field_ = []
571 if contents is not None: self.MergeFromString(contents)
573 def index_spec(self): return self.index_spec_
575 def mutable_index_spec(self): self.has_index_spec_ = 1; return self.index_spec_
577 def clear_index_spec(self):self.has_index_spec_ = 0; self.index_spec_.Clear()
579 def has_index_spec(self): return self.has_index_spec_
581 def field_size(self): return len(self.field_)
582 def field_list(self): return self.field_
584 def field(self, i):
585 return self.field_[i]
587 def mutable_field(self, i):
588 return self.field_[i]
590 def add_field(self):
591 x = FieldTypes()
592 self.field_.append(x)
593 return x
595 def clear_field(self):
596 self.field_ = []
598 def MergeFrom(self, x):
599 assert x is not self
600 if (x.has_index_spec()): self.mutable_index_spec().MergeFrom(x.index_spec())
601 for i in xrange(x.field_size()): self.add_field().CopyFrom(x.field(i))
603 def Equals(self, x):
604 if x is self: return 1
605 if self.has_index_spec_ != x.has_index_spec_: return 0
606 if self.has_index_spec_ and self.index_spec_ != x.index_spec_: return 0
607 if len(self.field_) != len(x.field_): return 0
608 for e1, e2 in zip(self.field_, x.field_):
609 if e1 != e2: return 0
610 return 1
612 def IsInitialized(self, debug_strs=None):
613 initialized = 1
614 if (not self.has_index_spec_):
615 initialized = 0
616 if debug_strs is not None:
617 debug_strs.append('Required field: index_spec not set.')
618 elif not self.index_spec_.IsInitialized(debug_strs): initialized = 0
619 for p in self.field_:
620 if not p.IsInitialized(debug_strs): initialized=0
621 return initialized
623 def ByteSize(self):
624 n = 0
625 n += self.lengthString(self.index_spec_.ByteSize())
626 n += 1 * len(self.field_)
627 for i in xrange(len(self.field_)): n += self.lengthString(self.field_[i].ByteSize())
628 return n + 1
630 def ByteSizePartial(self):
631 n = 0
632 if (self.has_index_spec_):
633 n += 1
634 n += self.lengthString(self.index_spec_.ByteSizePartial())
635 n += 1 * len(self.field_)
636 for i in xrange(len(self.field_)): n += self.lengthString(self.field_[i].ByteSizePartial())
637 return n
639 def Clear(self):
640 self.clear_index_spec()
641 self.clear_field()
643 def OutputUnchecked(self, out):
644 out.putVarInt32(10)
645 out.putVarInt32(self.index_spec_.ByteSize())
646 self.index_spec_.OutputUnchecked(out)
647 for i in xrange(len(self.field_)):
648 out.putVarInt32(18)
649 out.putVarInt32(self.field_[i].ByteSize())
650 self.field_[i].OutputUnchecked(out)
652 def OutputPartial(self, out):
653 if (self.has_index_spec_):
654 out.putVarInt32(10)
655 out.putVarInt32(self.index_spec_.ByteSizePartial())
656 self.index_spec_.OutputPartial(out)
657 for i in xrange(len(self.field_)):
658 out.putVarInt32(18)
659 out.putVarInt32(self.field_[i].ByteSizePartial())
660 self.field_[i].OutputPartial(out)
662 def TryMerge(self, d):
663 while d.avail() > 0:
664 tt = d.getVarInt32()
665 if tt == 10:
666 length = d.getVarInt32()
667 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
668 d.skip(length)
669 self.mutable_index_spec().TryMerge(tmp)
670 continue
671 if tt == 18:
672 length = d.getVarInt32()
673 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
674 d.skip(length)
675 self.add_field().TryMerge(tmp)
676 continue
679 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
680 d.skipData(tt)
683 def __str__(self, prefix="", printElemNumber=0):
684 res=""
685 if self.has_index_spec_:
686 res+=prefix+"index_spec <\n"
687 res+=self.index_spec_.__str__(prefix + " ", printElemNumber)
688 res+=prefix+">\n"
689 cnt=0
690 for e in self.field_:
691 elm=""
692 if printElemNumber: elm="(%d)" % cnt
693 res+=prefix+("field%s <\n" % elm)
694 res+=e.__str__(prefix + " ", printElemNumber)
695 res+=prefix+">\n"
696 cnt+=1
697 return res
700 def _BuildTagLookupTable(sparse, maxtag, default=None):
701 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
703 kindex_spec = 1
704 kfield = 2
706 _TEXT = _BuildTagLookupTable({
707 0: "ErrorCode",
708 1: "index_spec",
709 2: "field",
710 }, 2)
712 _TYPES = _BuildTagLookupTable({
713 0: ProtocolBuffer.Encoder.NUMERIC,
714 1: ProtocolBuffer.Encoder.STRING,
715 2: ProtocolBuffer.Encoder.STRING,
716 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
719 _STYLE = """"""
720 _STYLE_CONTENT_TYPE = """"""
721 _PROTO_DESCRIPTOR_NAME = 'apphosting.IndexMetadata'
722 class IndexDocumentParams(ProtocolBuffer.ProtocolMessage):
725 SYNCHRONOUSLY = 0
726 WHEN_CONVENIENT = 1
728 _Freshness_NAMES = {
729 0: "SYNCHRONOUSLY",
730 1: "WHEN_CONVENIENT",
733 def Freshness_Name(cls, x): return cls._Freshness_NAMES.get(x, "")
734 Freshness_Name = classmethod(Freshness_Name)
736 has_freshness_ = 0
737 freshness_ = 0
738 has_index_spec_ = 0
740 def __init__(self, contents=None):
741 self.document_ = []
742 self.index_spec_ = IndexSpec()
743 if contents is not None: self.MergeFromString(contents)
745 def document_size(self): return len(self.document_)
746 def document_list(self): return self.document_
748 def document(self, i):
749 return self.document_[i]
751 def mutable_document(self, i):
752 return self.document_[i]
754 def add_document(self):
755 x = Document()
756 self.document_.append(x)
757 return x
759 def clear_document(self):
760 self.document_ = []
761 def freshness(self): return self.freshness_
763 def set_freshness(self, x):
764 self.has_freshness_ = 1
765 self.freshness_ = x
767 def clear_freshness(self):
768 if self.has_freshness_:
769 self.has_freshness_ = 0
770 self.freshness_ = 0
772 def has_freshness(self): return self.has_freshness_
774 def index_spec(self): return self.index_spec_
776 def mutable_index_spec(self): self.has_index_spec_ = 1; return self.index_spec_
778 def clear_index_spec(self):self.has_index_spec_ = 0; self.index_spec_.Clear()
780 def has_index_spec(self): return self.has_index_spec_
783 def MergeFrom(self, x):
784 assert x is not self
785 for i in xrange(x.document_size()): self.add_document().CopyFrom(x.document(i))
786 if (x.has_freshness()): self.set_freshness(x.freshness())
787 if (x.has_index_spec()): self.mutable_index_spec().MergeFrom(x.index_spec())
789 def Equals(self, x):
790 if x is self: return 1
791 if len(self.document_) != len(x.document_): return 0
792 for e1, e2 in zip(self.document_, x.document_):
793 if e1 != e2: return 0
794 if self.has_freshness_ != x.has_freshness_: return 0
795 if self.has_freshness_ and self.freshness_ != x.freshness_: return 0
796 if self.has_index_spec_ != x.has_index_spec_: return 0
797 if self.has_index_spec_ and self.index_spec_ != x.index_spec_: return 0
798 return 1
800 def IsInitialized(self, debug_strs=None):
801 initialized = 1
802 for p in self.document_:
803 if not p.IsInitialized(debug_strs): initialized=0
804 if (not self.has_index_spec_):
805 initialized = 0
806 if debug_strs is not None:
807 debug_strs.append('Required field: index_spec not set.')
808 elif not self.index_spec_.IsInitialized(debug_strs): initialized = 0
809 return initialized
811 def ByteSize(self):
812 n = 0
813 n += 1 * len(self.document_)
814 for i in xrange(len(self.document_)): n += self.lengthString(self.document_[i].ByteSize())
815 if (self.has_freshness_): n += 1 + self.lengthVarInt64(self.freshness_)
816 n += self.lengthString(self.index_spec_.ByteSize())
817 return n + 1
819 def ByteSizePartial(self):
820 n = 0
821 n += 1 * len(self.document_)
822 for i in xrange(len(self.document_)): n += self.lengthString(self.document_[i].ByteSizePartial())
823 if (self.has_freshness_): n += 1 + self.lengthVarInt64(self.freshness_)
824 if (self.has_index_spec_):
825 n += 1
826 n += self.lengthString(self.index_spec_.ByteSizePartial())
827 return n
829 def Clear(self):
830 self.clear_document()
831 self.clear_freshness()
832 self.clear_index_spec()
834 def OutputUnchecked(self, out):
835 for i in xrange(len(self.document_)):
836 out.putVarInt32(10)
837 out.putVarInt32(self.document_[i].ByteSize())
838 self.document_[i].OutputUnchecked(out)
839 if (self.has_freshness_):
840 out.putVarInt32(16)
841 out.putVarInt32(self.freshness_)
842 out.putVarInt32(26)
843 out.putVarInt32(self.index_spec_.ByteSize())
844 self.index_spec_.OutputUnchecked(out)
846 def OutputPartial(self, out):
847 for i in xrange(len(self.document_)):
848 out.putVarInt32(10)
849 out.putVarInt32(self.document_[i].ByteSizePartial())
850 self.document_[i].OutputPartial(out)
851 if (self.has_freshness_):
852 out.putVarInt32(16)
853 out.putVarInt32(self.freshness_)
854 if (self.has_index_spec_):
855 out.putVarInt32(26)
856 out.putVarInt32(self.index_spec_.ByteSizePartial())
857 self.index_spec_.OutputPartial(out)
859 def TryMerge(self, d):
860 while d.avail() > 0:
861 tt = d.getVarInt32()
862 if tt == 10:
863 length = d.getVarInt32()
864 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
865 d.skip(length)
866 self.add_document().TryMerge(tmp)
867 continue
868 if tt == 16:
869 self.set_freshness(d.getVarInt32())
870 continue
871 if tt == 26:
872 length = d.getVarInt32()
873 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
874 d.skip(length)
875 self.mutable_index_spec().TryMerge(tmp)
876 continue
879 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
880 d.skipData(tt)
883 def __str__(self, prefix="", printElemNumber=0):
884 res=""
885 cnt=0
886 for e in self.document_:
887 elm=""
888 if printElemNumber: elm="(%d)" % cnt
889 res+=prefix+("document%s <\n" % elm)
890 res+=e.__str__(prefix + " ", printElemNumber)
891 res+=prefix+">\n"
892 cnt+=1
893 if self.has_freshness_: res+=prefix+("freshness: %s\n" % self.DebugFormatInt32(self.freshness_))
894 if self.has_index_spec_:
895 res+=prefix+"index_spec <\n"
896 res+=self.index_spec_.__str__(prefix + " ", printElemNumber)
897 res+=prefix+">\n"
898 return res
901 def _BuildTagLookupTable(sparse, maxtag, default=None):
902 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
904 kdocument = 1
905 kfreshness = 2
906 kindex_spec = 3
908 _TEXT = _BuildTagLookupTable({
909 0: "ErrorCode",
910 1: "document",
911 2: "freshness",
912 3: "index_spec",
913 }, 3)
915 _TYPES = _BuildTagLookupTable({
916 0: ProtocolBuffer.Encoder.NUMERIC,
917 1: ProtocolBuffer.Encoder.STRING,
918 2: ProtocolBuffer.Encoder.NUMERIC,
919 3: ProtocolBuffer.Encoder.STRING,
920 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
923 _STYLE = """"""
924 _STYLE_CONTENT_TYPE = """"""
925 _PROTO_DESCRIPTOR_NAME = 'apphosting.IndexDocumentParams'
926 class IndexDocumentRequest(ProtocolBuffer.ProtocolMessage):
927 has_params_ = 0
928 has_app_id_ = 0
929 app_id_ = ""
931 def __init__(self, contents=None):
932 self.params_ = IndexDocumentParams()
933 if contents is not None: self.MergeFromString(contents)
935 def params(self): return self.params_
937 def mutable_params(self): self.has_params_ = 1; return self.params_
939 def clear_params(self):self.has_params_ = 0; self.params_.Clear()
941 def has_params(self): return self.has_params_
943 def app_id(self): return self.app_id_
945 def set_app_id(self, x):
946 self.has_app_id_ = 1
947 self.app_id_ = x
949 def clear_app_id(self):
950 if self.has_app_id_:
951 self.has_app_id_ = 0
952 self.app_id_ = ""
954 def has_app_id(self): return self.has_app_id_
957 def MergeFrom(self, x):
958 assert x is not self
959 if (x.has_params()): self.mutable_params().MergeFrom(x.params())
960 if (x.has_app_id()): self.set_app_id(x.app_id())
962 def Equals(self, x):
963 if x is self: return 1
964 if self.has_params_ != x.has_params_: return 0
965 if self.has_params_ and self.params_ != x.params_: return 0
966 if self.has_app_id_ != x.has_app_id_: return 0
967 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0
968 return 1
970 def IsInitialized(self, debug_strs=None):
971 initialized = 1
972 if (not self.has_params_):
973 initialized = 0
974 if debug_strs is not None:
975 debug_strs.append('Required field: params not set.')
976 elif not self.params_.IsInitialized(debug_strs): initialized = 0
977 return initialized
979 def ByteSize(self):
980 n = 0
981 n += self.lengthString(self.params_.ByteSize())
982 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
983 return n + 1
985 def ByteSizePartial(self):
986 n = 0
987 if (self.has_params_):
988 n += 1
989 n += self.lengthString(self.params_.ByteSizePartial())
990 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
991 return n
993 def Clear(self):
994 self.clear_params()
995 self.clear_app_id()
997 def OutputUnchecked(self, out):
998 out.putVarInt32(10)
999 out.putVarInt32(self.params_.ByteSize())
1000 self.params_.OutputUnchecked(out)
1001 if (self.has_app_id_):
1002 out.putVarInt32(26)
1003 out.putPrefixedString(self.app_id_)
1005 def OutputPartial(self, out):
1006 if (self.has_params_):
1007 out.putVarInt32(10)
1008 out.putVarInt32(self.params_.ByteSizePartial())
1009 self.params_.OutputPartial(out)
1010 if (self.has_app_id_):
1011 out.putVarInt32(26)
1012 out.putPrefixedString(self.app_id_)
1014 def TryMerge(self, d):
1015 while d.avail() > 0:
1016 tt = d.getVarInt32()
1017 if tt == 10:
1018 length = d.getVarInt32()
1019 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1020 d.skip(length)
1021 self.mutable_params().TryMerge(tmp)
1022 continue
1023 if tt == 26:
1024 self.set_app_id(d.getPrefixedString())
1025 continue
1028 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1029 d.skipData(tt)
1032 def __str__(self, prefix="", printElemNumber=0):
1033 res=""
1034 if self.has_params_:
1035 res+=prefix+"params <\n"
1036 res+=self.params_.__str__(prefix + " ", printElemNumber)
1037 res+=prefix+">\n"
1038 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_))
1039 return res
1042 def _BuildTagLookupTable(sparse, maxtag, default=None):
1043 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1045 kparams = 1
1046 kapp_id = 3
1048 _TEXT = _BuildTagLookupTable({
1049 0: "ErrorCode",
1050 1: "params",
1051 3: "app_id",
1052 }, 3)
1054 _TYPES = _BuildTagLookupTable({
1055 0: ProtocolBuffer.Encoder.NUMERIC,
1056 1: ProtocolBuffer.Encoder.STRING,
1057 3: ProtocolBuffer.Encoder.STRING,
1058 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
1061 _STYLE = """"""
1062 _STYLE_CONTENT_TYPE = """"""
1063 _PROTO_DESCRIPTOR_NAME = 'apphosting.IndexDocumentRequest'
1064 class IndexDocumentResponse(ProtocolBuffer.ProtocolMessage):
1066 def __init__(self, contents=None):
1067 self.status_ = []
1068 self.doc_id_ = []
1069 if contents is not None: self.MergeFromString(contents)
1071 def status_size(self): return len(self.status_)
1072 def status_list(self): return self.status_
1074 def status(self, i):
1075 return self.status_[i]
1077 def mutable_status(self, i):
1078 return self.status_[i]
1080 def add_status(self):
1081 x = RequestStatus()
1082 self.status_.append(x)
1083 return x
1085 def clear_status(self):
1086 self.status_ = []
1087 def doc_id_size(self): return len(self.doc_id_)
1088 def doc_id_list(self): return self.doc_id_
1090 def doc_id(self, i):
1091 return self.doc_id_[i]
1093 def set_doc_id(self, i, x):
1094 self.doc_id_[i] = x
1096 def add_doc_id(self, x):
1097 self.doc_id_.append(x)
1099 def clear_doc_id(self):
1100 self.doc_id_ = []
1103 def MergeFrom(self, x):
1104 assert x is not self
1105 for i in xrange(x.status_size()): self.add_status().CopyFrom(x.status(i))
1106 for i in xrange(x.doc_id_size()): self.add_doc_id(x.doc_id(i))
1108 def Equals(self, x):
1109 if x is self: return 1
1110 if len(self.status_) != len(x.status_): return 0
1111 for e1, e2 in zip(self.status_, x.status_):
1112 if e1 != e2: return 0
1113 if len(self.doc_id_) != len(x.doc_id_): return 0
1114 for e1, e2 in zip(self.doc_id_, x.doc_id_):
1115 if e1 != e2: return 0
1116 return 1
1118 def IsInitialized(self, debug_strs=None):
1119 initialized = 1
1120 for p in self.status_:
1121 if not p.IsInitialized(debug_strs): initialized=0
1122 return initialized
1124 def ByteSize(self):
1125 n = 0
1126 n += 1 * len(self.status_)
1127 for i in xrange(len(self.status_)): n += self.lengthString(self.status_[i].ByteSize())
1128 n += 1 * len(self.doc_id_)
1129 for i in xrange(len(self.doc_id_)): n += self.lengthString(len(self.doc_id_[i]))
1130 return n
1132 def ByteSizePartial(self):
1133 n = 0
1134 n += 1 * len(self.status_)
1135 for i in xrange(len(self.status_)): n += self.lengthString(self.status_[i].ByteSizePartial())
1136 n += 1 * len(self.doc_id_)
1137 for i in xrange(len(self.doc_id_)): n += self.lengthString(len(self.doc_id_[i]))
1138 return n
1140 def Clear(self):
1141 self.clear_status()
1142 self.clear_doc_id()
1144 def OutputUnchecked(self, out):
1145 for i in xrange(len(self.status_)):
1146 out.putVarInt32(10)
1147 out.putVarInt32(self.status_[i].ByteSize())
1148 self.status_[i].OutputUnchecked(out)
1149 for i in xrange(len(self.doc_id_)):
1150 out.putVarInt32(18)
1151 out.putPrefixedString(self.doc_id_[i])
1153 def OutputPartial(self, out):
1154 for i in xrange(len(self.status_)):
1155 out.putVarInt32(10)
1156 out.putVarInt32(self.status_[i].ByteSizePartial())
1157 self.status_[i].OutputPartial(out)
1158 for i in xrange(len(self.doc_id_)):
1159 out.putVarInt32(18)
1160 out.putPrefixedString(self.doc_id_[i])
1162 def TryMerge(self, d):
1163 while d.avail() > 0:
1164 tt = d.getVarInt32()
1165 if tt == 10:
1166 length = d.getVarInt32()
1167 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1168 d.skip(length)
1169 self.add_status().TryMerge(tmp)
1170 continue
1171 if tt == 18:
1172 self.add_doc_id(d.getPrefixedString())
1173 continue
1176 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1177 d.skipData(tt)
1180 def __str__(self, prefix="", printElemNumber=0):
1181 res=""
1182 cnt=0
1183 for e in self.status_:
1184 elm=""
1185 if printElemNumber: elm="(%d)" % cnt
1186 res+=prefix+("status%s <\n" % elm)
1187 res+=e.__str__(prefix + " ", printElemNumber)
1188 res+=prefix+">\n"
1189 cnt+=1
1190 cnt=0
1191 for e in self.doc_id_:
1192 elm=""
1193 if printElemNumber: elm="(%d)" % cnt
1194 res+=prefix+("doc_id%s: %s\n" % (elm, self.DebugFormatString(e)))
1195 cnt+=1
1196 return res
1199 def _BuildTagLookupTable(sparse, maxtag, default=None):
1200 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1202 kstatus = 1
1203 kdoc_id = 2
1205 _TEXT = _BuildTagLookupTable({
1206 0: "ErrorCode",
1207 1: "status",
1208 2: "doc_id",
1209 }, 2)
1211 _TYPES = _BuildTagLookupTable({
1212 0: ProtocolBuffer.Encoder.NUMERIC,
1213 1: ProtocolBuffer.Encoder.STRING,
1214 2: ProtocolBuffer.Encoder.STRING,
1215 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
1218 _STYLE = """"""
1219 _STYLE_CONTENT_TYPE = """"""
1220 _PROTO_DESCRIPTOR_NAME = 'apphosting.IndexDocumentResponse'
1221 class DeleteDocumentParams(ProtocolBuffer.ProtocolMessage):
1222 has_index_spec_ = 0
1224 def __init__(self, contents=None):
1225 self.doc_id_ = []
1226 self.index_spec_ = IndexSpec()
1227 if contents is not None: self.MergeFromString(contents)
1229 def doc_id_size(self): return len(self.doc_id_)
1230 def doc_id_list(self): return self.doc_id_
1232 def doc_id(self, i):
1233 return self.doc_id_[i]
1235 def set_doc_id(self, i, x):
1236 self.doc_id_[i] = x
1238 def add_doc_id(self, x):
1239 self.doc_id_.append(x)
1241 def clear_doc_id(self):
1242 self.doc_id_ = []
1244 def index_spec(self): return self.index_spec_
1246 def mutable_index_spec(self): self.has_index_spec_ = 1; return self.index_spec_
1248 def clear_index_spec(self):self.has_index_spec_ = 0; self.index_spec_.Clear()
1250 def has_index_spec(self): return self.has_index_spec_
1253 def MergeFrom(self, x):
1254 assert x is not self
1255 for i in xrange(x.doc_id_size()): self.add_doc_id(x.doc_id(i))
1256 if (x.has_index_spec()): self.mutable_index_spec().MergeFrom(x.index_spec())
1258 def Equals(self, x):
1259 if x is self: return 1
1260 if len(self.doc_id_) != len(x.doc_id_): return 0
1261 for e1, e2 in zip(self.doc_id_, x.doc_id_):
1262 if e1 != e2: return 0
1263 if self.has_index_spec_ != x.has_index_spec_: return 0
1264 if self.has_index_spec_ and self.index_spec_ != x.index_spec_: return 0
1265 return 1
1267 def IsInitialized(self, debug_strs=None):
1268 initialized = 1
1269 if (not self.has_index_spec_):
1270 initialized = 0
1271 if debug_strs is not None:
1272 debug_strs.append('Required field: index_spec not set.')
1273 elif not self.index_spec_.IsInitialized(debug_strs): initialized = 0
1274 return initialized
1276 def ByteSize(self):
1277 n = 0
1278 n += 1 * len(self.doc_id_)
1279 for i in xrange(len(self.doc_id_)): n += self.lengthString(len(self.doc_id_[i]))
1280 n += self.lengthString(self.index_spec_.ByteSize())
1281 return n + 1
1283 def ByteSizePartial(self):
1284 n = 0
1285 n += 1 * len(self.doc_id_)
1286 for i in xrange(len(self.doc_id_)): n += self.lengthString(len(self.doc_id_[i]))
1287 if (self.has_index_spec_):
1288 n += 1
1289 n += self.lengthString(self.index_spec_.ByteSizePartial())
1290 return n
1292 def Clear(self):
1293 self.clear_doc_id()
1294 self.clear_index_spec()
1296 def OutputUnchecked(self, out):
1297 for i in xrange(len(self.doc_id_)):
1298 out.putVarInt32(10)
1299 out.putPrefixedString(self.doc_id_[i])
1300 out.putVarInt32(18)
1301 out.putVarInt32(self.index_spec_.ByteSize())
1302 self.index_spec_.OutputUnchecked(out)
1304 def OutputPartial(self, out):
1305 for i in xrange(len(self.doc_id_)):
1306 out.putVarInt32(10)
1307 out.putPrefixedString(self.doc_id_[i])
1308 if (self.has_index_spec_):
1309 out.putVarInt32(18)
1310 out.putVarInt32(self.index_spec_.ByteSizePartial())
1311 self.index_spec_.OutputPartial(out)
1313 def TryMerge(self, d):
1314 while d.avail() > 0:
1315 tt = d.getVarInt32()
1316 if tt == 10:
1317 self.add_doc_id(d.getPrefixedString())
1318 continue
1319 if tt == 18:
1320 length = d.getVarInt32()
1321 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1322 d.skip(length)
1323 self.mutable_index_spec().TryMerge(tmp)
1324 continue
1327 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1328 d.skipData(tt)
1331 def __str__(self, prefix="", printElemNumber=0):
1332 res=""
1333 cnt=0
1334 for e in self.doc_id_:
1335 elm=""
1336 if printElemNumber: elm="(%d)" % cnt
1337 res+=prefix+("doc_id%s: %s\n" % (elm, self.DebugFormatString(e)))
1338 cnt+=1
1339 if self.has_index_spec_:
1340 res+=prefix+"index_spec <\n"
1341 res+=self.index_spec_.__str__(prefix + " ", printElemNumber)
1342 res+=prefix+">\n"
1343 return res
1346 def _BuildTagLookupTable(sparse, maxtag, default=None):
1347 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1349 kdoc_id = 1
1350 kindex_spec = 2
1352 _TEXT = _BuildTagLookupTable({
1353 0: "ErrorCode",
1354 1: "doc_id",
1355 2: "index_spec",
1356 }, 2)
1358 _TYPES = _BuildTagLookupTable({
1359 0: ProtocolBuffer.Encoder.NUMERIC,
1360 1: ProtocolBuffer.Encoder.STRING,
1361 2: ProtocolBuffer.Encoder.STRING,
1362 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
1365 _STYLE = """"""
1366 _STYLE_CONTENT_TYPE = """"""
1367 _PROTO_DESCRIPTOR_NAME = 'apphosting.DeleteDocumentParams'
1368 class DeleteDocumentRequest(ProtocolBuffer.ProtocolMessage):
1369 has_params_ = 0
1370 has_app_id_ = 0
1371 app_id_ = ""
1373 def __init__(self, contents=None):
1374 self.params_ = DeleteDocumentParams()
1375 if contents is not None: self.MergeFromString(contents)
1377 def params(self): return self.params_
1379 def mutable_params(self): self.has_params_ = 1; return self.params_
1381 def clear_params(self):self.has_params_ = 0; self.params_.Clear()
1383 def has_params(self): return self.has_params_
1385 def app_id(self): return self.app_id_
1387 def set_app_id(self, x):
1388 self.has_app_id_ = 1
1389 self.app_id_ = x
1391 def clear_app_id(self):
1392 if self.has_app_id_:
1393 self.has_app_id_ = 0
1394 self.app_id_ = ""
1396 def has_app_id(self): return self.has_app_id_
1399 def MergeFrom(self, x):
1400 assert x is not self
1401 if (x.has_params()): self.mutable_params().MergeFrom(x.params())
1402 if (x.has_app_id()): self.set_app_id(x.app_id())
1404 def Equals(self, x):
1405 if x is self: return 1
1406 if self.has_params_ != x.has_params_: return 0
1407 if self.has_params_ and self.params_ != x.params_: return 0
1408 if self.has_app_id_ != x.has_app_id_: return 0
1409 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0
1410 return 1
1412 def IsInitialized(self, debug_strs=None):
1413 initialized = 1
1414 if (not self.has_params_):
1415 initialized = 0
1416 if debug_strs is not None:
1417 debug_strs.append('Required field: params not set.')
1418 elif not self.params_.IsInitialized(debug_strs): initialized = 0
1419 return initialized
1421 def ByteSize(self):
1422 n = 0
1423 n += self.lengthString(self.params_.ByteSize())
1424 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
1425 return n + 1
1427 def ByteSizePartial(self):
1428 n = 0
1429 if (self.has_params_):
1430 n += 1
1431 n += self.lengthString(self.params_.ByteSizePartial())
1432 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
1433 return n
1435 def Clear(self):
1436 self.clear_params()
1437 self.clear_app_id()
1439 def OutputUnchecked(self, out):
1440 out.putVarInt32(10)
1441 out.putVarInt32(self.params_.ByteSize())
1442 self.params_.OutputUnchecked(out)
1443 if (self.has_app_id_):
1444 out.putVarInt32(26)
1445 out.putPrefixedString(self.app_id_)
1447 def OutputPartial(self, out):
1448 if (self.has_params_):
1449 out.putVarInt32(10)
1450 out.putVarInt32(self.params_.ByteSizePartial())
1451 self.params_.OutputPartial(out)
1452 if (self.has_app_id_):
1453 out.putVarInt32(26)
1454 out.putPrefixedString(self.app_id_)
1456 def TryMerge(self, d):
1457 while d.avail() > 0:
1458 tt = d.getVarInt32()
1459 if tt == 10:
1460 length = d.getVarInt32()
1461 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1462 d.skip(length)
1463 self.mutable_params().TryMerge(tmp)
1464 continue
1465 if tt == 26:
1466 self.set_app_id(d.getPrefixedString())
1467 continue
1470 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1471 d.skipData(tt)
1474 def __str__(self, prefix="", printElemNumber=0):
1475 res=""
1476 if self.has_params_:
1477 res+=prefix+"params <\n"
1478 res+=self.params_.__str__(prefix + " ", printElemNumber)
1479 res+=prefix+">\n"
1480 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_))
1481 return res
1484 def _BuildTagLookupTable(sparse, maxtag, default=None):
1485 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1487 kparams = 1
1488 kapp_id = 3
1490 _TEXT = _BuildTagLookupTable({
1491 0: "ErrorCode",
1492 1: "params",
1493 3: "app_id",
1494 }, 3)
1496 _TYPES = _BuildTagLookupTable({
1497 0: ProtocolBuffer.Encoder.NUMERIC,
1498 1: ProtocolBuffer.Encoder.STRING,
1499 3: ProtocolBuffer.Encoder.STRING,
1500 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
1503 _STYLE = """"""
1504 _STYLE_CONTENT_TYPE = """"""
1505 _PROTO_DESCRIPTOR_NAME = 'apphosting.DeleteDocumentRequest'
1506 class DeleteDocumentResponse(ProtocolBuffer.ProtocolMessage):
1508 def __init__(self, contents=None):
1509 self.status_ = []
1510 if contents is not None: self.MergeFromString(contents)
1512 def status_size(self): return len(self.status_)
1513 def status_list(self): return self.status_
1515 def status(self, i):
1516 return self.status_[i]
1518 def mutable_status(self, i):
1519 return self.status_[i]
1521 def add_status(self):
1522 x = RequestStatus()
1523 self.status_.append(x)
1524 return x
1526 def clear_status(self):
1527 self.status_ = []
1529 def MergeFrom(self, x):
1530 assert x is not self
1531 for i in xrange(x.status_size()): self.add_status().CopyFrom(x.status(i))
1533 def Equals(self, x):
1534 if x is self: return 1
1535 if len(self.status_) != len(x.status_): return 0
1536 for e1, e2 in zip(self.status_, x.status_):
1537 if e1 != e2: return 0
1538 return 1
1540 def IsInitialized(self, debug_strs=None):
1541 initialized = 1
1542 for p in self.status_:
1543 if not p.IsInitialized(debug_strs): initialized=0
1544 return initialized
1546 def ByteSize(self):
1547 n = 0
1548 n += 1 * len(self.status_)
1549 for i in xrange(len(self.status_)): n += self.lengthString(self.status_[i].ByteSize())
1550 return n
1552 def ByteSizePartial(self):
1553 n = 0
1554 n += 1 * len(self.status_)
1555 for i in xrange(len(self.status_)): n += self.lengthString(self.status_[i].ByteSizePartial())
1556 return n
1558 def Clear(self):
1559 self.clear_status()
1561 def OutputUnchecked(self, out):
1562 for i in xrange(len(self.status_)):
1563 out.putVarInt32(10)
1564 out.putVarInt32(self.status_[i].ByteSize())
1565 self.status_[i].OutputUnchecked(out)
1567 def OutputPartial(self, out):
1568 for i in xrange(len(self.status_)):
1569 out.putVarInt32(10)
1570 out.putVarInt32(self.status_[i].ByteSizePartial())
1571 self.status_[i].OutputPartial(out)
1573 def TryMerge(self, d):
1574 while d.avail() > 0:
1575 tt = d.getVarInt32()
1576 if tt == 10:
1577 length = d.getVarInt32()
1578 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1579 d.skip(length)
1580 self.add_status().TryMerge(tmp)
1581 continue
1584 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1585 d.skipData(tt)
1588 def __str__(self, prefix="", printElemNumber=0):
1589 res=""
1590 cnt=0
1591 for e in self.status_:
1592 elm=""
1593 if printElemNumber: elm="(%d)" % cnt
1594 res+=prefix+("status%s <\n" % elm)
1595 res+=e.__str__(prefix + " ", printElemNumber)
1596 res+=prefix+">\n"
1597 cnt+=1
1598 return res
1601 def _BuildTagLookupTable(sparse, maxtag, default=None):
1602 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1604 kstatus = 1
1606 _TEXT = _BuildTagLookupTable({
1607 0: "ErrorCode",
1608 1: "status",
1609 }, 1)
1611 _TYPES = _BuildTagLookupTable({
1612 0: ProtocolBuffer.Encoder.NUMERIC,
1613 1: ProtocolBuffer.Encoder.STRING,
1614 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
1617 _STYLE = """"""
1618 _STYLE_CONTENT_TYPE = """"""
1619 _PROTO_DESCRIPTOR_NAME = 'apphosting.DeleteDocumentResponse'
1620 class ListDocumentsParams(ProtocolBuffer.ProtocolMessage):
1621 has_index_spec_ = 0
1622 has_start_doc_id_ = 0
1623 start_doc_id_ = ""
1624 has_include_start_doc_ = 0
1625 include_start_doc_ = 1
1626 has_limit_ = 0
1627 limit_ = 100
1628 has_keys_only_ = 0
1629 keys_only_ = 0
1631 def __init__(self, contents=None):
1632 self.index_spec_ = IndexSpec()
1633 if contents is not None: self.MergeFromString(contents)
1635 def index_spec(self): return self.index_spec_
1637 def mutable_index_spec(self): self.has_index_spec_ = 1; return self.index_spec_
1639 def clear_index_spec(self):self.has_index_spec_ = 0; self.index_spec_.Clear()
1641 def has_index_spec(self): return self.has_index_spec_
1643 def start_doc_id(self): return self.start_doc_id_
1645 def set_start_doc_id(self, x):
1646 self.has_start_doc_id_ = 1
1647 self.start_doc_id_ = x
1649 def clear_start_doc_id(self):
1650 if self.has_start_doc_id_:
1651 self.has_start_doc_id_ = 0
1652 self.start_doc_id_ = ""
1654 def has_start_doc_id(self): return self.has_start_doc_id_
1656 def include_start_doc(self): return self.include_start_doc_
1658 def set_include_start_doc(self, x):
1659 self.has_include_start_doc_ = 1
1660 self.include_start_doc_ = x
1662 def clear_include_start_doc(self):
1663 if self.has_include_start_doc_:
1664 self.has_include_start_doc_ = 0
1665 self.include_start_doc_ = 1
1667 def has_include_start_doc(self): return self.has_include_start_doc_
1669 def limit(self): return self.limit_
1671 def set_limit(self, x):
1672 self.has_limit_ = 1
1673 self.limit_ = x
1675 def clear_limit(self):
1676 if self.has_limit_:
1677 self.has_limit_ = 0
1678 self.limit_ = 100
1680 def has_limit(self): return self.has_limit_
1682 def keys_only(self): return self.keys_only_
1684 def set_keys_only(self, x):
1685 self.has_keys_only_ = 1
1686 self.keys_only_ = x
1688 def clear_keys_only(self):
1689 if self.has_keys_only_:
1690 self.has_keys_only_ = 0
1691 self.keys_only_ = 0
1693 def has_keys_only(self): return self.has_keys_only_
1696 def MergeFrom(self, x):
1697 assert x is not self
1698 if (x.has_index_spec()): self.mutable_index_spec().MergeFrom(x.index_spec())
1699 if (x.has_start_doc_id()): self.set_start_doc_id(x.start_doc_id())
1700 if (x.has_include_start_doc()): self.set_include_start_doc(x.include_start_doc())
1701 if (x.has_limit()): self.set_limit(x.limit())
1702 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
1704 def Equals(self, x):
1705 if x is self: return 1
1706 if self.has_index_spec_ != x.has_index_spec_: return 0
1707 if self.has_index_spec_ and self.index_spec_ != x.index_spec_: return 0
1708 if self.has_start_doc_id_ != x.has_start_doc_id_: return 0
1709 if self.has_start_doc_id_ and self.start_doc_id_ != x.start_doc_id_: return 0
1710 if self.has_include_start_doc_ != x.has_include_start_doc_: return 0
1711 if self.has_include_start_doc_ and self.include_start_doc_ != x.include_start_doc_: return 0
1712 if self.has_limit_ != x.has_limit_: return 0
1713 if self.has_limit_ and self.limit_ != x.limit_: return 0
1714 if self.has_keys_only_ != x.has_keys_only_: return 0
1715 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
1716 return 1
1718 def IsInitialized(self, debug_strs=None):
1719 initialized = 1
1720 if (not self.has_index_spec_):
1721 initialized = 0
1722 if debug_strs is not None:
1723 debug_strs.append('Required field: index_spec not set.')
1724 elif not self.index_spec_.IsInitialized(debug_strs): initialized = 0
1725 return initialized
1727 def ByteSize(self):
1728 n = 0
1729 n += self.lengthString(self.index_spec_.ByteSize())
1730 if (self.has_start_doc_id_): n += 1 + self.lengthString(len(self.start_doc_id_))
1731 if (self.has_include_start_doc_): n += 2
1732 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
1733 if (self.has_keys_only_): n += 2
1734 return n + 1
1736 def ByteSizePartial(self):
1737 n = 0
1738 if (self.has_index_spec_):
1739 n += 1
1740 n += self.lengthString(self.index_spec_.ByteSizePartial())
1741 if (self.has_start_doc_id_): n += 1 + self.lengthString(len(self.start_doc_id_))
1742 if (self.has_include_start_doc_): n += 2
1743 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
1744 if (self.has_keys_only_): n += 2
1745 return n
1747 def Clear(self):
1748 self.clear_index_spec()
1749 self.clear_start_doc_id()
1750 self.clear_include_start_doc()
1751 self.clear_limit()
1752 self.clear_keys_only()
1754 def OutputUnchecked(self, out):
1755 out.putVarInt32(10)
1756 out.putVarInt32(self.index_spec_.ByteSize())
1757 self.index_spec_.OutputUnchecked(out)
1758 if (self.has_start_doc_id_):
1759 out.putVarInt32(18)
1760 out.putPrefixedString(self.start_doc_id_)
1761 if (self.has_include_start_doc_):
1762 out.putVarInt32(24)
1763 out.putBoolean(self.include_start_doc_)
1764 if (self.has_limit_):
1765 out.putVarInt32(32)
1766 out.putVarInt32(self.limit_)
1767 if (self.has_keys_only_):
1768 out.putVarInt32(40)
1769 out.putBoolean(self.keys_only_)
1771 def OutputPartial(self, out):
1772 if (self.has_index_spec_):
1773 out.putVarInt32(10)
1774 out.putVarInt32(self.index_spec_.ByteSizePartial())
1775 self.index_spec_.OutputPartial(out)
1776 if (self.has_start_doc_id_):
1777 out.putVarInt32(18)
1778 out.putPrefixedString(self.start_doc_id_)
1779 if (self.has_include_start_doc_):
1780 out.putVarInt32(24)
1781 out.putBoolean(self.include_start_doc_)
1782 if (self.has_limit_):
1783 out.putVarInt32(32)
1784 out.putVarInt32(self.limit_)
1785 if (self.has_keys_only_):
1786 out.putVarInt32(40)
1787 out.putBoolean(self.keys_only_)
1789 def TryMerge(self, d):
1790 while d.avail() > 0:
1791 tt = d.getVarInt32()
1792 if tt == 10:
1793 length = d.getVarInt32()
1794 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1795 d.skip(length)
1796 self.mutable_index_spec().TryMerge(tmp)
1797 continue
1798 if tt == 18:
1799 self.set_start_doc_id(d.getPrefixedString())
1800 continue
1801 if tt == 24:
1802 self.set_include_start_doc(d.getBoolean())
1803 continue
1804 if tt == 32:
1805 self.set_limit(d.getVarInt32())
1806 continue
1807 if tt == 40:
1808 self.set_keys_only(d.getBoolean())
1809 continue
1812 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1813 d.skipData(tt)
1816 def __str__(self, prefix="", printElemNumber=0):
1817 res=""
1818 if self.has_index_spec_:
1819 res+=prefix+"index_spec <\n"
1820 res+=self.index_spec_.__str__(prefix + " ", printElemNumber)
1821 res+=prefix+">\n"
1822 if self.has_start_doc_id_: res+=prefix+("start_doc_id: %s\n" % self.DebugFormatString(self.start_doc_id_))
1823 if self.has_include_start_doc_: res+=prefix+("include_start_doc: %s\n" % self.DebugFormatBool(self.include_start_doc_))
1824 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
1825 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
1826 return res
1829 def _BuildTagLookupTable(sparse, maxtag, default=None):
1830 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1832 kindex_spec = 1
1833 kstart_doc_id = 2
1834 kinclude_start_doc = 3
1835 klimit = 4
1836 kkeys_only = 5
1838 _TEXT = _BuildTagLookupTable({
1839 0: "ErrorCode",
1840 1: "index_spec",
1841 2: "start_doc_id",
1842 3: "include_start_doc",
1843 4: "limit",
1844 5: "keys_only",
1845 }, 5)
1847 _TYPES = _BuildTagLookupTable({
1848 0: ProtocolBuffer.Encoder.NUMERIC,
1849 1: ProtocolBuffer.Encoder.STRING,
1850 2: ProtocolBuffer.Encoder.STRING,
1851 3: ProtocolBuffer.Encoder.NUMERIC,
1852 4: ProtocolBuffer.Encoder.NUMERIC,
1853 5: ProtocolBuffer.Encoder.NUMERIC,
1854 }, 5, ProtocolBuffer.Encoder.MAX_TYPE)
1857 _STYLE = """"""
1858 _STYLE_CONTENT_TYPE = """"""
1859 _PROTO_DESCRIPTOR_NAME = 'apphosting.ListDocumentsParams'
1860 class ListDocumentsRequest(ProtocolBuffer.ProtocolMessage):
1861 has_params_ = 0
1862 has_app_id_ = 0
1863 app_id_ = ""
1865 def __init__(self, contents=None):
1866 self.params_ = ListDocumentsParams()
1867 if contents is not None: self.MergeFromString(contents)
1869 def params(self): return self.params_
1871 def mutable_params(self): self.has_params_ = 1; return self.params_
1873 def clear_params(self):self.has_params_ = 0; self.params_.Clear()
1875 def has_params(self): return self.has_params_
1877 def app_id(self): return self.app_id_
1879 def set_app_id(self, x):
1880 self.has_app_id_ = 1
1881 self.app_id_ = x
1883 def clear_app_id(self):
1884 if self.has_app_id_:
1885 self.has_app_id_ = 0
1886 self.app_id_ = ""
1888 def has_app_id(self): return self.has_app_id_
1891 def MergeFrom(self, x):
1892 assert x is not self
1893 if (x.has_params()): self.mutable_params().MergeFrom(x.params())
1894 if (x.has_app_id()): self.set_app_id(x.app_id())
1896 def Equals(self, x):
1897 if x is self: return 1
1898 if self.has_params_ != x.has_params_: return 0
1899 if self.has_params_ and self.params_ != x.params_: return 0
1900 if self.has_app_id_ != x.has_app_id_: return 0
1901 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0
1902 return 1
1904 def IsInitialized(self, debug_strs=None):
1905 initialized = 1
1906 if (not self.has_params_):
1907 initialized = 0
1908 if debug_strs is not None:
1909 debug_strs.append('Required field: params not set.')
1910 elif not self.params_.IsInitialized(debug_strs): initialized = 0
1911 return initialized
1913 def ByteSize(self):
1914 n = 0
1915 n += self.lengthString(self.params_.ByteSize())
1916 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
1917 return n + 1
1919 def ByteSizePartial(self):
1920 n = 0
1921 if (self.has_params_):
1922 n += 1
1923 n += self.lengthString(self.params_.ByteSizePartial())
1924 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
1925 return n
1927 def Clear(self):
1928 self.clear_params()
1929 self.clear_app_id()
1931 def OutputUnchecked(self, out):
1932 out.putVarInt32(10)
1933 out.putVarInt32(self.params_.ByteSize())
1934 self.params_.OutputUnchecked(out)
1935 if (self.has_app_id_):
1936 out.putVarInt32(18)
1937 out.putPrefixedString(self.app_id_)
1939 def OutputPartial(self, out):
1940 if (self.has_params_):
1941 out.putVarInt32(10)
1942 out.putVarInt32(self.params_.ByteSizePartial())
1943 self.params_.OutputPartial(out)
1944 if (self.has_app_id_):
1945 out.putVarInt32(18)
1946 out.putPrefixedString(self.app_id_)
1948 def TryMerge(self, d):
1949 while d.avail() > 0:
1950 tt = d.getVarInt32()
1951 if tt == 10:
1952 length = d.getVarInt32()
1953 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
1954 d.skip(length)
1955 self.mutable_params().TryMerge(tmp)
1956 continue
1957 if tt == 18:
1958 self.set_app_id(d.getPrefixedString())
1959 continue
1962 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
1963 d.skipData(tt)
1966 def __str__(self, prefix="", printElemNumber=0):
1967 res=""
1968 if self.has_params_:
1969 res+=prefix+"params <\n"
1970 res+=self.params_.__str__(prefix + " ", printElemNumber)
1971 res+=prefix+">\n"
1972 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_))
1973 return res
1976 def _BuildTagLookupTable(sparse, maxtag, default=None):
1977 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
1979 kparams = 1
1980 kapp_id = 2
1982 _TEXT = _BuildTagLookupTable({
1983 0: "ErrorCode",
1984 1: "params",
1985 2: "app_id",
1986 }, 2)
1988 _TYPES = _BuildTagLookupTable({
1989 0: ProtocolBuffer.Encoder.NUMERIC,
1990 1: ProtocolBuffer.Encoder.STRING,
1991 2: ProtocolBuffer.Encoder.STRING,
1992 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
1995 _STYLE = """"""
1996 _STYLE_CONTENT_TYPE = """"""
1997 _PROTO_DESCRIPTOR_NAME = 'apphosting.ListDocumentsRequest'
1998 class ListDocumentsResponse(ProtocolBuffer.ProtocolMessage):
1999 has_status_ = 0
2001 def __init__(self, contents=None):
2002 self.status_ = RequestStatus()
2003 self.document_ = []
2004 if contents is not None: self.MergeFromString(contents)
2006 def status(self): return self.status_
2008 def mutable_status(self): self.has_status_ = 1; return self.status_
2010 def clear_status(self):self.has_status_ = 0; self.status_.Clear()
2012 def has_status(self): return self.has_status_
2014 def document_size(self): return len(self.document_)
2015 def document_list(self): return self.document_
2017 def document(self, i):
2018 return self.document_[i]
2020 def mutable_document(self, i):
2021 return self.document_[i]
2023 def add_document(self):
2024 x = Document()
2025 self.document_.append(x)
2026 return x
2028 def clear_document(self):
2029 self.document_ = []
2031 def MergeFrom(self, x):
2032 assert x is not self
2033 if (x.has_status()): self.mutable_status().MergeFrom(x.status())
2034 for i in xrange(x.document_size()): self.add_document().CopyFrom(x.document(i))
2036 def Equals(self, x):
2037 if x is self: return 1
2038 if self.has_status_ != x.has_status_: return 0
2039 if self.has_status_ and self.status_ != x.status_: return 0
2040 if len(self.document_) != len(x.document_): return 0
2041 for e1, e2 in zip(self.document_, x.document_):
2042 if e1 != e2: return 0
2043 return 1
2045 def IsInitialized(self, debug_strs=None):
2046 initialized = 1
2047 if (not self.has_status_):
2048 initialized = 0
2049 if debug_strs is not None:
2050 debug_strs.append('Required field: status not set.')
2051 elif not self.status_.IsInitialized(debug_strs): initialized = 0
2052 for p in self.document_:
2053 if not p.IsInitialized(debug_strs): initialized=0
2054 return initialized
2056 def ByteSize(self):
2057 n = 0
2058 n += self.lengthString(self.status_.ByteSize())
2059 n += 1 * len(self.document_)
2060 for i in xrange(len(self.document_)): n += self.lengthString(self.document_[i].ByteSize())
2061 return n + 1
2063 def ByteSizePartial(self):
2064 n = 0
2065 if (self.has_status_):
2066 n += 1
2067 n += self.lengthString(self.status_.ByteSizePartial())
2068 n += 1 * len(self.document_)
2069 for i in xrange(len(self.document_)): n += self.lengthString(self.document_[i].ByteSizePartial())
2070 return n
2072 def Clear(self):
2073 self.clear_status()
2074 self.clear_document()
2076 def OutputUnchecked(self, out):
2077 out.putVarInt32(10)
2078 out.putVarInt32(self.status_.ByteSize())
2079 self.status_.OutputUnchecked(out)
2080 for i in xrange(len(self.document_)):
2081 out.putVarInt32(18)
2082 out.putVarInt32(self.document_[i].ByteSize())
2083 self.document_[i].OutputUnchecked(out)
2085 def OutputPartial(self, out):
2086 if (self.has_status_):
2087 out.putVarInt32(10)
2088 out.putVarInt32(self.status_.ByteSizePartial())
2089 self.status_.OutputPartial(out)
2090 for i in xrange(len(self.document_)):
2091 out.putVarInt32(18)
2092 out.putVarInt32(self.document_[i].ByteSizePartial())
2093 self.document_[i].OutputPartial(out)
2095 def TryMerge(self, d):
2096 while d.avail() > 0:
2097 tt = d.getVarInt32()
2098 if tt == 10:
2099 length = d.getVarInt32()
2100 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2101 d.skip(length)
2102 self.mutable_status().TryMerge(tmp)
2103 continue
2104 if tt == 18:
2105 length = d.getVarInt32()
2106 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2107 d.skip(length)
2108 self.add_document().TryMerge(tmp)
2109 continue
2112 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2113 d.skipData(tt)
2116 def __str__(self, prefix="", printElemNumber=0):
2117 res=""
2118 if self.has_status_:
2119 res+=prefix+"status <\n"
2120 res+=self.status_.__str__(prefix + " ", printElemNumber)
2121 res+=prefix+">\n"
2122 cnt=0
2123 for e in self.document_:
2124 elm=""
2125 if printElemNumber: elm="(%d)" % cnt
2126 res+=prefix+("document%s <\n" % elm)
2127 res+=e.__str__(prefix + " ", printElemNumber)
2128 res+=prefix+">\n"
2129 cnt+=1
2130 return res
2133 def _BuildTagLookupTable(sparse, maxtag, default=None):
2134 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
2136 kstatus = 1
2137 kdocument = 2
2139 _TEXT = _BuildTagLookupTable({
2140 0: "ErrorCode",
2141 1: "status",
2142 2: "document",
2143 }, 2)
2145 _TYPES = _BuildTagLookupTable({
2146 0: ProtocolBuffer.Encoder.NUMERIC,
2147 1: ProtocolBuffer.Encoder.STRING,
2148 2: ProtocolBuffer.Encoder.STRING,
2149 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
2152 _STYLE = """"""
2153 _STYLE_CONTENT_TYPE = """"""
2154 _PROTO_DESCRIPTOR_NAME = 'apphosting.ListDocumentsResponse'
2155 class ListIndexesParams(ProtocolBuffer.ProtocolMessage):
2156 has_fetch_schema_ = 0
2157 fetch_schema_ = 0
2158 has_limit_ = 0
2159 limit_ = 20
2160 has_namespace_ = 0
2161 namespace_ = ""
2162 has_start_index_name_ = 0
2163 start_index_name_ = ""
2164 has_include_start_index_ = 0
2165 include_start_index_ = 1
2166 has_index_name_prefix_ = 0
2167 index_name_prefix_ = ""
2168 has_offset_ = 0
2169 offset_ = 0
2170 has_source_ = 0
2171 source_ = 0
2173 def __init__(self, contents=None):
2174 if contents is not None: self.MergeFromString(contents)
2176 def fetch_schema(self): return self.fetch_schema_
2178 def set_fetch_schema(self, x):
2179 self.has_fetch_schema_ = 1
2180 self.fetch_schema_ = x
2182 def clear_fetch_schema(self):
2183 if self.has_fetch_schema_:
2184 self.has_fetch_schema_ = 0
2185 self.fetch_schema_ = 0
2187 def has_fetch_schema(self): return self.has_fetch_schema_
2189 def limit(self): return self.limit_
2191 def set_limit(self, x):
2192 self.has_limit_ = 1
2193 self.limit_ = x
2195 def clear_limit(self):
2196 if self.has_limit_:
2197 self.has_limit_ = 0
2198 self.limit_ = 20
2200 def has_limit(self): return self.has_limit_
2202 def namespace(self): return self.namespace_
2204 def set_namespace(self, x):
2205 self.has_namespace_ = 1
2206 self.namespace_ = x
2208 def clear_namespace(self):
2209 if self.has_namespace_:
2210 self.has_namespace_ = 0
2211 self.namespace_ = ""
2213 def has_namespace(self): return self.has_namespace_
2215 def start_index_name(self): return self.start_index_name_
2217 def set_start_index_name(self, x):
2218 self.has_start_index_name_ = 1
2219 self.start_index_name_ = x
2221 def clear_start_index_name(self):
2222 if self.has_start_index_name_:
2223 self.has_start_index_name_ = 0
2224 self.start_index_name_ = ""
2226 def has_start_index_name(self): return self.has_start_index_name_
2228 def include_start_index(self): return self.include_start_index_
2230 def set_include_start_index(self, x):
2231 self.has_include_start_index_ = 1
2232 self.include_start_index_ = x
2234 def clear_include_start_index(self):
2235 if self.has_include_start_index_:
2236 self.has_include_start_index_ = 0
2237 self.include_start_index_ = 1
2239 def has_include_start_index(self): return self.has_include_start_index_
2241 def index_name_prefix(self): return self.index_name_prefix_
2243 def set_index_name_prefix(self, x):
2244 self.has_index_name_prefix_ = 1
2245 self.index_name_prefix_ = x
2247 def clear_index_name_prefix(self):
2248 if self.has_index_name_prefix_:
2249 self.has_index_name_prefix_ = 0
2250 self.index_name_prefix_ = ""
2252 def has_index_name_prefix(self): return self.has_index_name_prefix_
2254 def offset(self): return self.offset_
2256 def set_offset(self, x):
2257 self.has_offset_ = 1
2258 self.offset_ = x
2260 def clear_offset(self):
2261 if self.has_offset_:
2262 self.has_offset_ = 0
2263 self.offset_ = 0
2265 def has_offset(self): return self.has_offset_
2267 def source(self): return self.source_
2269 def set_source(self, x):
2270 self.has_source_ = 1
2271 self.source_ = x
2273 def clear_source(self):
2274 if self.has_source_:
2275 self.has_source_ = 0
2276 self.source_ = 0
2278 def has_source(self): return self.has_source_
2281 def MergeFrom(self, x):
2282 assert x is not self
2283 if (x.has_fetch_schema()): self.set_fetch_schema(x.fetch_schema())
2284 if (x.has_limit()): self.set_limit(x.limit())
2285 if (x.has_namespace()): self.set_namespace(x.namespace())
2286 if (x.has_start_index_name()): self.set_start_index_name(x.start_index_name())
2287 if (x.has_include_start_index()): self.set_include_start_index(x.include_start_index())
2288 if (x.has_index_name_prefix()): self.set_index_name_prefix(x.index_name_prefix())
2289 if (x.has_offset()): self.set_offset(x.offset())
2290 if (x.has_source()): self.set_source(x.source())
2292 def Equals(self, x):
2293 if x is self: return 1
2294 if self.has_fetch_schema_ != x.has_fetch_schema_: return 0
2295 if self.has_fetch_schema_ and self.fetch_schema_ != x.fetch_schema_: return 0
2296 if self.has_limit_ != x.has_limit_: return 0
2297 if self.has_limit_ and self.limit_ != x.limit_: return 0
2298 if self.has_namespace_ != x.has_namespace_: return 0
2299 if self.has_namespace_ and self.namespace_ != x.namespace_: return 0
2300 if self.has_start_index_name_ != x.has_start_index_name_: return 0
2301 if self.has_start_index_name_ and self.start_index_name_ != x.start_index_name_: return 0
2302 if self.has_include_start_index_ != x.has_include_start_index_: return 0
2303 if self.has_include_start_index_ and self.include_start_index_ != x.include_start_index_: return 0
2304 if self.has_index_name_prefix_ != x.has_index_name_prefix_: return 0
2305 if self.has_index_name_prefix_ and self.index_name_prefix_ != x.index_name_prefix_: return 0
2306 if self.has_offset_ != x.has_offset_: return 0
2307 if self.has_offset_ and self.offset_ != x.offset_: return 0
2308 if self.has_source_ != x.has_source_: return 0
2309 if self.has_source_ and self.source_ != x.source_: return 0
2310 return 1
2312 def IsInitialized(self, debug_strs=None):
2313 initialized = 1
2314 return initialized
2316 def ByteSize(self):
2317 n = 0
2318 if (self.has_fetch_schema_): n += 2
2319 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
2320 if (self.has_namespace_): n += 1 + self.lengthString(len(self.namespace_))
2321 if (self.has_start_index_name_): n += 1 + self.lengthString(len(self.start_index_name_))
2322 if (self.has_include_start_index_): n += 2
2323 if (self.has_index_name_prefix_): n += 1 + self.lengthString(len(self.index_name_prefix_))
2324 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
2325 if (self.has_source_): n += 1 + self.lengthVarInt64(self.source_)
2326 return n
2328 def ByteSizePartial(self):
2329 n = 0
2330 if (self.has_fetch_schema_): n += 2
2331 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
2332 if (self.has_namespace_): n += 1 + self.lengthString(len(self.namespace_))
2333 if (self.has_start_index_name_): n += 1 + self.lengthString(len(self.start_index_name_))
2334 if (self.has_include_start_index_): n += 2
2335 if (self.has_index_name_prefix_): n += 1 + self.lengthString(len(self.index_name_prefix_))
2336 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
2337 if (self.has_source_): n += 1 + self.lengthVarInt64(self.source_)
2338 return n
2340 def Clear(self):
2341 self.clear_fetch_schema()
2342 self.clear_limit()
2343 self.clear_namespace()
2344 self.clear_start_index_name()
2345 self.clear_include_start_index()
2346 self.clear_index_name_prefix()
2347 self.clear_offset()
2348 self.clear_source()
2350 def OutputUnchecked(self, out):
2351 if (self.has_fetch_schema_):
2352 out.putVarInt32(8)
2353 out.putBoolean(self.fetch_schema_)
2354 if (self.has_limit_):
2355 out.putVarInt32(16)
2356 out.putVarInt32(self.limit_)
2357 if (self.has_namespace_):
2358 out.putVarInt32(26)
2359 out.putPrefixedString(self.namespace_)
2360 if (self.has_start_index_name_):
2361 out.putVarInt32(34)
2362 out.putPrefixedString(self.start_index_name_)
2363 if (self.has_include_start_index_):
2364 out.putVarInt32(40)
2365 out.putBoolean(self.include_start_index_)
2366 if (self.has_index_name_prefix_):
2367 out.putVarInt32(50)
2368 out.putPrefixedString(self.index_name_prefix_)
2369 if (self.has_offset_):
2370 out.putVarInt32(56)
2371 out.putVarInt32(self.offset_)
2372 if (self.has_source_):
2373 out.putVarInt32(64)
2374 out.putVarInt32(self.source_)
2376 def OutputPartial(self, out):
2377 if (self.has_fetch_schema_):
2378 out.putVarInt32(8)
2379 out.putBoolean(self.fetch_schema_)
2380 if (self.has_limit_):
2381 out.putVarInt32(16)
2382 out.putVarInt32(self.limit_)
2383 if (self.has_namespace_):
2384 out.putVarInt32(26)
2385 out.putPrefixedString(self.namespace_)
2386 if (self.has_start_index_name_):
2387 out.putVarInt32(34)
2388 out.putPrefixedString(self.start_index_name_)
2389 if (self.has_include_start_index_):
2390 out.putVarInt32(40)
2391 out.putBoolean(self.include_start_index_)
2392 if (self.has_index_name_prefix_):
2393 out.putVarInt32(50)
2394 out.putPrefixedString(self.index_name_prefix_)
2395 if (self.has_offset_):
2396 out.putVarInt32(56)
2397 out.putVarInt32(self.offset_)
2398 if (self.has_source_):
2399 out.putVarInt32(64)
2400 out.putVarInt32(self.source_)
2402 def TryMerge(self, d):
2403 while d.avail() > 0:
2404 tt = d.getVarInt32()
2405 if tt == 8:
2406 self.set_fetch_schema(d.getBoolean())
2407 continue
2408 if tt == 16:
2409 self.set_limit(d.getVarInt32())
2410 continue
2411 if tt == 26:
2412 self.set_namespace(d.getPrefixedString())
2413 continue
2414 if tt == 34:
2415 self.set_start_index_name(d.getPrefixedString())
2416 continue
2417 if tt == 40:
2418 self.set_include_start_index(d.getBoolean())
2419 continue
2420 if tt == 50:
2421 self.set_index_name_prefix(d.getPrefixedString())
2422 continue
2423 if tt == 56:
2424 self.set_offset(d.getVarInt32())
2425 continue
2426 if tt == 64:
2427 self.set_source(d.getVarInt32())
2428 continue
2431 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2432 d.skipData(tt)
2435 def __str__(self, prefix="", printElemNumber=0):
2436 res=""
2437 if self.has_fetch_schema_: res+=prefix+("fetch_schema: %s\n" % self.DebugFormatBool(self.fetch_schema_))
2438 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
2439 if self.has_namespace_: res+=prefix+("namespace: %s\n" % self.DebugFormatString(self.namespace_))
2440 if self.has_start_index_name_: res+=prefix+("start_index_name: %s\n" % self.DebugFormatString(self.start_index_name_))
2441 if self.has_include_start_index_: res+=prefix+("include_start_index: %s\n" % self.DebugFormatBool(self.include_start_index_))
2442 if self.has_index_name_prefix_: res+=prefix+("index_name_prefix: %s\n" % self.DebugFormatString(self.index_name_prefix_))
2443 if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
2444 if self.has_source_: res+=prefix+("source: %s\n" % self.DebugFormatInt32(self.source_))
2445 return res
2448 def _BuildTagLookupTable(sparse, maxtag, default=None):
2449 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
2451 kfetch_schema = 1
2452 klimit = 2
2453 knamespace = 3
2454 kstart_index_name = 4
2455 kinclude_start_index = 5
2456 kindex_name_prefix = 6
2457 koffset = 7
2458 ksource = 8
2460 _TEXT = _BuildTagLookupTable({
2461 0: "ErrorCode",
2462 1: "fetch_schema",
2463 2: "limit",
2464 3: "namespace",
2465 4: "start_index_name",
2466 5: "include_start_index",
2467 6: "index_name_prefix",
2468 7: "offset",
2469 8: "source",
2470 }, 8)
2472 _TYPES = _BuildTagLookupTable({
2473 0: ProtocolBuffer.Encoder.NUMERIC,
2474 1: ProtocolBuffer.Encoder.NUMERIC,
2475 2: ProtocolBuffer.Encoder.NUMERIC,
2476 3: ProtocolBuffer.Encoder.STRING,
2477 4: ProtocolBuffer.Encoder.STRING,
2478 5: ProtocolBuffer.Encoder.NUMERIC,
2479 6: ProtocolBuffer.Encoder.STRING,
2480 7: ProtocolBuffer.Encoder.NUMERIC,
2481 8: ProtocolBuffer.Encoder.NUMERIC,
2482 }, 8, ProtocolBuffer.Encoder.MAX_TYPE)
2485 _STYLE = """"""
2486 _STYLE_CONTENT_TYPE = """"""
2487 _PROTO_DESCRIPTOR_NAME = 'apphosting.ListIndexesParams'
2488 class ListIndexesRequest(ProtocolBuffer.ProtocolMessage):
2489 has_params_ = 0
2490 has_app_id_ = 0
2491 app_id_ = ""
2493 def __init__(self, contents=None):
2494 self.params_ = ListIndexesParams()
2495 if contents is not None: self.MergeFromString(contents)
2497 def params(self): return self.params_
2499 def mutable_params(self): self.has_params_ = 1; return self.params_
2501 def clear_params(self):self.has_params_ = 0; self.params_.Clear()
2503 def has_params(self): return self.has_params_
2505 def app_id(self): return self.app_id_
2507 def set_app_id(self, x):
2508 self.has_app_id_ = 1
2509 self.app_id_ = x
2511 def clear_app_id(self):
2512 if self.has_app_id_:
2513 self.has_app_id_ = 0
2514 self.app_id_ = ""
2516 def has_app_id(self): return self.has_app_id_
2519 def MergeFrom(self, x):
2520 assert x is not self
2521 if (x.has_params()): self.mutable_params().MergeFrom(x.params())
2522 if (x.has_app_id()): self.set_app_id(x.app_id())
2524 def Equals(self, x):
2525 if x is self: return 1
2526 if self.has_params_ != x.has_params_: return 0
2527 if self.has_params_ and self.params_ != x.params_: return 0
2528 if self.has_app_id_ != x.has_app_id_: return 0
2529 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0
2530 return 1
2532 def IsInitialized(self, debug_strs=None):
2533 initialized = 1
2534 if (not self.has_params_):
2535 initialized = 0
2536 if debug_strs is not None:
2537 debug_strs.append('Required field: params not set.')
2538 elif not self.params_.IsInitialized(debug_strs): initialized = 0
2539 return initialized
2541 def ByteSize(self):
2542 n = 0
2543 n += self.lengthString(self.params_.ByteSize())
2544 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
2545 return n + 1
2547 def ByteSizePartial(self):
2548 n = 0
2549 if (self.has_params_):
2550 n += 1
2551 n += self.lengthString(self.params_.ByteSizePartial())
2552 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
2553 return n
2555 def Clear(self):
2556 self.clear_params()
2557 self.clear_app_id()
2559 def OutputUnchecked(self, out):
2560 out.putVarInt32(10)
2561 out.putVarInt32(self.params_.ByteSize())
2562 self.params_.OutputUnchecked(out)
2563 if (self.has_app_id_):
2564 out.putVarInt32(26)
2565 out.putPrefixedString(self.app_id_)
2567 def OutputPartial(self, out):
2568 if (self.has_params_):
2569 out.putVarInt32(10)
2570 out.putVarInt32(self.params_.ByteSizePartial())
2571 self.params_.OutputPartial(out)
2572 if (self.has_app_id_):
2573 out.putVarInt32(26)
2574 out.putPrefixedString(self.app_id_)
2576 def TryMerge(self, d):
2577 while d.avail() > 0:
2578 tt = d.getVarInt32()
2579 if tt == 10:
2580 length = d.getVarInt32()
2581 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2582 d.skip(length)
2583 self.mutable_params().TryMerge(tmp)
2584 continue
2585 if tt == 26:
2586 self.set_app_id(d.getPrefixedString())
2587 continue
2590 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2591 d.skipData(tt)
2594 def __str__(self, prefix="", printElemNumber=0):
2595 res=""
2596 if self.has_params_:
2597 res+=prefix+"params <\n"
2598 res+=self.params_.__str__(prefix + " ", printElemNumber)
2599 res+=prefix+">\n"
2600 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_))
2601 return res
2604 def _BuildTagLookupTable(sparse, maxtag, default=None):
2605 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
2607 kparams = 1
2608 kapp_id = 3
2610 _TEXT = _BuildTagLookupTable({
2611 0: "ErrorCode",
2612 1: "params",
2613 3: "app_id",
2614 }, 3)
2616 _TYPES = _BuildTagLookupTable({
2617 0: ProtocolBuffer.Encoder.NUMERIC,
2618 1: ProtocolBuffer.Encoder.STRING,
2619 3: ProtocolBuffer.Encoder.STRING,
2620 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
2623 _STYLE = """"""
2624 _STYLE_CONTENT_TYPE = """"""
2625 _PROTO_DESCRIPTOR_NAME = 'apphosting.ListIndexesRequest'
2626 class ListIndexesResponse(ProtocolBuffer.ProtocolMessage):
2627 has_status_ = 0
2629 def __init__(self, contents=None):
2630 self.status_ = RequestStatus()
2631 self.index_metadata_ = []
2632 if contents is not None: self.MergeFromString(contents)
2634 def status(self): return self.status_
2636 def mutable_status(self): self.has_status_ = 1; return self.status_
2638 def clear_status(self):self.has_status_ = 0; self.status_.Clear()
2640 def has_status(self): return self.has_status_
2642 def index_metadata_size(self): return len(self.index_metadata_)
2643 def index_metadata_list(self): return self.index_metadata_
2645 def index_metadata(self, i):
2646 return self.index_metadata_[i]
2648 def mutable_index_metadata(self, i):
2649 return self.index_metadata_[i]
2651 def add_index_metadata(self):
2652 x = IndexMetadata()
2653 self.index_metadata_.append(x)
2654 return x
2656 def clear_index_metadata(self):
2657 self.index_metadata_ = []
2659 def MergeFrom(self, x):
2660 assert x is not self
2661 if (x.has_status()): self.mutable_status().MergeFrom(x.status())
2662 for i in xrange(x.index_metadata_size()): self.add_index_metadata().CopyFrom(x.index_metadata(i))
2664 def Equals(self, x):
2665 if x is self: return 1
2666 if self.has_status_ != x.has_status_: return 0
2667 if self.has_status_ and self.status_ != x.status_: return 0
2668 if len(self.index_metadata_) != len(x.index_metadata_): return 0
2669 for e1, e2 in zip(self.index_metadata_, x.index_metadata_):
2670 if e1 != e2: return 0
2671 return 1
2673 def IsInitialized(self, debug_strs=None):
2674 initialized = 1
2675 if (not self.has_status_):
2676 initialized = 0
2677 if debug_strs is not None:
2678 debug_strs.append('Required field: status not set.')
2679 elif not self.status_.IsInitialized(debug_strs): initialized = 0
2680 for p in self.index_metadata_:
2681 if not p.IsInitialized(debug_strs): initialized=0
2682 return initialized
2684 def ByteSize(self):
2685 n = 0
2686 n += self.lengthString(self.status_.ByteSize())
2687 n += 1 * len(self.index_metadata_)
2688 for i in xrange(len(self.index_metadata_)): n += self.lengthString(self.index_metadata_[i].ByteSize())
2689 return n + 1
2691 def ByteSizePartial(self):
2692 n = 0
2693 if (self.has_status_):
2694 n += 1
2695 n += self.lengthString(self.status_.ByteSizePartial())
2696 n += 1 * len(self.index_metadata_)
2697 for i in xrange(len(self.index_metadata_)): n += self.lengthString(self.index_metadata_[i].ByteSizePartial())
2698 return n
2700 def Clear(self):
2701 self.clear_status()
2702 self.clear_index_metadata()
2704 def OutputUnchecked(self, out):
2705 out.putVarInt32(10)
2706 out.putVarInt32(self.status_.ByteSize())
2707 self.status_.OutputUnchecked(out)
2708 for i in xrange(len(self.index_metadata_)):
2709 out.putVarInt32(18)
2710 out.putVarInt32(self.index_metadata_[i].ByteSize())
2711 self.index_metadata_[i].OutputUnchecked(out)
2713 def OutputPartial(self, out):
2714 if (self.has_status_):
2715 out.putVarInt32(10)
2716 out.putVarInt32(self.status_.ByteSizePartial())
2717 self.status_.OutputPartial(out)
2718 for i in xrange(len(self.index_metadata_)):
2719 out.putVarInt32(18)
2720 out.putVarInt32(self.index_metadata_[i].ByteSizePartial())
2721 self.index_metadata_[i].OutputPartial(out)
2723 def TryMerge(self, d):
2724 while d.avail() > 0:
2725 tt = d.getVarInt32()
2726 if tt == 10:
2727 length = d.getVarInt32()
2728 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2729 d.skip(length)
2730 self.mutable_status().TryMerge(tmp)
2731 continue
2732 if tt == 18:
2733 length = d.getVarInt32()
2734 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2735 d.skip(length)
2736 self.add_index_metadata().TryMerge(tmp)
2737 continue
2740 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2741 d.skipData(tt)
2744 def __str__(self, prefix="", printElemNumber=0):
2745 res=""
2746 if self.has_status_:
2747 res+=prefix+"status <\n"
2748 res+=self.status_.__str__(prefix + " ", printElemNumber)
2749 res+=prefix+">\n"
2750 cnt=0
2751 for e in self.index_metadata_:
2752 elm=""
2753 if printElemNumber: elm="(%d)" % cnt
2754 res+=prefix+("index_metadata%s <\n" % elm)
2755 res+=e.__str__(prefix + " ", printElemNumber)
2756 res+=prefix+">\n"
2757 cnt+=1
2758 return res
2761 def _BuildTagLookupTable(sparse, maxtag, default=None):
2762 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
2764 kstatus = 1
2765 kindex_metadata = 2
2767 _TEXT = _BuildTagLookupTable({
2768 0: "ErrorCode",
2769 1: "status",
2770 2: "index_metadata",
2771 }, 2)
2773 _TYPES = _BuildTagLookupTable({
2774 0: ProtocolBuffer.Encoder.NUMERIC,
2775 1: ProtocolBuffer.Encoder.STRING,
2776 2: ProtocolBuffer.Encoder.STRING,
2777 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
2780 _STYLE = """"""
2781 _STYLE_CONTENT_TYPE = """"""
2782 _PROTO_DESCRIPTOR_NAME = 'apphosting.ListIndexesResponse'
2783 class DeleteSchemaParams(ProtocolBuffer.ProtocolMessage):
2784 has_source_ = 0
2785 source_ = 0
2787 def __init__(self, contents=None):
2788 self.index_spec_ = []
2789 if contents is not None: self.MergeFromString(contents)
2791 def source(self): return self.source_
2793 def set_source(self, x):
2794 self.has_source_ = 1
2795 self.source_ = x
2797 def clear_source(self):
2798 if self.has_source_:
2799 self.has_source_ = 0
2800 self.source_ = 0
2802 def has_source(self): return self.has_source_
2804 def index_spec_size(self): return len(self.index_spec_)
2805 def index_spec_list(self): return self.index_spec_
2807 def index_spec(self, i):
2808 return self.index_spec_[i]
2810 def mutable_index_spec(self, i):
2811 return self.index_spec_[i]
2813 def add_index_spec(self):
2814 x = IndexSpec()
2815 self.index_spec_.append(x)
2816 return x
2818 def clear_index_spec(self):
2819 self.index_spec_ = []
2821 def MergeFrom(self, x):
2822 assert x is not self
2823 if (x.has_source()): self.set_source(x.source())
2824 for i in xrange(x.index_spec_size()): self.add_index_spec().CopyFrom(x.index_spec(i))
2826 def Equals(self, x):
2827 if x is self: return 1
2828 if self.has_source_ != x.has_source_: return 0
2829 if self.has_source_ and self.source_ != x.source_: return 0
2830 if len(self.index_spec_) != len(x.index_spec_): return 0
2831 for e1, e2 in zip(self.index_spec_, x.index_spec_):
2832 if e1 != e2: return 0
2833 return 1
2835 def IsInitialized(self, debug_strs=None):
2836 initialized = 1
2837 for p in self.index_spec_:
2838 if not p.IsInitialized(debug_strs): initialized=0
2839 return initialized
2841 def ByteSize(self):
2842 n = 0
2843 if (self.has_source_): n += 1 + self.lengthVarInt64(self.source_)
2844 n += 1 * len(self.index_spec_)
2845 for i in xrange(len(self.index_spec_)): n += self.lengthString(self.index_spec_[i].ByteSize())
2846 return n
2848 def ByteSizePartial(self):
2849 n = 0
2850 if (self.has_source_): n += 1 + self.lengthVarInt64(self.source_)
2851 n += 1 * len(self.index_spec_)
2852 for i in xrange(len(self.index_spec_)): n += self.lengthString(self.index_spec_[i].ByteSizePartial())
2853 return n
2855 def Clear(self):
2856 self.clear_source()
2857 self.clear_index_spec()
2859 def OutputUnchecked(self, out):
2860 if (self.has_source_):
2861 out.putVarInt32(8)
2862 out.putVarInt32(self.source_)
2863 for i in xrange(len(self.index_spec_)):
2864 out.putVarInt32(18)
2865 out.putVarInt32(self.index_spec_[i].ByteSize())
2866 self.index_spec_[i].OutputUnchecked(out)
2868 def OutputPartial(self, out):
2869 if (self.has_source_):
2870 out.putVarInt32(8)
2871 out.putVarInt32(self.source_)
2872 for i in xrange(len(self.index_spec_)):
2873 out.putVarInt32(18)
2874 out.putVarInt32(self.index_spec_[i].ByteSizePartial())
2875 self.index_spec_[i].OutputPartial(out)
2877 def TryMerge(self, d):
2878 while d.avail() > 0:
2879 tt = d.getVarInt32()
2880 if tt == 8:
2881 self.set_source(d.getVarInt32())
2882 continue
2883 if tt == 18:
2884 length = d.getVarInt32()
2885 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
2886 d.skip(length)
2887 self.add_index_spec().TryMerge(tmp)
2888 continue
2891 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
2892 d.skipData(tt)
2895 def __str__(self, prefix="", printElemNumber=0):
2896 res=""
2897 if self.has_source_: res+=prefix+("source: %s\n" % self.DebugFormatInt32(self.source_))
2898 cnt=0
2899 for e in self.index_spec_:
2900 elm=""
2901 if printElemNumber: elm="(%d)" % cnt
2902 res+=prefix+("index_spec%s <\n" % elm)
2903 res+=e.__str__(prefix + " ", printElemNumber)
2904 res+=prefix+">\n"
2905 cnt+=1
2906 return res
2909 def _BuildTagLookupTable(sparse, maxtag, default=None):
2910 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
2912 ksource = 1
2913 kindex_spec = 2
2915 _TEXT = _BuildTagLookupTable({
2916 0: "ErrorCode",
2917 1: "source",
2918 2: "index_spec",
2919 }, 2)
2921 _TYPES = _BuildTagLookupTable({
2922 0: ProtocolBuffer.Encoder.NUMERIC,
2923 1: ProtocolBuffer.Encoder.NUMERIC,
2924 2: ProtocolBuffer.Encoder.STRING,
2925 }, 2, ProtocolBuffer.Encoder.MAX_TYPE)
2928 _STYLE = """"""
2929 _STYLE_CONTENT_TYPE = """"""
2930 _PROTO_DESCRIPTOR_NAME = 'apphosting.DeleteSchemaParams'
2931 class DeleteSchemaRequest(ProtocolBuffer.ProtocolMessage):
2932 has_params_ = 0
2933 has_app_id_ = 0
2934 app_id_ = ""
2936 def __init__(self, contents=None):
2937 self.params_ = DeleteSchemaParams()
2938 if contents is not None: self.MergeFromString(contents)
2940 def params(self): return self.params_
2942 def mutable_params(self): self.has_params_ = 1; return self.params_
2944 def clear_params(self):self.has_params_ = 0; self.params_.Clear()
2946 def has_params(self): return self.has_params_
2948 def app_id(self): return self.app_id_
2950 def set_app_id(self, x):
2951 self.has_app_id_ = 1
2952 self.app_id_ = x
2954 def clear_app_id(self):
2955 if self.has_app_id_:
2956 self.has_app_id_ = 0
2957 self.app_id_ = ""
2959 def has_app_id(self): return self.has_app_id_
2962 def MergeFrom(self, x):
2963 assert x is not self
2964 if (x.has_params()): self.mutable_params().MergeFrom(x.params())
2965 if (x.has_app_id()): self.set_app_id(x.app_id())
2967 def Equals(self, x):
2968 if x is self: return 1
2969 if self.has_params_ != x.has_params_: return 0
2970 if self.has_params_ and self.params_ != x.params_: return 0
2971 if self.has_app_id_ != x.has_app_id_: return 0
2972 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0
2973 return 1
2975 def IsInitialized(self, debug_strs=None):
2976 initialized = 1
2977 if (not self.has_params_):
2978 initialized = 0
2979 if debug_strs is not None:
2980 debug_strs.append('Required field: params not set.')
2981 elif not self.params_.IsInitialized(debug_strs): initialized = 0
2982 return initialized
2984 def ByteSize(self):
2985 n = 0
2986 n += self.lengthString(self.params_.ByteSize())
2987 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
2988 return n + 1
2990 def ByteSizePartial(self):
2991 n = 0
2992 if (self.has_params_):
2993 n += 1
2994 n += self.lengthString(self.params_.ByteSizePartial())
2995 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
2996 return n
2998 def Clear(self):
2999 self.clear_params()
3000 self.clear_app_id()
3002 def OutputUnchecked(self, out):
3003 out.putVarInt32(10)
3004 out.putVarInt32(self.params_.ByteSize())
3005 self.params_.OutputUnchecked(out)
3006 if (self.has_app_id_):
3007 out.putVarInt32(26)
3008 out.putPrefixedString(self.app_id_)
3010 def OutputPartial(self, out):
3011 if (self.has_params_):
3012 out.putVarInt32(10)
3013 out.putVarInt32(self.params_.ByteSizePartial())
3014 self.params_.OutputPartial(out)
3015 if (self.has_app_id_):
3016 out.putVarInt32(26)
3017 out.putPrefixedString(self.app_id_)
3019 def TryMerge(self, d):
3020 while d.avail() > 0:
3021 tt = d.getVarInt32()
3022 if tt == 10:
3023 length = d.getVarInt32()
3024 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
3025 d.skip(length)
3026 self.mutable_params().TryMerge(tmp)
3027 continue
3028 if tt == 26:
3029 self.set_app_id(d.getPrefixedString())
3030 continue
3033 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3034 d.skipData(tt)
3037 def __str__(self, prefix="", printElemNumber=0):
3038 res=""
3039 if self.has_params_:
3040 res+=prefix+"params <\n"
3041 res+=self.params_.__str__(prefix + " ", printElemNumber)
3042 res+=prefix+">\n"
3043 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_))
3044 return res
3047 def _BuildTagLookupTable(sparse, maxtag, default=None):
3048 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3050 kparams = 1
3051 kapp_id = 3
3053 _TEXT = _BuildTagLookupTable({
3054 0: "ErrorCode",
3055 1: "params",
3056 3: "app_id",
3057 }, 3)
3059 _TYPES = _BuildTagLookupTable({
3060 0: ProtocolBuffer.Encoder.NUMERIC,
3061 1: ProtocolBuffer.Encoder.STRING,
3062 3: ProtocolBuffer.Encoder.STRING,
3063 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
3066 _STYLE = """"""
3067 _STYLE_CONTENT_TYPE = """"""
3068 _PROTO_DESCRIPTOR_NAME = 'apphosting.DeleteSchemaRequest'
3069 class DeleteSchemaResponse(ProtocolBuffer.ProtocolMessage):
3071 def __init__(self, contents=None):
3072 self.status_ = []
3073 if contents is not None: self.MergeFromString(contents)
3075 def status_size(self): return len(self.status_)
3076 def status_list(self): return self.status_
3078 def status(self, i):
3079 return self.status_[i]
3081 def mutable_status(self, i):
3082 return self.status_[i]
3084 def add_status(self):
3085 x = RequestStatus()
3086 self.status_.append(x)
3087 return x
3089 def clear_status(self):
3090 self.status_ = []
3092 def MergeFrom(self, x):
3093 assert x is not self
3094 for i in xrange(x.status_size()): self.add_status().CopyFrom(x.status(i))
3096 def Equals(self, x):
3097 if x is self: return 1
3098 if len(self.status_) != len(x.status_): return 0
3099 for e1, e2 in zip(self.status_, x.status_):
3100 if e1 != e2: return 0
3101 return 1
3103 def IsInitialized(self, debug_strs=None):
3104 initialized = 1
3105 for p in self.status_:
3106 if not p.IsInitialized(debug_strs): initialized=0
3107 return initialized
3109 def ByteSize(self):
3110 n = 0
3111 n += 1 * len(self.status_)
3112 for i in xrange(len(self.status_)): n += self.lengthString(self.status_[i].ByteSize())
3113 return n
3115 def ByteSizePartial(self):
3116 n = 0
3117 n += 1 * len(self.status_)
3118 for i in xrange(len(self.status_)): n += self.lengthString(self.status_[i].ByteSizePartial())
3119 return n
3121 def Clear(self):
3122 self.clear_status()
3124 def OutputUnchecked(self, out):
3125 for i in xrange(len(self.status_)):
3126 out.putVarInt32(10)
3127 out.putVarInt32(self.status_[i].ByteSize())
3128 self.status_[i].OutputUnchecked(out)
3130 def OutputPartial(self, out):
3131 for i in xrange(len(self.status_)):
3132 out.putVarInt32(10)
3133 out.putVarInt32(self.status_[i].ByteSizePartial())
3134 self.status_[i].OutputPartial(out)
3136 def TryMerge(self, d):
3137 while d.avail() > 0:
3138 tt = d.getVarInt32()
3139 if tt == 10:
3140 length = d.getVarInt32()
3141 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
3142 d.skip(length)
3143 self.add_status().TryMerge(tmp)
3144 continue
3147 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3148 d.skipData(tt)
3151 def __str__(self, prefix="", printElemNumber=0):
3152 res=""
3153 cnt=0
3154 for e in self.status_:
3155 elm=""
3156 if printElemNumber: elm="(%d)" % cnt
3157 res+=prefix+("status%s <\n" % elm)
3158 res+=e.__str__(prefix + " ", printElemNumber)
3159 res+=prefix+">\n"
3160 cnt+=1
3161 return res
3164 def _BuildTagLookupTable(sparse, maxtag, default=None):
3165 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3167 kstatus = 1
3169 _TEXT = _BuildTagLookupTable({
3170 0: "ErrorCode",
3171 1: "status",
3172 }, 1)
3174 _TYPES = _BuildTagLookupTable({
3175 0: ProtocolBuffer.Encoder.NUMERIC,
3176 1: ProtocolBuffer.Encoder.STRING,
3177 }, 1, ProtocolBuffer.Encoder.MAX_TYPE)
3180 _STYLE = """"""
3181 _STYLE_CONTENT_TYPE = """"""
3182 _PROTO_DESCRIPTOR_NAME = 'apphosting.DeleteSchemaResponse'
3183 class SortSpec(ProtocolBuffer.ProtocolMessage):
3184 has_sort_expression_ = 0
3185 sort_expression_ = ""
3186 has_sort_descending_ = 0
3187 sort_descending_ = 1
3188 has_default_value_text_ = 0
3189 default_value_text_ = ""
3190 has_default_value_numeric_ = 0
3191 default_value_numeric_ = 0.0
3193 def __init__(self, contents=None):
3194 if contents is not None: self.MergeFromString(contents)
3196 def sort_expression(self): return self.sort_expression_
3198 def set_sort_expression(self, x):
3199 self.has_sort_expression_ = 1
3200 self.sort_expression_ = x
3202 def clear_sort_expression(self):
3203 if self.has_sort_expression_:
3204 self.has_sort_expression_ = 0
3205 self.sort_expression_ = ""
3207 def has_sort_expression(self): return self.has_sort_expression_
3209 def sort_descending(self): return self.sort_descending_
3211 def set_sort_descending(self, x):
3212 self.has_sort_descending_ = 1
3213 self.sort_descending_ = x
3215 def clear_sort_descending(self):
3216 if self.has_sort_descending_:
3217 self.has_sort_descending_ = 0
3218 self.sort_descending_ = 1
3220 def has_sort_descending(self): return self.has_sort_descending_
3222 def default_value_text(self): return self.default_value_text_
3224 def set_default_value_text(self, x):
3225 self.has_default_value_text_ = 1
3226 self.default_value_text_ = x
3228 def clear_default_value_text(self):
3229 if self.has_default_value_text_:
3230 self.has_default_value_text_ = 0
3231 self.default_value_text_ = ""
3233 def has_default_value_text(self): return self.has_default_value_text_
3235 def default_value_numeric(self): return self.default_value_numeric_
3237 def set_default_value_numeric(self, x):
3238 self.has_default_value_numeric_ = 1
3239 self.default_value_numeric_ = x
3241 def clear_default_value_numeric(self):
3242 if self.has_default_value_numeric_:
3243 self.has_default_value_numeric_ = 0
3244 self.default_value_numeric_ = 0.0
3246 def has_default_value_numeric(self): return self.has_default_value_numeric_
3249 def MergeFrom(self, x):
3250 assert x is not self
3251 if (x.has_sort_expression()): self.set_sort_expression(x.sort_expression())
3252 if (x.has_sort_descending()): self.set_sort_descending(x.sort_descending())
3253 if (x.has_default_value_text()): self.set_default_value_text(x.default_value_text())
3254 if (x.has_default_value_numeric()): self.set_default_value_numeric(x.default_value_numeric())
3256 def Equals(self, x):
3257 if x is self: return 1
3258 if self.has_sort_expression_ != x.has_sort_expression_: return 0
3259 if self.has_sort_expression_ and self.sort_expression_ != x.sort_expression_: return 0
3260 if self.has_sort_descending_ != x.has_sort_descending_: return 0
3261 if self.has_sort_descending_ and self.sort_descending_ != x.sort_descending_: return 0
3262 if self.has_default_value_text_ != x.has_default_value_text_: return 0
3263 if self.has_default_value_text_ and self.default_value_text_ != x.default_value_text_: return 0
3264 if self.has_default_value_numeric_ != x.has_default_value_numeric_: return 0
3265 if self.has_default_value_numeric_ and self.default_value_numeric_ != x.default_value_numeric_: return 0
3266 return 1
3268 def IsInitialized(self, debug_strs=None):
3269 initialized = 1
3270 if (not self.has_sort_expression_):
3271 initialized = 0
3272 if debug_strs is not None:
3273 debug_strs.append('Required field: sort_expression not set.')
3274 return initialized
3276 def ByteSize(self):
3277 n = 0
3278 n += self.lengthString(len(self.sort_expression_))
3279 if (self.has_sort_descending_): n += 2
3280 if (self.has_default_value_text_): n += 1 + self.lengthString(len(self.default_value_text_))
3281 if (self.has_default_value_numeric_): n += 9
3282 return n + 1
3284 def ByteSizePartial(self):
3285 n = 0
3286 if (self.has_sort_expression_):
3287 n += 1
3288 n += self.lengthString(len(self.sort_expression_))
3289 if (self.has_sort_descending_): n += 2
3290 if (self.has_default_value_text_): n += 1 + self.lengthString(len(self.default_value_text_))
3291 if (self.has_default_value_numeric_): n += 9
3292 return n
3294 def Clear(self):
3295 self.clear_sort_expression()
3296 self.clear_sort_descending()
3297 self.clear_default_value_text()
3298 self.clear_default_value_numeric()
3300 def OutputUnchecked(self, out):
3301 out.putVarInt32(10)
3302 out.putPrefixedString(self.sort_expression_)
3303 if (self.has_sort_descending_):
3304 out.putVarInt32(16)
3305 out.putBoolean(self.sort_descending_)
3306 if (self.has_default_value_text_):
3307 out.putVarInt32(34)
3308 out.putPrefixedString(self.default_value_text_)
3309 if (self.has_default_value_numeric_):
3310 out.putVarInt32(41)
3311 out.putDouble(self.default_value_numeric_)
3313 def OutputPartial(self, out):
3314 if (self.has_sort_expression_):
3315 out.putVarInt32(10)
3316 out.putPrefixedString(self.sort_expression_)
3317 if (self.has_sort_descending_):
3318 out.putVarInt32(16)
3319 out.putBoolean(self.sort_descending_)
3320 if (self.has_default_value_text_):
3321 out.putVarInt32(34)
3322 out.putPrefixedString(self.default_value_text_)
3323 if (self.has_default_value_numeric_):
3324 out.putVarInt32(41)
3325 out.putDouble(self.default_value_numeric_)
3327 def TryMerge(self, d):
3328 while d.avail() > 0:
3329 tt = d.getVarInt32()
3330 if tt == 10:
3331 self.set_sort_expression(d.getPrefixedString())
3332 continue
3333 if tt == 16:
3334 self.set_sort_descending(d.getBoolean())
3335 continue
3336 if tt == 34:
3337 self.set_default_value_text(d.getPrefixedString())
3338 continue
3339 if tt == 41:
3340 self.set_default_value_numeric(d.getDouble())
3341 continue
3344 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3345 d.skipData(tt)
3348 def __str__(self, prefix="", printElemNumber=0):
3349 res=""
3350 if self.has_sort_expression_: res+=prefix+("sort_expression: %s\n" % self.DebugFormatString(self.sort_expression_))
3351 if self.has_sort_descending_: res+=prefix+("sort_descending: %s\n" % self.DebugFormatBool(self.sort_descending_))
3352 if self.has_default_value_text_: res+=prefix+("default_value_text: %s\n" % self.DebugFormatString(self.default_value_text_))
3353 if self.has_default_value_numeric_: res+=prefix+("default_value_numeric: %s\n" % self.DebugFormat(self.default_value_numeric_))
3354 return res
3357 def _BuildTagLookupTable(sparse, maxtag, default=None):
3358 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3360 ksort_expression = 1
3361 ksort_descending = 2
3362 kdefault_value_text = 4
3363 kdefault_value_numeric = 5
3365 _TEXT = _BuildTagLookupTable({
3366 0: "ErrorCode",
3367 1: "sort_expression",
3368 2: "sort_descending",
3369 4: "default_value_text",
3370 5: "default_value_numeric",
3371 }, 5)
3373 _TYPES = _BuildTagLookupTable({
3374 0: ProtocolBuffer.Encoder.NUMERIC,
3375 1: ProtocolBuffer.Encoder.STRING,
3376 2: ProtocolBuffer.Encoder.NUMERIC,
3377 4: ProtocolBuffer.Encoder.STRING,
3378 5: ProtocolBuffer.Encoder.DOUBLE,
3379 }, 5, ProtocolBuffer.Encoder.MAX_TYPE)
3382 _STYLE = """"""
3383 _STYLE_CONTENT_TYPE = """"""
3384 _PROTO_DESCRIPTOR_NAME = 'apphosting.SortSpec'
3385 class ScorerSpec(ProtocolBuffer.ProtocolMessage):
3388 RESCORING_MATCH_SCORER = 0
3389 MATCH_SCORER = 2
3391 _Scorer_NAMES = {
3392 0: "RESCORING_MATCH_SCORER",
3393 2: "MATCH_SCORER",
3396 def Scorer_Name(cls, x): return cls._Scorer_NAMES.get(x, "")
3397 Scorer_Name = classmethod(Scorer_Name)
3399 has_scorer_ = 0
3400 scorer_ = 2
3401 has_limit_ = 0
3402 limit_ = 1000
3403 has_match_scorer_parameters_ = 0
3404 match_scorer_parameters_ = ""
3406 def __init__(self, contents=None):
3407 if contents is not None: self.MergeFromString(contents)
3409 def scorer(self): return self.scorer_
3411 def set_scorer(self, x):
3412 self.has_scorer_ = 1
3413 self.scorer_ = x
3415 def clear_scorer(self):
3416 if self.has_scorer_:
3417 self.has_scorer_ = 0
3418 self.scorer_ = 2
3420 def has_scorer(self): return self.has_scorer_
3422 def limit(self): return self.limit_
3424 def set_limit(self, x):
3425 self.has_limit_ = 1
3426 self.limit_ = x
3428 def clear_limit(self):
3429 if self.has_limit_:
3430 self.has_limit_ = 0
3431 self.limit_ = 1000
3433 def has_limit(self): return self.has_limit_
3435 def match_scorer_parameters(self): return self.match_scorer_parameters_
3437 def set_match_scorer_parameters(self, x):
3438 self.has_match_scorer_parameters_ = 1
3439 self.match_scorer_parameters_ = x
3441 def clear_match_scorer_parameters(self):
3442 if self.has_match_scorer_parameters_:
3443 self.has_match_scorer_parameters_ = 0
3444 self.match_scorer_parameters_ = ""
3446 def has_match_scorer_parameters(self): return self.has_match_scorer_parameters_
3449 def MergeFrom(self, x):
3450 assert x is not self
3451 if (x.has_scorer()): self.set_scorer(x.scorer())
3452 if (x.has_limit()): self.set_limit(x.limit())
3453 if (x.has_match_scorer_parameters()): self.set_match_scorer_parameters(x.match_scorer_parameters())
3455 def Equals(self, x):
3456 if x is self: return 1
3457 if self.has_scorer_ != x.has_scorer_: return 0
3458 if self.has_scorer_ and self.scorer_ != x.scorer_: return 0
3459 if self.has_limit_ != x.has_limit_: return 0
3460 if self.has_limit_ and self.limit_ != x.limit_: return 0
3461 if self.has_match_scorer_parameters_ != x.has_match_scorer_parameters_: return 0
3462 if self.has_match_scorer_parameters_ and self.match_scorer_parameters_ != x.match_scorer_parameters_: return 0
3463 return 1
3465 def IsInitialized(self, debug_strs=None):
3466 initialized = 1
3467 return initialized
3469 def ByteSize(self):
3470 n = 0
3471 if (self.has_scorer_): n += 1 + self.lengthVarInt64(self.scorer_)
3472 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
3473 if (self.has_match_scorer_parameters_): n += 1 + self.lengthString(len(self.match_scorer_parameters_))
3474 return n
3476 def ByteSizePartial(self):
3477 n = 0
3478 if (self.has_scorer_): n += 1 + self.lengthVarInt64(self.scorer_)
3479 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
3480 if (self.has_match_scorer_parameters_): n += 1 + self.lengthString(len(self.match_scorer_parameters_))
3481 return n
3483 def Clear(self):
3484 self.clear_scorer()
3485 self.clear_limit()
3486 self.clear_match_scorer_parameters()
3488 def OutputUnchecked(self, out):
3489 if (self.has_scorer_):
3490 out.putVarInt32(8)
3491 out.putVarInt32(self.scorer_)
3492 if (self.has_limit_):
3493 out.putVarInt32(16)
3494 out.putVarInt32(self.limit_)
3495 if (self.has_match_scorer_parameters_):
3496 out.putVarInt32(74)
3497 out.putPrefixedString(self.match_scorer_parameters_)
3499 def OutputPartial(self, out):
3500 if (self.has_scorer_):
3501 out.putVarInt32(8)
3502 out.putVarInt32(self.scorer_)
3503 if (self.has_limit_):
3504 out.putVarInt32(16)
3505 out.putVarInt32(self.limit_)
3506 if (self.has_match_scorer_parameters_):
3507 out.putVarInt32(74)
3508 out.putPrefixedString(self.match_scorer_parameters_)
3510 def TryMerge(self, d):
3511 while d.avail() > 0:
3512 tt = d.getVarInt32()
3513 if tt == 8:
3514 self.set_scorer(d.getVarInt32())
3515 continue
3516 if tt == 16:
3517 self.set_limit(d.getVarInt32())
3518 continue
3519 if tt == 74:
3520 self.set_match_scorer_parameters(d.getPrefixedString())
3521 continue
3524 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3525 d.skipData(tt)
3528 def __str__(self, prefix="", printElemNumber=0):
3529 res=""
3530 if self.has_scorer_: res+=prefix+("scorer: %s\n" % self.DebugFormatInt32(self.scorer_))
3531 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
3532 if self.has_match_scorer_parameters_: res+=prefix+("match_scorer_parameters: %s\n" % self.DebugFormatString(self.match_scorer_parameters_))
3533 return res
3536 def _BuildTagLookupTable(sparse, maxtag, default=None):
3537 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3539 kscorer = 1
3540 klimit = 2
3541 kmatch_scorer_parameters = 9
3543 _TEXT = _BuildTagLookupTable({
3544 0: "ErrorCode",
3545 1: "scorer",
3546 2: "limit",
3547 9: "match_scorer_parameters",
3548 }, 9)
3550 _TYPES = _BuildTagLookupTable({
3551 0: ProtocolBuffer.Encoder.NUMERIC,
3552 1: ProtocolBuffer.Encoder.NUMERIC,
3553 2: ProtocolBuffer.Encoder.NUMERIC,
3554 9: ProtocolBuffer.Encoder.STRING,
3555 }, 9, ProtocolBuffer.Encoder.MAX_TYPE)
3558 _STYLE = """"""
3559 _STYLE_CONTENT_TYPE = """"""
3560 _PROTO_DESCRIPTOR_NAME = 'apphosting.ScorerSpec'
3561 class FieldSpec_Expression(ProtocolBuffer.ProtocolMessage):
3562 has_name_ = 0
3563 name_ = ""
3564 has_expression_ = 0
3565 expression_ = ""
3567 def __init__(self, contents=None):
3568 if contents is not None: self.MergeFromString(contents)
3570 def name(self): return self.name_
3572 def set_name(self, x):
3573 self.has_name_ = 1
3574 self.name_ = x
3576 def clear_name(self):
3577 if self.has_name_:
3578 self.has_name_ = 0
3579 self.name_ = ""
3581 def has_name(self): return self.has_name_
3583 def expression(self): return self.expression_
3585 def set_expression(self, x):
3586 self.has_expression_ = 1
3587 self.expression_ = x
3589 def clear_expression(self):
3590 if self.has_expression_:
3591 self.has_expression_ = 0
3592 self.expression_ = ""
3594 def has_expression(self): return self.has_expression_
3597 def MergeFrom(self, x):
3598 assert x is not self
3599 if (x.has_name()): self.set_name(x.name())
3600 if (x.has_expression()): self.set_expression(x.expression())
3602 def Equals(self, x):
3603 if x is self: return 1
3604 if self.has_name_ != x.has_name_: return 0
3605 if self.has_name_ and self.name_ != x.name_: return 0
3606 if self.has_expression_ != x.has_expression_: return 0
3607 if self.has_expression_ and self.expression_ != x.expression_: return 0
3608 return 1
3610 def IsInitialized(self, debug_strs=None):
3611 initialized = 1
3612 if (not self.has_name_):
3613 initialized = 0
3614 if debug_strs is not None:
3615 debug_strs.append('Required field: name not set.')
3616 if (not self.has_expression_):
3617 initialized = 0
3618 if debug_strs is not None:
3619 debug_strs.append('Required field: expression not set.')
3620 return initialized
3622 def ByteSize(self):
3623 n = 0
3624 n += self.lengthString(len(self.name_))
3625 n += self.lengthString(len(self.expression_))
3626 return n + 2
3628 def ByteSizePartial(self):
3629 n = 0
3630 if (self.has_name_):
3631 n += 1
3632 n += self.lengthString(len(self.name_))
3633 if (self.has_expression_):
3634 n += 1
3635 n += self.lengthString(len(self.expression_))
3636 return n
3638 def Clear(self):
3639 self.clear_name()
3640 self.clear_expression()
3642 def OutputUnchecked(self, out):
3643 out.putVarInt32(26)
3644 out.putPrefixedString(self.name_)
3645 out.putVarInt32(34)
3646 out.putPrefixedString(self.expression_)
3648 def OutputPartial(self, out):
3649 if (self.has_name_):
3650 out.putVarInt32(26)
3651 out.putPrefixedString(self.name_)
3652 if (self.has_expression_):
3653 out.putVarInt32(34)
3654 out.putPrefixedString(self.expression_)
3656 def TryMerge(self, d):
3657 while 1:
3658 tt = d.getVarInt32()
3659 if tt == 20: break
3660 if tt == 26:
3661 self.set_name(d.getPrefixedString())
3662 continue
3663 if tt == 34:
3664 self.set_expression(d.getPrefixedString())
3665 continue
3668 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3669 d.skipData(tt)
3672 def __str__(self, prefix="", printElemNumber=0):
3673 res=""
3674 if self.has_name_: res+=prefix+("name: %s\n" % self.DebugFormatString(self.name_))
3675 if self.has_expression_: res+=prefix+("expression: %s\n" % self.DebugFormatString(self.expression_))
3676 return res
3678 class FieldSpec(ProtocolBuffer.ProtocolMessage):
3680 def __init__(self, contents=None):
3681 self.name_ = []
3682 self.expression_ = []
3683 if contents is not None: self.MergeFromString(contents)
3685 def name_size(self): return len(self.name_)
3686 def name_list(self): return self.name_
3688 def name(self, i):
3689 return self.name_[i]
3691 def set_name(self, i, x):
3692 self.name_[i] = x
3694 def add_name(self, x):
3695 self.name_.append(x)
3697 def clear_name(self):
3698 self.name_ = []
3700 def expression_size(self): return len(self.expression_)
3701 def expression_list(self): return self.expression_
3703 def expression(self, i):
3704 return self.expression_[i]
3706 def mutable_expression(self, i):
3707 return self.expression_[i]
3709 def add_expression(self):
3710 x = FieldSpec_Expression()
3711 self.expression_.append(x)
3712 return x
3714 def clear_expression(self):
3715 self.expression_ = []
3717 def MergeFrom(self, x):
3718 assert x is not self
3719 for i in xrange(x.name_size()): self.add_name(x.name(i))
3720 for i in xrange(x.expression_size()): self.add_expression().CopyFrom(x.expression(i))
3722 def Equals(self, x):
3723 if x is self: return 1
3724 if len(self.name_) != len(x.name_): return 0
3725 for e1, e2 in zip(self.name_, x.name_):
3726 if e1 != e2: return 0
3727 if len(self.expression_) != len(x.expression_): return 0
3728 for e1, e2 in zip(self.expression_, x.expression_):
3729 if e1 != e2: return 0
3730 return 1
3732 def IsInitialized(self, debug_strs=None):
3733 initialized = 1
3734 for p in self.expression_:
3735 if not p.IsInitialized(debug_strs): initialized=0
3736 return initialized
3738 def ByteSize(self):
3739 n = 0
3740 n += 1 * len(self.name_)
3741 for i in xrange(len(self.name_)): n += self.lengthString(len(self.name_[i]))
3742 n += 2 * len(self.expression_)
3743 for i in xrange(len(self.expression_)): n += self.expression_[i].ByteSize()
3744 return n
3746 def ByteSizePartial(self):
3747 n = 0
3748 n += 1 * len(self.name_)
3749 for i in xrange(len(self.name_)): n += self.lengthString(len(self.name_[i]))
3750 n += 2 * len(self.expression_)
3751 for i in xrange(len(self.expression_)): n += self.expression_[i].ByteSizePartial()
3752 return n
3754 def Clear(self):
3755 self.clear_name()
3756 self.clear_expression()
3758 def OutputUnchecked(self, out):
3759 for i in xrange(len(self.name_)):
3760 out.putVarInt32(10)
3761 out.putPrefixedString(self.name_[i])
3762 for i in xrange(len(self.expression_)):
3763 out.putVarInt32(19)
3764 self.expression_[i].OutputUnchecked(out)
3765 out.putVarInt32(20)
3767 def OutputPartial(self, out):
3768 for i in xrange(len(self.name_)):
3769 out.putVarInt32(10)
3770 out.putPrefixedString(self.name_[i])
3771 for i in xrange(len(self.expression_)):
3772 out.putVarInt32(19)
3773 self.expression_[i].OutputPartial(out)
3774 out.putVarInt32(20)
3776 def TryMerge(self, d):
3777 while d.avail() > 0:
3778 tt = d.getVarInt32()
3779 if tt == 10:
3780 self.add_name(d.getPrefixedString())
3781 continue
3782 if tt == 19:
3783 self.add_expression().TryMerge(d)
3784 continue
3787 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
3788 d.skipData(tt)
3791 def __str__(self, prefix="", printElemNumber=0):
3792 res=""
3793 cnt=0
3794 for e in self.name_:
3795 elm=""
3796 if printElemNumber: elm="(%d)" % cnt
3797 res+=prefix+("name%s: %s\n" % (elm, self.DebugFormatString(e)))
3798 cnt+=1
3799 cnt=0
3800 for e in self.expression_:
3801 elm=""
3802 if printElemNumber: elm="(%d)" % cnt
3803 res+=prefix+("Expression%s {\n" % elm)
3804 res+=e.__str__(prefix + " ", printElemNumber)
3805 res+=prefix+"}\n"
3806 cnt+=1
3807 return res
3810 def _BuildTagLookupTable(sparse, maxtag, default=None):
3811 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
3813 kname = 1
3814 kExpressionGroup = 2
3815 kExpressionname = 3
3816 kExpressionexpression = 4
3818 _TEXT = _BuildTagLookupTable({
3819 0: "ErrorCode",
3820 1: "name",
3821 2: "Expression",
3822 3: "name",
3823 4: "expression",
3824 }, 4)
3826 _TYPES = _BuildTagLookupTable({
3827 0: ProtocolBuffer.Encoder.NUMERIC,
3828 1: ProtocolBuffer.Encoder.STRING,
3829 2: ProtocolBuffer.Encoder.STARTGROUP,
3830 3: ProtocolBuffer.Encoder.STRING,
3831 4: ProtocolBuffer.Encoder.STRING,
3832 }, 4, ProtocolBuffer.Encoder.MAX_TYPE)
3835 _STYLE = """"""
3836 _STYLE_CONTENT_TYPE = """"""
3837 _PROTO_DESCRIPTOR_NAME = 'apphosting.FieldSpec'
3838 class SearchParams(ProtocolBuffer.ProtocolMessage):
3841 NONE = 0
3842 SINGLE = 1
3843 PER_RESULT = 2
3845 _CursorType_NAMES = {
3846 0: "NONE",
3847 1: "SINGLE",
3848 2: "PER_RESULT",
3851 def CursorType_Name(cls, x): return cls._CursorType_NAMES.get(x, "")
3852 CursorType_Name = classmethod(CursorType_Name)
3856 STRICT = 0
3857 RELAXED = 1
3859 _ParsingMode_NAMES = {
3860 0: "STRICT",
3861 1: "RELAXED",
3864 def ParsingMode_Name(cls, x): return cls._ParsingMode_NAMES.get(x, "")
3865 ParsingMode_Name = classmethod(ParsingMode_Name)
3867 has_index_spec_ = 0
3868 has_query_ = 0
3869 query_ = ""
3870 has_cursor_ = 0
3871 cursor_ = ""
3872 has_offset_ = 0
3873 offset_ = 0
3874 has_cursor_type_ = 0
3875 cursor_type_ = 0
3876 has_limit_ = 0
3877 limit_ = 20
3878 has_matched_count_accuracy_ = 0
3879 matched_count_accuracy_ = 0
3880 has_scorer_spec_ = 0
3881 scorer_spec_ = None
3882 has_field_spec_ = 0
3883 field_spec_ = None
3884 has_keys_only_ = 0
3885 keys_only_ = 0
3886 has_parsing_mode_ = 0
3887 parsing_mode_ = 0
3889 def __init__(self, contents=None):
3890 self.index_spec_ = IndexSpec()
3891 self.sort_spec_ = []
3892 self.lazy_init_lock_ = thread.allocate_lock()
3893 if contents is not None: self.MergeFromString(contents)
3895 def index_spec(self): return self.index_spec_
3897 def mutable_index_spec(self): self.has_index_spec_ = 1; return self.index_spec_
3899 def clear_index_spec(self):self.has_index_spec_ = 0; self.index_spec_.Clear()
3901 def has_index_spec(self): return self.has_index_spec_
3903 def query(self): return self.query_
3905 def set_query(self, x):
3906 self.has_query_ = 1
3907 self.query_ = x
3909 def clear_query(self):
3910 if self.has_query_:
3911 self.has_query_ = 0
3912 self.query_ = ""
3914 def has_query(self): return self.has_query_
3916 def cursor(self): return self.cursor_
3918 def set_cursor(self, x):
3919 self.has_cursor_ = 1
3920 self.cursor_ = x
3922 def clear_cursor(self):
3923 if self.has_cursor_:
3924 self.has_cursor_ = 0
3925 self.cursor_ = ""
3927 def has_cursor(self): return self.has_cursor_
3929 def offset(self): return self.offset_
3931 def set_offset(self, x):
3932 self.has_offset_ = 1
3933 self.offset_ = x
3935 def clear_offset(self):
3936 if self.has_offset_:
3937 self.has_offset_ = 0
3938 self.offset_ = 0
3940 def has_offset(self): return self.has_offset_
3942 def cursor_type(self): return self.cursor_type_
3944 def set_cursor_type(self, x):
3945 self.has_cursor_type_ = 1
3946 self.cursor_type_ = x
3948 def clear_cursor_type(self):
3949 if self.has_cursor_type_:
3950 self.has_cursor_type_ = 0
3951 self.cursor_type_ = 0
3953 def has_cursor_type(self): return self.has_cursor_type_
3955 def limit(self): return self.limit_
3957 def set_limit(self, x):
3958 self.has_limit_ = 1
3959 self.limit_ = x
3961 def clear_limit(self):
3962 if self.has_limit_:
3963 self.has_limit_ = 0
3964 self.limit_ = 20
3966 def has_limit(self): return self.has_limit_
3968 def matched_count_accuracy(self): return self.matched_count_accuracy_
3970 def set_matched_count_accuracy(self, x):
3971 self.has_matched_count_accuracy_ = 1
3972 self.matched_count_accuracy_ = x
3974 def clear_matched_count_accuracy(self):
3975 if self.has_matched_count_accuracy_:
3976 self.has_matched_count_accuracy_ = 0
3977 self.matched_count_accuracy_ = 0
3979 def has_matched_count_accuracy(self): return self.has_matched_count_accuracy_
3981 def sort_spec_size(self): return len(self.sort_spec_)
3982 def sort_spec_list(self): return self.sort_spec_
3984 def sort_spec(self, i):
3985 return self.sort_spec_[i]
3987 def mutable_sort_spec(self, i):
3988 return self.sort_spec_[i]
3990 def add_sort_spec(self):
3991 x = SortSpec()
3992 self.sort_spec_.append(x)
3993 return x
3995 def clear_sort_spec(self):
3996 self.sort_spec_ = []
3997 def scorer_spec(self):
3998 if self.scorer_spec_ is None:
3999 self.lazy_init_lock_.acquire()
4000 try:
4001 if self.scorer_spec_ is None: self.scorer_spec_ = ScorerSpec()
4002 finally:
4003 self.lazy_init_lock_.release()
4004 return self.scorer_spec_
4006 def mutable_scorer_spec(self): self.has_scorer_spec_ = 1; return self.scorer_spec()
4008 def clear_scorer_spec(self):
4010 if self.has_scorer_spec_:
4011 self.has_scorer_spec_ = 0;
4012 if self.scorer_spec_ is not None: self.scorer_spec_.Clear()
4014 def has_scorer_spec(self): return self.has_scorer_spec_
4016 def field_spec(self):
4017 if self.field_spec_ is None:
4018 self.lazy_init_lock_.acquire()
4019 try:
4020 if self.field_spec_ is None: self.field_spec_ = FieldSpec()
4021 finally:
4022 self.lazy_init_lock_.release()
4023 return self.field_spec_
4025 def mutable_field_spec(self): self.has_field_spec_ = 1; return self.field_spec()
4027 def clear_field_spec(self):
4029 if self.has_field_spec_:
4030 self.has_field_spec_ = 0;
4031 if self.field_spec_ is not None: self.field_spec_.Clear()
4033 def has_field_spec(self): return self.has_field_spec_
4035 def keys_only(self): return self.keys_only_
4037 def set_keys_only(self, x):
4038 self.has_keys_only_ = 1
4039 self.keys_only_ = x
4041 def clear_keys_only(self):
4042 if self.has_keys_only_:
4043 self.has_keys_only_ = 0
4044 self.keys_only_ = 0
4046 def has_keys_only(self): return self.has_keys_only_
4048 def parsing_mode(self): return self.parsing_mode_
4050 def set_parsing_mode(self, x):
4051 self.has_parsing_mode_ = 1
4052 self.parsing_mode_ = x
4054 def clear_parsing_mode(self):
4055 if self.has_parsing_mode_:
4056 self.has_parsing_mode_ = 0
4057 self.parsing_mode_ = 0
4059 def has_parsing_mode(self): return self.has_parsing_mode_
4062 def MergeFrom(self, x):
4063 assert x is not self
4064 if (x.has_index_spec()): self.mutable_index_spec().MergeFrom(x.index_spec())
4065 if (x.has_query()): self.set_query(x.query())
4066 if (x.has_cursor()): self.set_cursor(x.cursor())
4067 if (x.has_offset()): self.set_offset(x.offset())
4068 if (x.has_cursor_type()): self.set_cursor_type(x.cursor_type())
4069 if (x.has_limit()): self.set_limit(x.limit())
4070 if (x.has_matched_count_accuracy()): self.set_matched_count_accuracy(x.matched_count_accuracy())
4071 for i in xrange(x.sort_spec_size()): self.add_sort_spec().CopyFrom(x.sort_spec(i))
4072 if (x.has_scorer_spec()): self.mutable_scorer_spec().MergeFrom(x.scorer_spec())
4073 if (x.has_field_spec()): self.mutable_field_spec().MergeFrom(x.field_spec())
4074 if (x.has_keys_only()): self.set_keys_only(x.keys_only())
4075 if (x.has_parsing_mode()): self.set_parsing_mode(x.parsing_mode())
4077 def Equals(self, x):
4078 if x is self: return 1
4079 if self.has_index_spec_ != x.has_index_spec_: return 0
4080 if self.has_index_spec_ and self.index_spec_ != x.index_spec_: return 0
4081 if self.has_query_ != x.has_query_: return 0
4082 if self.has_query_ and self.query_ != x.query_: return 0
4083 if self.has_cursor_ != x.has_cursor_: return 0
4084 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
4085 if self.has_offset_ != x.has_offset_: return 0
4086 if self.has_offset_ and self.offset_ != x.offset_: return 0
4087 if self.has_cursor_type_ != x.has_cursor_type_: return 0
4088 if self.has_cursor_type_ and self.cursor_type_ != x.cursor_type_: return 0
4089 if self.has_limit_ != x.has_limit_: return 0
4090 if self.has_limit_ and self.limit_ != x.limit_: return 0
4091 if self.has_matched_count_accuracy_ != x.has_matched_count_accuracy_: return 0
4092 if self.has_matched_count_accuracy_ and self.matched_count_accuracy_ != x.matched_count_accuracy_: return 0
4093 if len(self.sort_spec_) != len(x.sort_spec_): return 0
4094 for e1, e2 in zip(self.sort_spec_, x.sort_spec_):
4095 if e1 != e2: return 0
4096 if self.has_scorer_spec_ != x.has_scorer_spec_: return 0
4097 if self.has_scorer_spec_ and self.scorer_spec_ != x.scorer_spec_: return 0
4098 if self.has_field_spec_ != x.has_field_spec_: return 0
4099 if self.has_field_spec_ and self.field_spec_ != x.field_spec_: return 0
4100 if self.has_keys_only_ != x.has_keys_only_: return 0
4101 if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
4102 if self.has_parsing_mode_ != x.has_parsing_mode_: return 0
4103 if self.has_parsing_mode_ and self.parsing_mode_ != x.parsing_mode_: return 0
4104 return 1
4106 def IsInitialized(self, debug_strs=None):
4107 initialized = 1
4108 if (not self.has_index_spec_):
4109 initialized = 0
4110 if debug_strs is not None:
4111 debug_strs.append('Required field: index_spec not set.')
4112 elif not self.index_spec_.IsInitialized(debug_strs): initialized = 0
4113 if (not self.has_query_):
4114 initialized = 0
4115 if debug_strs is not None:
4116 debug_strs.append('Required field: query not set.')
4117 for p in self.sort_spec_:
4118 if not p.IsInitialized(debug_strs): initialized=0
4119 if (self.has_scorer_spec_ and not self.scorer_spec_.IsInitialized(debug_strs)): initialized = 0
4120 if (self.has_field_spec_ and not self.field_spec_.IsInitialized(debug_strs)): initialized = 0
4121 return initialized
4123 def ByteSize(self):
4124 n = 0
4125 n += self.lengthString(self.index_spec_.ByteSize())
4126 n += self.lengthString(len(self.query_))
4127 if (self.has_cursor_): n += 1 + self.lengthString(len(self.cursor_))
4128 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
4129 if (self.has_cursor_type_): n += 1 + self.lengthVarInt64(self.cursor_type_)
4130 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
4131 if (self.has_matched_count_accuracy_): n += 1 + self.lengthVarInt64(self.matched_count_accuracy_)
4132 n += 1 * len(self.sort_spec_)
4133 for i in xrange(len(self.sort_spec_)): n += self.lengthString(self.sort_spec_[i].ByteSize())
4134 if (self.has_scorer_spec_): n += 1 + self.lengthString(self.scorer_spec_.ByteSize())
4135 if (self.has_field_spec_): n += 1 + self.lengthString(self.field_spec_.ByteSize())
4136 if (self.has_keys_only_): n += 2
4137 if (self.has_parsing_mode_): n += 1 + self.lengthVarInt64(self.parsing_mode_)
4138 return n + 2
4140 def ByteSizePartial(self):
4141 n = 0
4142 if (self.has_index_spec_):
4143 n += 1
4144 n += self.lengthString(self.index_spec_.ByteSizePartial())
4145 if (self.has_query_):
4146 n += 1
4147 n += self.lengthString(len(self.query_))
4148 if (self.has_cursor_): n += 1 + self.lengthString(len(self.cursor_))
4149 if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
4150 if (self.has_cursor_type_): n += 1 + self.lengthVarInt64(self.cursor_type_)
4151 if (self.has_limit_): n += 1 + self.lengthVarInt64(self.limit_)
4152 if (self.has_matched_count_accuracy_): n += 1 + self.lengthVarInt64(self.matched_count_accuracy_)
4153 n += 1 * len(self.sort_spec_)
4154 for i in xrange(len(self.sort_spec_)): n += self.lengthString(self.sort_spec_[i].ByteSizePartial())
4155 if (self.has_scorer_spec_): n += 1 + self.lengthString(self.scorer_spec_.ByteSizePartial())
4156 if (self.has_field_spec_): n += 1 + self.lengthString(self.field_spec_.ByteSizePartial())
4157 if (self.has_keys_only_): n += 2
4158 if (self.has_parsing_mode_): n += 1 + self.lengthVarInt64(self.parsing_mode_)
4159 return n
4161 def Clear(self):
4162 self.clear_index_spec()
4163 self.clear_query()
4164 self.clear_cursor()
4165 self.clear_offset()
4166 self.clear_cursor_type()
4167 self.clear_limit()
4168 self.clear_matched_count_accuracy()
4169 self.clear_sort_spec()
4170 self.clear_scorer_spec()
4171 self.clear_field_spec()
4172 self.clear_keys_only()
4173 self.clear_parsing_mode()
4175 def OutputUnchecked(self, out):
4176 out.putVarInt32(10)
4177 out.putVarInt32(self.index_spec_.ByteSize())
4178 self.index_spec_.OutputUnchecked(out)
4179 out.putVarInt32(18)
4180 out.putPrefixedString(self.query_)
4181 if (self.has_cursor_):
4182 out.putVarInt32(34)
4183 out.putPrefixedString(self.cursor_)
4184 if (self.has_cursor_type_):
4185 out.putVarInt32(40)
4186 out.putVarInt32(self.cursor_type_)
4187 if (self.has_limit_):
4188 out.putVarInt32(48)
4189 out.putVarInt32(self.limit_)
4190 if (self.has_matched_count_accuracy_):
4191 out.putVarInt32(56)
4192 out.putVarInt32(self.matched_count_accuracy_)
4193 for i in xrange(len(self.sort_spec_)):
4194 out.putVarInt32(66)
4195 out.putVarInt32(self.sort_spec_[i].ByteSize())
4196 self.sort_spec_[i].OutputUnchecked(out)
4197 if (self.has_scorer_spec_):
4198 out.putVarInt32(74)
4199 out.putVarInt32(self.scorer_spec_.ByteSize())
4200 self.scorer_spec_.OutputUnchecked(out)
4201 if (self.has_field_spec_):
4202 out.putVarInt32(82)
4203 out.putVarInt32(self.field_spec_.ByteSize())
4204 self.field_spec_.OutputUnchecked(out)
4205 if (self.has_offset_):
4206 out.putVarInt32(88)
4207 out.putVarInt32(self.offset_)
4208 if (self.has_keys_only_):
4209 out.putVarInt32(96)
4210 out.putBoolean(self.keys_only_)
4211 if (self.has_parsing_mode_):
4212 out.putVarInt32(104)
4213 out.putVarInt32(self.parsing_mode_)
4215 def OutputPartial(self, out):
4216 if (self.has_index_spec_):
4217 out.putVarInt32(10)
4218 out.putVarInt32(self.index_spec_.ByteSizePartial())
4219 self.index_spec_.OutputPartial(out)
4220 if (self.has_query_):
4221 out.putVarInt32(18)
4222 out.putPrefixedString(self.query_)
4223 if (self.has_cursor_):
4224 out.putVarInt32(34)
4225 out.putPrefixedString(self.cursor_)
4226 if (self.has_cursor_type_):
4227 out.putVarInt32(40)
4228 out.putVarInt32(self.cursor_type_)
4229 if (self.has_limit_):
4230 out.putVarInt32(48)
4231 out.putVarInt32(self.limit_)
4232 if (self.has_matched_count_accuracy_):
4233 out.putVarInt32(56)
4234 out.putVarInt32(self.matched_count_accuracy_)
4235 for i in xrange(len(self.sort_spec_)):
4236 out.putVarInt32(66)
4237 out.putVarInt32(self.sort_spec_[i].ByteSizePartial())
4238 self.sort_spec_[i].OutputPartial(out)
4239 if (self.has_scorer_spec_):
4240 out.putVarInt32(74)
4241 out.putVarInt32(self.scorer_spec_.ByteSizePartial())
4242 self.scorer_spec_.OutputPartial(out)
4243 if (self.has_field_spec_):
4244 out.putVarInt32(82)
4245 out.putVarInt32(self.field_spec_.ByteSizePartial())
4246 self.field_spec_.OutputPartial(out)
4247 if (self.has_offset_):
4248 out.putVarInt32(88)
4249 out.putVarInt32(self.offset_)
4250 if (self.has_keys_only_):
4251 out.putVarInt32(96)
4252 out.putBoolean(self.keys_only_)
4253 if (self.has_parsing_mode_):
4254 out.putVarInt32(104)
4255 out.putVarInt32(self.parsing_mode_)
4257 def TryMerge(self, d):
4258 while d.avail() > 0:
4259 tt = d.getVarInt32()
4260 if tt == 10:
4261 length = d.getVarInt32()
4262 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4263 d.skip(length)
4264 self.mutable_index_spec().TryMerge(tmp)
4265 continue
4266 if tt == 18:
4267 self.set_query(d.getPrefixedString())
4268 continue
4269 if tt == 34:
4270 self.set_cursor(d.getPrefixedString())
4271 continue
4272 if tt == 40:
4273 self.set_cursor_type(d.getVarInt32())
4274 continue
4275 if tt == 48:
4276 self.set_limit(d.getVarInt32())
4277 continue
4278 if tt == 56:
4279 self.set_matched_count_accuracy(d.getVarInt32())
4280 continue
4281 if tt == 66:
4282 length = d.getVarInt32()
4283 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4284 d.skip(length)
4285 self.add_sort_spec().TryMerge(tmp)
4286 continue
4287 if tt == 74:
4288 length = d.getVarInt32()
4289 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4290 d.skip(length)
4291 self.mutable_scorer_spec().TryMerge(tmp)
4292 continue
4293 if tt == 82:
4294 length = d.getVarInt32()
4295 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4296 d.skip(length)
4297 self.mutable_field_spec().TryMerge(tmp)
4298 continue
4299 if tt == 88:
4300 self.set_offset(d.getVarInt32())
4301 continue
4302 if tt == 96:
4303 self.set_keys_only(d.getBoolean())
4304 continue
4305 if tt == 104:
4306 self.set_parsing_mode(d.getVarInt32())
4307 continue
4310 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4311 d.skipData(tt)
4314 def __str__(self, prefix="", printElemNumber=0):
4315 res=""
4316 if self.has_index_spec_:
4317 res+=prefix+"index_spec <\n"
4318 res+=self.index_spec_.__str__(prefix + " ", printElemNumber)
4319 res+=prefix+">\n"
4320 if self.has_query_: res+=prefix+("query: %s\n" % self.DebugFormatString(self.query_))
4321 if self.has_cursor_: res+=prefix+("cursor: %s\n" % self.DebugFormatString(self.cursor_))
4322 if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
4323 if self.has_cursor_type_: res+=prefix+("cursor_type: %s\n" % self.DebugFormatInt32(self.cursor_type_))
4324 if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
4325 if self.has_matched_count_accuracy_: res+=prefix+("matched_count_accuracy: %s\n" % self.DebugFormatInt32(self.matched_count_accuracy_))
4326 cnt=0
4327 for e in self.sort_spec_:
4328 elm=""
4329 if printElemNumber: elm="(%d)" % cnt
4330 res+=prefix+("sort_spec%s <\n" % elm)
4331 res+=e.__str__(prefix + " ", printElemNumber)
4332 res+=prefix+">\n"
4333 cnt+=1
4334 if self.has_scorer_spec_:
4335 res+=prefix+"scorer_spec <\n"
4336 res+=self.scorer_spec_.__str__(prefix + " ", printElemNumber)
4337 res+=prefix+">\n"
4338 if self.has_field_spec_:
4339 res+=prefix+"field_spec <\n"
4340 res+=self.field_spec_.__str__(prefix + " ", printElemNumber)
4341 res+=prefix+">\n"
4342 if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
4343 if self.has_parsing_mode_: res+=prefix+("parsing_mode: %s\n" % self.DebugFormatInt32(self.parsing_mode_))
4344 return res
4347 def _BuildTagLookupTable(sparse, maxtag, default=None):
4348 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4350 kindex_spec = 1
4351 kquery = 2
4352 kcursor = 4
4353 koffset = 11
4354 kcursor_type = 5
4355 klimit = 6
4356 kmatched_count_accuracy = 7
4357 ksort_spec = 8
4358 kscorer_spec = 9
4359 kfield_spec = 10
4360 kkeys_only = 12
4361 kparsing_mode = 13
4363 _TEXT = _BuildTagLookupTable({
4364 0: "ErrorCode",
4365 1: "index_spec",
4366 2: "query",
4367 4: "cursor",
4368 5: "cursor_type",
4369 6: "limit",
4370 7: "matched_count_accuracy",
4371 8: "sort_spec",
4372 9: "scorer_spec",
4373 10: "field_spec",
4374 11: "offset",
4375 12: "keys_only",
4376 13: "parsing_mode",
4377 }, 13)
4379 _TYPES = _BuildTagLookupTable({
4380 0: ProtocolBuffer.Encoder.NUMERIC,
4381 1: ProtocolBuffer.Encoder.STRING,
4382 2: ProtocolBuffer.Encoder.STRING,
4383 4: ProtocolBuffer.Encoder.STRING,
4384 5: ProtocolBuffer.Encoder.NUMERIC,
4385 6: ProtocolBuffer.Encoder.NUMERIC,
4386 7: ProtocolBuffer.Encoder.NUMERIC,
4387 8: ProtocolBuffer.Encoder.STRING,
4388 9: ProtocolBuffer.Encoder.STRING,
4389 10: ProtocolBuffer.Encoder.STRING,
4390 11: ProtocolBuffer.Encoder.NUMERIC,
4391 12: ProtocolBuffer.Encoder.NUMERIC,
4392 13: ProtocolBuffer.Encoder.NUMERIC,
4393 }, 13, ProtocolBuffer.Encoder.MAX_TYPE)
4396 _STYLE = """"""
4397 _STYLE_CONTENT_TYPE = """"""
4398 _PROTO_DESCRIPTOR_NAME = 'apphosting.SearchParams'
4399 class SearchRequest(ProtocolBuffer.ProtocolMessage):
4400 has_params_ = 0
4401 has_app_id_ = 0
4402 app_id_ = ""
4404 def __init__(self, contents=None):
4405 self.params_ = SearchParams()
4406 if contents is not None: self.MergeFromString(contents)
4408 def params(self): return self.params_
4410 def mutable_params(self): self.has_params_ = 1; return self.params_
4412 def clear_params(self):self.has_params_ = 0; self.params_.Clear()
4414 def has_params(self): return self.has_params_
4416 def app_id(self): return self.app_id_
4418 def set_app_id(self, x):
4419 self.has_app_id_ = 1
4420 self.app_id_ = x
4422 def clear_app_id(self):
4423 if self.has_app_id_:
4424 self.has_app_id_ = 0
4425 self.app_id_ = ""
4427 def has_app_id(self): return self.has_app_id_
4430 def MergeFrom(self, x):
4431 assert x is not self
4432 if (x.has_params()): self.mutable_params().MergeFrom(x.params())
4433 if (x.has_app_id()): self.set_app_id(x.app_id())
4435 def Equals(self, x):
4436 if x is self: return 1
4437 if self.has_params_ != x.has_params_: return 0
4438 if self.has_params_ and self.params_ != x.params_: return 0
4439 if self.has_app_id_ != x.has_app_id_: return 0
4440 if self.has_app_id_ and self.app_id_ != x.app_id_: return 0
4441 return 1
4443 def IsInitialized(self, debug_strs=None):
4444 initialized = 1
4445 if (not self.has_params_):
4446 initialized = 0
4447 if debug_strs is not None:
4448 debug_strs.append('Required field: params not set.')
4449 elif not self.params_.IsInitialized(debug_strs): initialized = 0
4450 return initialized
4452 def ByteSize(self):
4453 n = 0
4454 n += self.lengthString(self.params_.ByteSize())
4455 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
4456 return n + 1
4458 def ByteSizePartial(self):
4459 n = 0
4460 if (self.has_params_):
4461 n += 1
4462 n += self.lengthString(self.params_.ByteSizePartial())
4463 if (self.has_app_id_): n += 1 + self.lengthString(len(self.app_id_))
4464 return n
4466 def Clear(self):
4467 self.clear_params()
4468 self.clear_app_id()
4470 def OutputUnchecked(self, out):
4471 out.putVarInt32(10)
4472 out.putVarInt32(self.params_.ByteSize())
4473 self.params_.OutputUnchecked(out)
4474 if (self.has_app_id_):
4475 out.putVarInt32(26)
4476 out.putPrefixedString(self.app_id_)
4478 def OutputPartial(self, out):
4479 if (self.has_params_):
4480 out.putVarInt32(10)
4481 out.putVarInt32(self.params_.ByteSizePartial())
4482 self.params_.OutputPartial(out)
4483 if (self.has_app_id_):
4484 out.putVarInt32(26)
4485 out.putPrefixedString(self.app_id_)
4487 def TryMerge(self, d):
4488 while d.avail() > 0:
4489 tt = d.getVarInt32()
4490 if tt == 10:
4491 length = d.getVarInt32()
4492 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4493 d.skip(length)
4494 self.mutable_params().TryMerge(tmp)
4495 continue
4496 if tt == 26:
4497 self.set_app_id(d.getPrefixedString())
4498 continue
4501 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4502 d.skipData(tt)
4505 def __str__(self, prefix="", printElemNumber=0):
4506 res=""
4507 if self.has_params_:
4508 res+=prefix+"params <\n"
4509 res+=self.params_.__str__(prefix + " ", printElemNumber)
4510 res+=prefix+">\n"
4511 if self.has_app_id_: res+=prefix+("app_id: %s\n" % self.DebugFormatString(self.app_id_))
4512 return res
4515 def _BuildTagLookupTable(sparse, maxtag, default=None):
4516 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4518 kparams = 1
4519 kapp_id = 3
4521 _TEXT = _BuildTagLookupTable({
4522 0: "ErrorCode",
4523 1: "params",
4524 3: "app_id",
4525 }, 3)
4527 _TYPES = _BuildTagLookupTable({
4528 0: ProtocolBuffer.Encoder.NUMERIC,
4529 1: ProtocolBuffer.Encoder.STRING,
4530 3: ProtocolBuffer.Encoder.STRING,
4531 }, 3, ProtocolBuffer.Encoder.MAX_TYPE)
4534 _STYLE = """"""
4535 _STYLE_CONTENT_TYPE = """"""
4536 _PROTO_DESCRIPTOR_NAME = 'apphosting.SearchRequest'
4537 class SearchResult(ProtocolBuffer.ProtocolMessage):
4538 has_document_ = 0
4539 has_cursor_ = 0
4540 cursor_ = ""
4542 def __init__(self, contents=None):
4543 self.document_ = Document()
4544 self.expression_ = []
4545 self.score_ = []
4546 if contents is not None: self.MergeFromString(contents)
4548 def document(self): return self.document_
4550 def mutable_document(self): self.has_document_ = 1; return self.document_
4552 def clear_document(self):self.has_document_ = 0; self.document_.Clear()
4554 def has_document(self): return self.has_document_
4556 def expression_size(self): return len(self.expression_)
4557 def expression_list(self): return self.expression_
4559 def expression(self, i):
4560 return self.expression_[i]
4562 def mutable_expression(self, i):
4563 return self.expression_[i]
4565 def add_expression(self):
4566 x = Field()
4567 self.expression_.append(x)
4568 return x
4570 def clear_expression(self):
4571 self.expression_ = []
4572 def score_size(self): return len(self.score_)
4573 def score_list(self): return self.score_
4575 def score(self, i):
4576 return self.score_[i]
4578 def set_score(self, i, x):
4579 self.score_[i] = x
4581 def add_score(self, x):
4582 self.score_.append(x)
4584 def clear_score(self):
4585 self.score_ = []
4587 def cursor(self): return self.cursor_
4589 def set_cursor(self, x):
4590 self.has_cursor_ = 1
4591 self.cursor_ = x
4593 def clear_cursor(self):
4594 if self.has_cursor_:
4595 self.has_cursor_ = 0
4596 self.cursor_ = ""
4598 def has_cursor(self): return self.has_cursor_
4601 def MergeFrom(self, x):
4602 assert x is not self
4603 if (x.has_document()): self.mutable_document().MergeFrom(x.document())
4604 for i in xrange(x.expression_size()): self.add_expression().CopyFrom(x.expression(i))
4605 for i in xrange(x.score_size()): self.add_score(x.score(i))
4606 if (x.has_cursor()): self.set_cursor(x.cursor())
4608 def Equals(self, x):
4609 if x is self: return 1
4610 if self.has_document_ != x.has_document_: return 0
4611 if self.has_document_ and self.document_ != x.document_: return 0
4612 if len(self.expression_) != len(x.expression_): return 0
4613 for e1, e2 in zip(self.expression_, x.expression_):
4614 if e1 != e2: return 0
4615 if len(self.score_) != len(x.score_): return 0
4616 for e1, e2 in zip(self.score_, x.score_):
4617 if e1 != e2: return 0
4618 if self.has_cursor_ != x.has_cursor_: return 0
4619 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
4620 return 1
4622 def IsInitialized(self, debug_strs=None):
4623 initialized = 1
4624 if (not self.has_document_):
4625 initialized = 0
4626 if debug_strs is not None:
4627 debug_strs.append('Required field: document not set.')
4628 elif not self.document_.IsInitialized(debug_strs): initialized = 0
4629 for p in self.expression_:
4630 if not p.IsInitialized(debug_strs): initialized=0
4631 return initialized
4633 def ByteSize(self):
4634 n = 0
4635 n += self.lengthString(self.document_.ByteSize())
4636 n += 1 * len(self.expression_)
4637 for i in xrange(len(self.expression_)): n += self.lengthString(self.expression_[i].ByteSize())
4638 n += 9 * len(self.score_)
4639 if (self.has_cursor_): n += 1 + self.lengthString(len(self.cursor_))
4640 return n + 1
4642 def ByteSizePartial(self):
4643 n = 0
4644 if (self.has_document_):
4645 n += 1
4646 n += self.lengthString(self.document_.ByteSizePartial())
4647 n += 1 * len(self.expression_)
4648 for i in xrange(len(self.expression_)): n += self.lengthString(self.expression_[i].ByteSizePartial())
4649 n += 9 * len(self.score_)
4650 if (self.has_cursor_): n += 1 + self.lengthString(len(self.cursor_))
4651 return n
4653 def Clear(self):
4654 self.clear_document()
4655 self.clear_expression()
4656 self.clear_score()
4657 self.clear_cursor()
4659 def OutputUnchecked(self, out):
4660 out.putVarInt32(10)
4661 out.putVarInt32(self.document_.ByteSize())
4662 self.document_.OutputUnchecked(out)
4663 for i in xrange(len(self.score_)):
4664 out.putVarInt32(17)
4665 out.putDouble(self.score_[i])
4666 if (self.has_cursor_):
4667 out.putVarInt32(26)
4668 out.putPrefixedString(self.cursor_)
4669 for i in xrange(len(self.expression_)):
4670 out.putVarInt32(34)
4671 out.putVarInt32(self.expression_[i].ByteSize())
4672 self.expression_[i].OutputUnchecked(out)
4674 def OutputPartial(self, out):
4675 if (self.has_document_):
4676 out.putVarInt32(10)
4677 out.putVarInt32(self.document_.ByteSizePartial())
4678 self.document_.OutputPartial(out)
4679 for i in xrange(len(self.score_)):
4680 out.putVarInt32(17)
4681 out.putDouble(self.score_[i])
4682 if (self.has_cursor_):
4683 out.putVarInt32(26)
4684 out.putPrefixedString(self.cursor_)
4685 for i in xrange(len(self.expression_)):
4686 out.putVarInt32(34)
4687 out.putVarInt32(self.expression_[i].ByteSizePartial())
4688 self.expression_[i].OutputPartial(out)
4690 def TryMerge(self, d):
4691 while d.avail() > 0:
4692 tt = d.getVarInt32()
4693 if tt == 10:
4694 length = d.getVarInt32()
4695 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4696 d.skip(length)
4697 self.mutable_document().TryMerge(tmp)
4698 continue
4699 if tt == 17:
4700 self.add_score(d.getDouble())
4701 continue
4702 if tt == 26:
4703 self.set_cursor(d.getPrefixedString())
4704 continue
4705 if tt == 34:
4706 length = d.getVarInt32()
4707 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4708 d.skip(length)
4709 self.add_expression().TryMerge(tmp)
4710 continue
4713 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4714 d.skipData(tt)
4717 def __str__(self, prefix="", printElemNumber=0):
4718 res=""
4719 if self.has_document_:
4720 res+=prefix+"document <\n"
4721 res+=self.document_.__str__(prefix + " ", printElemNumber)
4722 res+=prefix+">\n"
4723 cnt=0
4724 for e in self.expression_:
4725 elm=""
4726 if printElemNumber: elm="(%d)" % cnt
4727 res+=prefix+("expression%s <\n" % elm)
4728 res+=e.__str__(prefix + " ", printElemNumber)
4729 res+=prefix+">\n"
4730 cnt+=1
4731 cnt=0
4732 for e in self.score_:
4733 elm=""
4734 if printElemNumber: elm="(%d)" % cnt
4735 res+=prefix+("score%s: %s\n" % (elm, self.DebugFormat(e)))
4736 cnt+=1
4737 if self.has_cursor_: res+=prefix+("cursor: %s\n" % self.DebugFormatString(self.cursor_))
4738 return res
4741 def _BuildTagLookupTable(sparse, maxtag, default=None):
4742 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4744 kdocument = 1
4745 kexpression = 4
4746 kscore = 2
4747 kcursor = 3
4749 _TEXT = _BuildTagLookupTable({
4750 0: "ErrorCode",
4751 1: "document",
4752 2: "score",
4753 3: "cursor",
4754 4: "expression",
4755 }, 4)
4757 _TYPES = _BuildTagLookupTable({
4758 0: ProtocolBuffer.Encoder.NUMERIC,
4759 1: ProtocolBuffer.Encoder.STRING,
4760 2: ProtocolBuffer.Encoder.DOUBLE,
4761 3: ProtocolBuffer.Encoder.STRING,
4762 4: ProtocolBuffer.Encoder.STRING,
4763 }, 4, ProtocolBuffer.Encoder.MAX_TYPE)
4766 _STYLE = """"""
4767 _STYLE_CONTENT_TYPE = """"""
4768 _PROTO_DESCRIPTOR_NAME = 'apphosting.SearchResult'
4769 class SearchResponse(ProtocolBuffer.ProtocolMessage):
4770 has_matched_count_ = 0
4771 matched_count_ = 0
4772 has_status_ = 0
4773 has_cursor_ = 0
4774 cursor_ = ""
4776 def __init__(self, contents=None):
4777 self.result_ = []
4778 self.status_ = RequestStatus()
4779 if contents is not None: self.MergeFromString(contents)
4781 def result_size(self): return len(self.result_)
4782 def result_list(self): return self.result_
4784 def result(self, i):
4785 return self.result_[i]
4787 def mutable_result(self, i):
4788 return self.result_[i]
4790 def add_result(self):
4791 x = SearchResult()
4792 self.result_.append(x)
4793 return x
4795 def clear_result(self):
4796 self.result_ = []
4797 def matched_count(self): return self.matched_count_
4799 def set_matched_count(self, x):
4800 self.has_matched_count_ = 1
4801 self.matched_count_ = x
4803 def clear_matched_count(self):
4804 if self.has_matched_count_:
4805 self.has_matched_count_ = 0
4806 self.matched_count_ = 0
4808 def has_matched_count(self): return self.has_matched_count_
4810 def status(self): return self.status_
4812 def mutable_status(self): self.has_status_ = 1; return self.status_
4814 def clear_status(self):self.has_status_ = 0; self.status_.Clear()
4816 def has_status(self): return self.has_status_
4818 def cursor(self): return self.cursor_
4820 def set_cursor(self, x):
4821 self.has_cursor_ = 1
4822 self.cursor_ = x
4824 def clear_cursor(self):
4825 if self.has_cursor_:
4826 self.has_cursor_ = 0
4827 self.cursor_ = ""
4829 def has_cursor(self): return self.has_cursor_
4832 def MergeFrom(self, x):
4833 assert x is not self
4834 for i in xrange(x.result_size()): self.add_result().CopyFrom(x.result(i))
4835 if (x.has_matched_count()): self.set_matched_count(x.matched_count())
4836 if (x.has_status()): self.mutable_status().MergeFrom(x.status())
4837 if (x.has_cursor()): self.set_cursor(x.cursor())
4839 def Equals(self, x):
4840 if x is self: return 1
4841 if len(self.result_) != len(x.result_): return 0
4842 for e1, e2 in zip(self.result_, x.result_):
4843 if e1 != e2: return 0
4844 if self.has_matched_count_ != x.has_matched_count_: return 0
4845 if self.has_matched_count_ and self.matched_count_ != x.matched_count_: return 0
4846 if self.has_status_ != x.has_status_: return 0
4847 if self.has_status_ and self.status_ != x.status_: return 0
4848 if self.has_cursor_ != x.has_cursor_: return 0
4849 if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
4850 return 1
4852 def IsInitialized(self, debug_strs=None):
4853 initialized = 1
4854 for p in self.result_:
4855 if not p.IsInitialized(debug_strs): initialized=0
4856 if (not self.has_matched_count_):
4857 initialized = 0
4858 if debug_strs is not None:
4859 debug_strs.append('Required field: matched_count not set.')
4860 if (not self.has_status_):
4861 initialized = 0
4862 if debug_strs is not None:
4863 debug_strs.append('Required field: status not set.')
4864 elif not self.status_.IsInitialized(debug_strs): initialized = 0
4865 return initialized
4867 def ByteSize(self):
4868 n = 0
4869 n += 1 * len(self.result_)
4870 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSize())
4871 n += self.lengthVarInt64(self.matched_count_)
4872 n += self.lengthString(self.status_.ByteSize())
4873 if (self.has_cursor_): n += 1 + self.lengthString(len(self.cursor_))
4874 return n + 2
4876 def ByteSizePartial(self):
4877 n = 0
4878 n += 1 * len(self.result_)
4879 for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSizePartial())
4880 if (self.has_matched_count_):
4881 n += 1
4882 n += self.lengthVarInt64(self.matched_count_)
4883 if (self.has_status_):
4884 n += 1
4885 n += self.lengthString(self.status_.ByteSizePartial())
4886 if (self.has_cursor_): n += 1 + self.lengthString(len(self.cursor_))
4887 return n
4889 def Clear(self):
4890 self.clear_result()
4891 self.clear_matched_count()
4892 self.clear_status()
4893 self.clear_cursor()
4895 def OutputUnchecked(self, out):
4896 for i in xrange(len(self.result_)):
4897 out.putVarInt32(10)
4898 out.putVarInt32(self.result_[i].ByteSize())
4899 self.result_[i].OutputUnchecked(out)
4900 out.putVarInt32(16)
4901 out.putVarInt64(self.matched_count_)
4902 out.putVarInt32(26)
4903 out.putVarInt32(self.status_.ByteSize())
4904 self.status_.OutputUnchecked(out)
4905 if (self.has_cursor_):
4906 out.putVarInt32(34)
4907 out.putPrefixedString(self.cursor_)
4909 def OutputPartial(self, out):
4910 for i in xrange(len(self.result_)):
4911 out.putVarInt32(10)
4912 out.putVarInt32(self.result_[i].ByteSizePartial())
4913 self.result_[i].OutputPartial(out)
4914 if (self.has_matched_count_):
4915 out.putVarInt32(16)
4916 out.putVarInt64(self.matched_count_)
4917 if (self.has_status_):
4918 out.putVarInt32(26)
4919 out.putVarInt32(self.status_.ByteSizePartial())
4920 self.status_.OutputPartial(out)
4921 if (self.has_cursor_):
4922 out.putVarInt32(34)
4923 out.putPrefixedString(self.cursor_)
4925 def TryMerge(self, d):
4926 while d.avail() > 0:
4927 tt = d.getVarInt32()
4928 if tt == 10:
4929 length = d.getVarInt32()
4930 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4931 d.skip(length)
4932 self.add_result().TryMerge(tmp)
4933 continue
4934 if tt == 16:
4935 self.set_matched_count(d.getVarInt64())
4936 continue
4937 if tt == 26:
4938 length = d.getVarInt32()
4939 tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
4940 d.skip(length)
4941 self.mutable_status().TryMerge(tmp)
4942 continue
4943 if tt == 34:
4944 self.set_cursor(d.getPrefixedString())
4945 continue
4948 if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
4949 d.skipData(tt)
4952 def __str__(self, prefix="", printElemNumber=0):
4953 res=""
4954 cnt=0
4955 for e in self.result_:
4956 elm=""
4957 if printElemNumber: elm="(%d)" % cnt
4958 res+=prefix+("result%s <\n" % elm)
4959 res+=e.__str__(prefix + " ", printElemNumber)
4960 res+=prefix+">\n"
4961 cnt+=1
4962 if self.has_matched_count_: res+=prefix+("matched_count: %s\n" % self.DebugFormatInt64(self.matched_count_))
4963 if self.has_status_:
4964 res+=prefix+"status <\n"
4965 res+=self.status_.__str__(prefix + " ", printElemNumber)
4966 res+=prefix+">\n"
4967 if self.has_cursor_: res+=prefix+("cursor: %s\n" % self.DebugFormatString(self.cursor_))
4968 return res
4971 def _BuildTagLookupTable(sparse, maxtag, default=None):
4972 return tuple([sparse.get(i, default) for i in xrange(0, 1+maxtag)])
4974 kresult = 1
4975 kmatched_count = 2
4976 kstatus = 3
4977 kcursor = 4
4979 _TEXT = _BuildTagLookupTable({
4980 0: "ErrorCode",
4981 1: "result",
4982 2: "matched_count",
4983 3: "status",
4984 4: "cursor",
4985 }, 4)
4987 _TYPES = _BuildTagLookupTable({
4988 0: ProtocolBuffer.Encoder.NUMERIC,
4989 1: ProtocolBuffer.Encoder.STRING,
4990 2: ProtocolBuffer.Encoder.NUMERIC,
4991 3: ProtocolBuffer.Encoder.STRING,
4992 4: ProtocolBuffer.Encoder.STRING,
4993 }, 4, ProtocolBuffer.Encoder.MAX_TYPE)
4996 _STYLE = """"""
4997 _STYLE_CONTENT_TYPE = """"""
4998 _PROTO_DESCRIPTOR_NAME = 'apphosting.SearchResponse'
4999 if _extension_runtime:
5000 pass
5002 __all__ = ['SearchServiceError','RequestStatus','IndexSpec','IndexMetadata','IndexDocumentParams','IndexDocumentRequest','IndexDocumentResponse','DeleteDocumentParams','DeleteDocumentRequest','DeleteDocumentResponse','ListDocumentsParams','ListDocumentsRequest','ListDocumentsResponse','ListIndexesParams','ListIndexesRequest','ListIndexesResponse','DeleteSchemaParams','DeleteSchemaRequest','DeleteSchemaResponse','SortSpec','ScorerSpec','FieldSpec','FieldSpec_Expression','SearchParams','SearchRequest','SearchResult','SearchResponse']