3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from google
.net
.proto
import ProtocolBuffer
22 import dummy_thread
as thread
24 __pychecker__
= """maxreturns=0 maxbranches=0 no-callinit
25 unusednames=printElemNumber,debug_strs no-special"""
27 if hasattr(ProtocolBuffer
, 'ExtendableProtocolMessage'):
28 _extension_runtime
= True
29 _ExtendableProtocolMessage
= ProtocolBuffer
.ExtendableProtocolMessage
31 _extension_runtime
= False
32 _ExtendableProtocolMessage
= ProtocolBuffer
.ProtocolMessage
34 from google
.appengine
.datastore
.document_pb
import *
35 import google
.appengine
.datastore
.document_pb
36 class SearchServiceError(ProtocolBuffer
.ProtocolMessage
):
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):
59 if contents
is not None: self
.MergeFromString(contents
)
62 def MergeFrom(self
, x
):
66 if x
is self
: return 1
69 def IsInitialized(self
, debug_strs
=None):
77 def ByteSizePartial(self
):
84 def OutputUnchecked(self
, out
):
87 def OutputPartial(self
, out
):
90 def TryMerge(self
, d
):
95 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
99 def __str__(self
, prefix
="", printElemNumber
=0):
104 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
105 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
108 _TEXT
= _BuildTagLookupTable({
112 _TYPES
= _BuildTagLookupTable({
113 0: ProtocolBuffer
.Encoder
.NUMERIC
,
114 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
118 _STYLE_CONTENT_TYPE
= """"""
119 _PROTO_DESCRIPTOR_NAME
= 'apphosting.SearchServiceError'
120 class RequestStatus(ProtocolBuffer
.ProtocolMessage
):
123 has_error_detail_
= 0
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
):
135 def clear_code(self
):
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
):
158 if (x
.has_code()): self
.set_code(x
.code())
159 if (x
.has_error_detail()): self
.set_error_detail(x
.error_detail())
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
169 def IsInitialized(self
, debug_strs
=None):
171 if (not self
.has_code_
):
173 if debug_strs
is not None:
174 debug_strs
.append('Required field: code not set.')
179 n
+= self
.lengthVarInt64(self
.code_
)
180 if (self
.has_error_detail_
): n
+= 1 + self
.lengthString(len(self
.error_detail_
))
183 def ByteSizePartial(self
):
187 n
+= self
.lengthVarInt64(self
.code_
)
188 if (self
.has_error_detail_
): n
+= 1 + self
.lengthString(len(self
.error_detail_
))
193 self
.clear_error_detail()
195 def OutputUnchecked(self
, out
):
197 out
.putVarInt32(self
.code_
)
198 if (self
.has_error_detail_
):
200 out
.putPrefixedString(self
.error_detail_
)
202 def OutputPartial(self
, out
):
205 out
.putVarInt32(self
.code_
)
206 if (self
.has_error_detail_
):
208 out
.putPrefixedString(self
.error_detail_
)
210 def TryMerge(self
, d
):
214 self
.set_code(d
.getVarInt32())
217 self
.set_error_detail(d
.getPrefixedString())
221 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
225 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
232 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
233 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
238 _TEXT
= _BuildTagLookupTable({
244 _TYPES
= _BuildTagLookupTable({
245 0: ProtocolBuffer
.Encoder
.NUMERIC
,
246 1: ProtocolBuffer
.Encoder
.NUMERIC
,
247 2: ProtocolBuffer
.Encoder
.STRING
,
248 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
252 _STYLE_CONTENT_TYPE
= """"""
253 _PROTO_DESCRIPTOR_NAME
= 'apphosting.RequestStatus'
254 class IndexSpec(ProtocolBuffer
.ProtocolMessage
):
260 _Consistency_NAMES
= {
265 def Consistency_Name(cls
, x
): return cls
._Consistency
_NAMES
.get(x
, "")
266 Consistency_Name
= classmethod(Consistency_Name
)
280 def Source_Name(cls
, x
): return cls
._Source
_NAMES
.get(x
, "")
281 Source_Name
= classmethod(Source_Name
)
293 def Mode_Name(cls
, x
): return cls
._Mode
_NAMES
.get(x
, "")
294 Mode_Name
= classmethod(Mode_Name
)
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
):
318 def clear_name(self
):
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
344 def clear_namespace(self
):
345 if self
.has_namespace_
:
346 self
.has_namespace_
= 0
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
357 def clear_version(self
):
358 if self
.has_version_
:
359 self
.has_version_
= 0
362 def has_version(self
): return self
.has_version_
364 def source(self
): return self
.source_
366 def set_source(self
, x
):
370 def clear_source(self
):
375 def has_source(self
): return self
.has_source_
377 def mode(self
): return self
.mode_
379 def set_mode(self
, x
):
383 def clear_mode(self
):
388 def has_mode(self
): return self
.has_mode_
391 def MergeFrom(self
, x
):
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())
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
416 def IsInitialized(self
, debug_strs
=None):
418 if (not self
.has_name_
):
420 if debug_strs
is not None:
421 debug_strs
.append('Required field: name not set.')
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_
)
434 def ByteSizePartial(self
):
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_
)
448 self
.clear_consistency()
449 self
.clear_namespace()
454 def OutputUnchecked(self
, out
):
456 out
.putPrefixedString(self
.name_
)
457 if (self
.has_consistency_
):
459 out
.putVarInt32(self
.consistency_
)
460 if (self
.has_namespace_
):
462 out
.putPrefixedString(self
.namespace_
)
463 if (self
.has_version_
):
465 out
.putVarInt32(self
.version_
)
466 if (self
.has_source_
):
468 out
.putVarInt32(self
.source_
)
471 out
.putVarInt32(self
.mode_
)
473 def OutputPartial(self
, out
):
476 out
.putPrefixedString(self
.name_
)
477 if (self
.has_consistency_
):
479 out
.putVarInt32(self
.consistency_
)
480 if (self
.has_namespace_
):
482 out
.putPrefixedString(self
.namespace_
)
483 if (self
.has_version_
):
485 out
.putVarInt32(self
.version_
)
486 if (self
.has_source_
):
488 out
.putVarInt32(self
.source_
)
491 out
.putVarInt32(self
.mode_
)
493 def TryMerge(self
, d
):
497 self
.set_name(d
.getPrefixedString())
500 self
.set_consistency(d
.getVarInt32())
503 self
.set_namespace(d
.getPrefixedString())
506 self
.set_version(d
.getVarInt32())
509 self
.set_source(d
.getVarInt32())
512 self
.set_mode(d
.getVarInt32())
516 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
520 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
531 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
532 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
541 _TEXT
= _BuildTagLookupTable({
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
)
563 _STYLE_CONTENT_TYPE
= """"""
564 _PROTO_DESCRIPTOR_NAME
= 'apphosting.IndexSpec'
565 class IndexMetadata(ProtocolBuffer
.ProtocolMessage
):
568 def __init__(self
, contents
=None):
569 self
.index_spec_
= IndexSpec()
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_
585 return self
.field_
[i
]
587 def mutable_field(self
, i
):
588 return self
.field_
[i
]
592 self
.field_
.append(x
)
595 def clear_field(self
):
598 def MergeFrom(self
, x
):
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
))
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
612 def IsInitialized(self
, debug_strs
=None):
614 if (not self
.has_index_spec_
):
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
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())
630 def ByteSizePartial(self
):
632 if (self
.has_index_spec_
):
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())
640 self
.clear_index_spec()
643 def OutputUnchecked(self
, out
):
645 out
.putVarInt32(self
.index_spec_
.ByteSize())
646 self
.index_spec_
.OutputUnchecked(out
)
647 for i
in xrange(len(self
.field_
)):
649 out
.putVarInt32(self
.field_
[i
].ByteSize())
650 self
.field_
[i
].OutputUnchecked(out
)
652 def OutputPartial(self
, out
):
653 if (self
.has_index_spec_
):
655 out
.putVarInt32(self
.index_spec_
.ByteSizePartial())
656 self
.index_spec_
.OutputPartial(out
)
657 for i
in xrange(len(self
.field_
)):
659 out
.putVarInt32(self
.field_
[i
].ByteSizePartial())
660 self
.field_
[i
].OutputPartial(out
)
662 def TryMerge(self
, d
):
666 length
= d
.getVarInt32()
667 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
669 self
.mutable_index_spec().TryMerge(tmp
)
672 length
= d
.getVarInt32()
673 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
675 self
.add_field().TryMerge(tmp
)
679 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
683 def __str__(self
, prefix
="", printElemNumber
=0):
685 if self
.has_index_spec_
:
686 res
+=prefix
+"index_spec <\n"
687 res
+=self
.index_spec_
.__str
__(prefix
+ " ", printElemNumber
)
690 for e
in self
.field_
:
692 if printElemNumber
: elm
="(%d)" % cnt
693 res
+=prefix
+("field%s <\n" % elm
)
694 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
700 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
701 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
706 _TEXT
= _BuildTagLookupTable({
712 _TYPES
= _BuildTagLookupTable({
713 0: ProtocolBuffer
.Encoder
.NUMERIC
,
714 1: ProtocolBuffer
.Encoder
.STRING
,
715 2: ProtocolBuffer
.Encoder
.STRING
,
716 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
720 _STYLE_CONTENT_TYPE
= """"""
721 _PROTO_DESCRIPTOR_NAME
= 'apphosting.IndexMetadata'
722 class IndexDocumentParams(ProtocolBuffer
.ProtocolMessage
):
730 1: "WHEN_CONVENIENT",
733 def Freshness_Name(cls
, x
): return cls
._Freshness
_NAMES
.get(x
, "")
734 Freshness_Name
= classmethod(Freshness_Name
)
740 def __init__(self
, contents
=None):
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
):
756 self
.document_
.append(x
)
759 def clear_document(self
):
761 def freshness(self
): return self
.freshness_
763 def set_freshness(self
, x
):
764 self
.has_freshness_
= 1
767 def clear_freshness(self
):
768 if self
.has_freshness_
:
769 self
.has_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
):
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())
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
800 def IsInitialized(self
, debug_strs
=None):
802 for p
in self
.document_
:
803 if not p
.IsInitialized(debug_strs
): initialized
=0
804 if (not self
.has_index_spec_
):
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
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())
819 def ByteSizePartial(self
):
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_
):
826 n
+= self
.lengthString(self
.index_spec_
.ByteSizePartial())
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_
)):
837 out
.putVarInt32(self
.document_
[i
].ByteSize())
838 self
.document_
[i
].OutputUnchecked(out
)
839 if (self
.has_freshness_
):
841 out
.putVarInt32(self
.freshness_
)
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_
)):
849 out
.putVarInt32(self
.document_
[i
].ByteSizePartial())
850 self
.document_
[i
].OutputPartial(out
)
851 if (self
.has_freshness_
):
853 out
.putVarInt32(self
.freshness_
)
854 if (self
.has_index_spec_
):
856 out
.putVarInt32(self
.index_spec_
.ByteSizePartial())
857 self
.index_spec_
.OutputPartial(out
)
859 def TryMerge(self
, d
):
863 length
= d
.getVarInt32()
864 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
866 self
.add_document().TryMerge(tmp
)
869 self
.set_freshness(d
.getVarInt32())
872 length
= d
.getVarInt32()
873 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
875 self
.mutable_index_spec().TryMerge(tmp
)
879 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
883 def __str__(self
, prefix
="", printElemNumber
=0):
886 for e
in self
.document_
:
888 if printElemNumber
: elm
="(%d)" % cnt
889 res
+=prefix
+("document%s <\n" % elm
)
890 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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
)
901 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
902 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
908 _TEXT
= _BuildTagLookupTable({
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
)
924 _STYLE_CONTENT_TYPE
= """"""
925 _PROTO_DESCRIPTOR_NAME
= 'apphosting.IndexDocumentParams'
926 class IndexDocumentRequest(ProtocolBuffer
.ProtocolMessage
):
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
):
949 def clear_app_id(self
):
954 def has_app_id(self
): return self
.has_app_id_
957 def MergeFrom(self
, x
):
959 if (x
.has_params()): self
.mutable_params().MergeFrom(x
.params())
960 if (x
.has_app_id()): self
.set_app_id(x
.app_id())
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
970 def IsInitialized(self
, debug_strs
=None):
972 if (not self
.has_params_
):
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
981 n
+= self
.lengthString(self
.params_
.ByteSize())
982 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
985 def ByteSizePartial(self
):
987 if (self
.has_params_
):
989 n
+= self
.lengthString(self
.params_
.ByteSizePartial())
990 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
997 def OutputUnchecked(self
, out
):
999 out
.putVarInt32(self
.params_
.ByteSize())
1000 self
.params_
.OutputUnchecked(out
)
1001 if (self
.has_app_id_
):
1003 out
.putPrefixedString(self
.app_id_
)
1005 def OutputPartial(self
, out
):
1006 if (self
.has_params_
):
1008 out
.putVarInt32(self
.params_
.ByteSizePartial())
1009 self
.params_
.OutputPartial(out
)
1010 if (self
.has_app_id_
):
1012 out
.putPrefixedString(self
.app_id_
)
1014 def TryMerge(self
, d
):
1015 while d
.avail() > 0:
1016 tt
= d
.getVarInt32()
1018 length
= d
.getVarInt32()
1019 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1021 self
.mutable_params().TryMerge(tmp
)
1024 self
.set_app_id(d
.getPrefixedString())
1028 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1032 def __str__(self
, prefix
="", printElemNumber
=0):
1034 if self
.has_params_
:
1035 res
+=prefix
+"params <\n"
1036 res
+=self
.params_
.__str
__(prefix
+ " ", printElemNumber
)
1038 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
1042 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1043 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1048 _TEXT
= _BuildTagLookupTable({
1054 _TYPES
= _BuildTagLookupTable({
1055 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1056 1: ProtocolBuffer
.Encoder
.STRING
,
1057 3: ProtocolBuffer
.Encoder
.STRING
,
1058 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1062 _STYLE_CONTENT_TYPE
= """"""
1063 _PROTO_DESCRIPTOR_NAME
= 'apphosting.IndexDocumentRequest'
1064 class IndexDocumentResponse(ProtocolBuffer
.ProtocolMessage
):
1066 def __init__(self
, contents
=None):
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
):
1082 self
.status_
.append(x
)
1085 def clear_status(self
):
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
):
1096 def add_doc_id(self
, x
):
1097 self
.doc_id_
.append(x
)
1099 def clear_doc_id(self
):
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
1118 def IsInitialized(self
, debug_strs
=None):
1120 for p
in self
.status_
:
1121 if not p
.IsInitialized(debug_strs
): initialized
=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
]))
1132 def ByteSizePartial(self
):
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
]))
1144 def OutputUnchecked(self
, out
):
1145 for i
in xrange(len(self
.status_
)):
1147 out
.putVarInt32(self
.status_
[i
].ByteSize())
1148 self
.status_
[i
].OutputUnchecked(out
)
1149 for i
in xrange(len(self
.doc_id_
)):
1151 out
.putPrefixedString(self
.doc_id_
[i
])
1153 def OutputPartial(self
, out
):
1154 for i
in xrange(len(self
.status_
)):
1156 out
.putVarInt32(self
.status_
[i
].ByteSizePartial())
1157 self
.status_
[i
].OutputPartial(out
)
1158 for i
in xrange(len(self
.doc_id_
)):
1160 out
.putPrefixedString(self
.doc_id_
[i
])
1162 def TryMerge(self
, d
):
1163 while d
.avail() > 0:
1164 tt
= d
.getVarInt32()
1166 length
= d
.getVarInt32()
1167 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1169 self
.add_status().TryMerge(tmp
)
1172 self
.add_doc_id(d
.getPrefixedString())
1176 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1180 def __str__(self
, prefix
="", printElemNumber
=0):
1183 for e
in self
.status_
:
1185 if printElemNumber
: elm
="(%d)" % cnt
1186 res
+=prefix
+("status%s <\n" % elm
)
1187 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1191 for e
in self
.doc_id_
:
1193 if printElemNumber
: elm
="(%d)" % cnt
1194 res
+=prefix
+("doc_id%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
1199 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1200 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1205 _TEXT
= _BuildTagLookupTable({
1211 _TYPES
= _BuildTagLookupTable({
1212 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1213 1: ProtocolBuffer
.Encoder
.STRING
,
1214 2: ProtocolBuffer
.Encoder
.STRING
,
1215 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1219 _STYLE_CONTENT_TYPE
= """"""
1220 _PROTO_DESCRIPTOR_NAME
= 'apphosting.IndexDocumentResponse'
1221 class DeleteDocumentParams(ProtocolBuffer
.ProtocolMessage
):
1224 def __init__(self
, contents
=None):
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
):
1238 def add_doc_id(self
, x
):
1239 self
.doc_id_
.append(x
)
1241 def clear_doc_id(self
):
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
1267 def IsInitialized(self
, debug_strs
=None):
1269 if (not self
.has_index_spec_
):
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
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())
1283 def ByteSizePartial(self
):
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_
):
1289 n
+= self
.lengthString(self
.index_spec_
.ByteSizePartial())
1294 self
.clear_index_spec()
1296 def OutputUnchecked(self
, out
):
1297 for i
in xrange(len(self
.doc_id_
)):
1299 out
.putPrefixedString(self
.doc_id_
[i
])
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_
)):
1307 out
.putPrefixedString(self
.doc_id_
[i
])
1308 if (self
.has_index_spec_
):
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()
1317 self
.add_doc_id(d
.getPrefixedString())
1320 length
= d
.getVarInt32()
1321 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1323 self
.mutable_index_spec().TryMerge(tmp
)
1327 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1331 def __str__(self
, prefix
="", printElemNumber
=0):
1334 for e
in self
.doc_id_
:
1336 if printElemNumber
: elm
="(%d)" % cnt
1337 res
+=prefix
+("doc_id%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
1339 if self
.has_index_spec_
:
1340 res
+=prefix
+"index_spec <\n"
1341 res
+=self
.index_spec_
.__str
__(prefix
+ " ", printElemNumber
)
1346 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1347 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1352 _TEXT
= _BuildTagLookupTable({
1358 _TYPES
= _BuildTagLookupTable({
1359 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1360 1: ProtocolBuffer
.Encoder
.STRING
,
1361 2: ProtocolBuffer
.Encoder
.STRING
,
1362 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1366 _STYLE_CONTENT_TYPE
= """"""
1367 _PROTO_DESCRIPTOR_NAME
= 'apphosting.DeleteDocumentParams'
1368 class DeleteDocumentRequest(ProtocolBuffer
.ProtocolMessage
):
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
1391 def clear_app_id(self
):
1392 if self
.has_app_id_
:
1393 self
.has_app_id_
= 0
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
1412 def IsInitialized(self
, debug_strs
=None):
1414 if (not self
.has_params_
):
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
1423 n
+= self
.lengthString(self
.params_
.ByteSize())
1424 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
1427 def ByteSizePartial(self
):
1429 if (self
.has_params_
):
1431 n
+= self
.lengthString(self
.params_
.ByteSizePartial())
1432 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
1439 def OutputUnchecked(self
, out
):
1441 out
.putVarInt32(self
.params_
.ByteSize())
1442 self
.params_
.OutputUnchecked(out
)
1443 if (self
.has_app_id_
):
1445 out
.putPrefixedString(self
.app_id_
)
1447 def OutputPartial(self
, out
):
1448 if (self
.has_params_
):
1450 out
.putVarInt32(self
.params_
.ByteSizePartial())
1451 self
.params_
.OutputPartial(out
)
1452 if (self
.has_app_id_
):
1454 out
.putPrefixedString(self
.app_id_
)
1456 def TryMerge(self
, d
):
1457 while d
.avail() > 0:
1458 tt
= d
.getVarInt32()
1460 length
= d
.getVarInt32()
1461 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1463 self
.mutable_params().TryMerge(tmp
)
1466 self
.set_app_id(d
.getPrefixedString())
1470 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1474 def __str__(self
, prefix
="", printElemNumber
=0):
1476 if self
.has_params_
:
1477 res
+=prefix
+"params <\n"
1478 res
+=self
.params_
.__str
__(prefix
+ " ", printElemNumber
)
1480 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
1484 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1485 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1490 _TEXT
= _BuildTagLookupTable({
1496 _TYPES
= _BuildTagLookupTable({
1497 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1498 1: ProtocolBuffer
.Encoder
.STRING
,
1499 3: ProtocolBuffer
.Encoder
.STRING
,
1500 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1504 _STYLE_CONTENT_TYPE
= """"""
1505 _PROTO_DESCRIPTOR_NAME
= 'apphosting.DeleteDocumentRequest'
1506 class DeleteDocumentResponse(ProtocolBuffer
.ProtocolMessage
):
1508 def __init__(self
, contents
=None):
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
):
1523 self
.status_
.append(x
)
1526 def clear_status(self
):
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
1540 def IsInitialized(self
, debug_strs
=None):
1542 for p
in self
.status_
:
1543 if not p
.IsInitialized(debug_strs
): initialized
=0
1548 n
+= 1 * len(self
.status_
)
1549 for i
in xrange(len(self
.status_
)): n
+= self
.lengthString(self
.status_
[i
].ByteSize())
1552 def ByteSizePartial(self
):
1554 n
+= 1 * len(self
.status_
)
1555 for i
in xrange(len(self
.status_
)): n
+= self
.lengthString(self
.status_
[i
].ByteSizePartial())
1561 def OutputUnchecked(self
, out
):
1562 for i
in xrange(len(self
.status_
)):
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_
)):
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()
1577 length
= d
.getVarInt32()
1578 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1580 self
.add_status().TryMerge(tmp
)
1584 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1588 def __str__(self
, prefix
="", printElemNumber
=0):
1591 for e
in self
.status_
:
1593 if printElemNumber
: elm
="(%d)" % cnt
1594 res
+=prefix
+("status%s <\n" % elm
)
1595 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1601 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1602 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1606 _TEXT
= _BuildTagLookupTable({
1611 _TYPES
= _BuildTagLookupTable({
1612 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1613 1: ProtocolBuffer
.Encoder
.STRING
,
1614 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1618 _STYLE_CONTENT_TYPE
= """"""
1619 _PROTO_DESCRIPTOR_NAME
= 'apphosting.DeleteDocumentResponse'
1620 class ListDocumentsParams(ProtocolBuffer
.ProtocolMessage
):
1622 has_start_doc_id_
= 0
1624 has_include_start_doc_
= 0
1625 include_start_doc_
= 1
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
):
1675 def clear_limit(self
):
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
1688 def clear_keys_only(self
):
1689 if self
.has_keys_only_
:
1690 self
.has_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
1718 def IsInitialized(self
, debug_strs
=None):
1720 if (not self
.has_index_spec_
):
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
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
1736 def ByteSizePartial(self
):
1738 if (self
.has_index_spec_
):
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
1748 self
.clear_index_spec()
1749 self
.clear_start_doc_id()
1750 self
.clear_include_start_doc()
1752 self
.clear_keys_only()
1754 def OutputUnchecked(self
, out
):
1756 out
.putVarInt32(self
.index_spec_
.ByteSize())
1757 self
.index_spec_
.OutputUnchecked(out
)
1758 if (self
.has_start_doc_id_
):
1760 out
.putPrefixedString(self
.start_doc_id_
)
1761 if (self
.has_include_start_doc_
):
1763 out
.putBoolean(self
.include_start_doc_
)
1764 if (self
.has_limit_
):
1766 out
.putVarInt32(self
.limit_
)
1767 if (self
.has_keys_only_
):
1769 out
.putBoolean(self
.keys_only_
)
1771 def OutputPartial(self
, out
):
1772 if (self
.has_index_spec_
):
1774 out
.putVarInt32(self
.index_spec_
.ByteSizePartial())
1775 self
.index_spec_
.OutputPartial(out
)
1776 if (self
.has_start_doc_id_
):
1778 out
.putPrefixedString(self
.start_doc_id_
)
1779 if (self
.has_include_start_doc_
):
1781 out
.putBoolean(self
.include_start_doc_
)
1782 if (self
.has_limit_
):
1784 out
.putVarInt32(self
.limit_
)
1785 if (self
.has_keys_only_
):
1787 out
.putBoolean(self
.keys_only_
)
1789 def TryMerge(self
, d
):
1790 while d
.avail() > 0:
1791 tt
= d
.getVarInt32()
1793 length
= d
.getVarInt32()
1794 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1796 self
.mutable_index_spec().TryMerge(tmp
)
1799 self
.set_start_doc_id(d
.getPrefixedString())
1802 self
.set_include_start_doc(d
.getBoolean())
1805 self
.set_limit(d
.getVarInt32())
1808 self
.set_keys_only(d
.getBoolean())
1812 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1816 def __str__(self
, prefix
="", printElemNumber
=0):
1818 if self
.has_index_spec_
:
1819 res
+=prefix
+"index_spec <\n"
1820 res
+=self
.index_spec_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
1829 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1830 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1834 kinclude_start_doc
= 3
1838 _TEXT
= _BuildTagLookupTable({
1842 3: "include_start_doc",
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
)
1858 _STYLE_CONTENT_TYPE
= """"""
1859 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ListDocumentsParams'
1860 class ListDocumentsRequest(ProtocolBuffer
.ProtocolMessage
):
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
1883 def clear_app_id(self
):
1884 if self
.has_app_id_
:
1885 self
.has_app_id_
= 0
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
1904 def IsInitialized(self
, debug_strs
=None):
1906 if (not self
.has_params_
):
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
1915 n
+= self
.lengthString(self
.params_
.ByteSize())
1916 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
1919 def ByteSizePartial(self
):
1921 if (self
.has_params_
):
1923 n
+= self
.lengthString(self
.params_
.ByteSizePartial())
1924 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
1931 def OutputUnchecked(self
, out
):
1933 out
.putVarInt32(self
.params_
.ByteSize())
1934 self
.params_
.OutputUnchecked(out
)
1935 if (self
.has_app_id_
):
1937 out
.putPrefixedString(self
.app_id_
)
1939 def OutputPartial(self
, out
):
1940 if (self
.has_params_
):
1942 out
.putVarInt32(self
.params_
.ByteSizePartial())
1943 self
.params_
.OutputPartial(out
)
1944 if (self
.has_app_id_
):
1946 out
.putPrefixedString(self
.app_id_
)
1948 def TryMerge(self
, d
):
1949 while d
.avail() > 0:
1950 tt
= d
.getVarInt32()
1952 length
= d
.getVarInt32()
1953 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1955 self
.mutable_params().TryMerge(tmp
)
1958 self
.set_app_id(d
.getPrefixedString())
1962 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1966 def __str__(self
, prefix
="", printElemNumber
=0):
1968 if self
.has_params_
:
1969 res
+=prefix
+"params <\n"
1970 res
+=self
.params_
.__str
__(prefix
+ " ", printElemNumber
)
1972 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
1976 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1977 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1982 _TEXT
= _BuildTagLookupTable({
1988 _TYPES
= _BuildTagLookupTable({
1989 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1990 1: ProtocolBuffer
.Encoder
.STRING
,
1991 2: ProtocolBuffer
.Encoder
.STRING
,
1992 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1996 _STYLE_CONTENT_TYPE
= """"""
1997 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ListDocumentsRequest'
1998 class ListDocumentsResponse(ProtocolBuffer
.ProtocolMessage
):
2001 def __init__(self
, contents
=None):
2002 self
.status_
= RequestStatus()
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
):
2025 self
.document_
.append(x
)
2028 def clear_document(self
):
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
2045 def IsInitialized(self
, debug_strs
=None):
2047 if (not self
.has_status_
):
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
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())
2063 def ByteSizePartial(self
):
2065 if (self
.has_status_
):
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())
2074 self
.clear_document()
2076 def OutputUnchecked(self
, out
):
2078 out
.putVarInt32(self
.status_
.ByteSize())
2079 self
.status_
.OutputUnchecked(out
)
2080 for i
in xrange(len(self
.document_
)):
2082 out
.putVarInt32(self
.document_
[i
].ByteSize())
2083 self
.document_
[i
].OutputUnchecked(out
)
2085 def OutputPartial(self
, out
):
2086 if (self
.has_status_
):
2088 out
.putVarInt32(self
.status_
.ByteSizePartial())
2089 self
.status_
.OutputPartial(out
)
2090 for i
in xrange(len(self
.document_
)):
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()
2099 length
= d
.getVarInt32()
2100 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2102 self
.mutable_status().TryMerge(tmp
)
2105 length
= d
.getVarInt32()
2106 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2108 self
.add_document().TryMerge(tmp
)
2112 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2116 def __str__(self
, prefix
="", printElemNumber
=0):
2118 if self
.has_status_
:
2119 res
+=prefix
+"status <\n"
2120 res
+=self
.status_
.__str
__(prefix
+ " ", printElemNumber
)
2123 for e
in self
.document_
:
2125 if printElemNumber
: elm
="(%d)" % cnt
2126 res
+=prefix
+("document%s <\n" % elm
)
2127 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
2133 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2134 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2139 _TEXT
= _BuildTagLookupTable({
2145 _TYPES
= _BuildTagLookupTable({
2146 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2147 1: ProtocolBuffer
.Encoder
.STRING
,
2148 2: ProtocolBuffer
.Encoder
.STRING
,
2149 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2153 _STYLE_CONTENT_TYPE
= """"""
2154 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ListDocumentsResponse'
2155 class ListIndexesParams(ProtocolBuffer
.ProtocolMessage
):
2156 has_fetch_schema_
= 0
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_
= ""
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
):
2195 def clear_limit(self
):
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
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
2260 def clear_offset(self
):
2261 if self
.has_offset_
:
2262 self
.has_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
2273 def clear_source(self
):
2274 if self
.has_source_
:
2275 self
.has_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
2312 def IsInitialized(self
, debug_strs
=None):
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_
)
2328 def ByteSizePartial(self
):
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_
)
2341 self
.clear_fetch_schema()
2343 self
.clear_namespace()
2344 self
.clear_start_index_name()
2345 self
.clear_include_start_index()
2346 self
.clear_index_name_prefix()
2350 def OutputUnchecked(self
, out
):
2351 if (self
.has_fetch_schema_
):
2353 out
.putBoolean(self
.fetch_schema_
)
2354 if (self
.has_limit_
):
2356 out
.putVarInt32(self
.limit_
)
2357 if (self
.has_namespace_
):
2359 out
.putPrefixedString(self
.namespace_
)
2360 if (self
.has_start_index_name_
):
2362 out
.putPrefixedString(self
.start_index_name_
)
2363 if (self
.has_include_start_index_
):
2365 out
.putBoolean(self
.include_start_index_
)
2366 if (self
.has_index_name_prefix_
):
2368 out
.putPrefixedString(self
.index_name_prefix_
)
2369 if (self
.has_offset_
):
2371 out
.putVarInt32(self
.offset_
)
2372 if (self
.has_source_
):
2374 out
.putVarInt32(self
.source_
)
2376 def OutputPartial(self
, out
):
2377 if (self
.has_fetch_schema_
):
2379 out
.putBoolean(self
.fetch_schema_
)
2380 if (self
.has_limit_
):
2382 out
.putVarInt32(self
.limit_
)
2383 if (self
.has_namespace_
):
2385 out
.putPrefixedString(self
.namespace_
)
2386 if (self
.has_start_index_name_
):
2388 out
.putPrefixedString(self
.start_index_name_
)
2389 if (self
.has_include_start_index_
):
2391 out
.putBoolean(self
.include_start_index_
)
2392 if (self
.has_index_name_prefix_
):
2394 out
.putPrefixedString(self
.index_name_prefix_
)
2395 if (self
.has_offset_
):
2397 out
.putVarInt32(self
.offset_
)
2398 if (self
.has_source_
):
2400 out
.putVarInt32(self
.source_
)
2402 def TryMerge(self
, d
):
2403 while d
.avail() > 0:
2404 tt
= d
.getVarInt32()
2406 self
.set_fetch_schema(d
.getBoolean())
2409 self
.set_limit(d
.getVarInt32())
2412 self
.set_namespace(d
.getPrefixedString())
2415 self
.set_start_index_name(d
.getPrefixedString())
2418 self
.set_include_start_index(d
.getBoolean())
2421 self
.set_index_name_prefix(d
.getPrefixedString())
2424 self
.set_offset(d
.getVarInt32())
2427 self
.set_source(d
.getVarInt32())
2431 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2435 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
2448 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2449 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2454 kstart_index_name
= 4
2455 kinclude_start_index
= 5
2456 kindex_name_prefix
= 6
2460 _TEXT
= _BuildTagLookupTable({
2465 4: "start_index_name",
2466 5: "include_start_index",
2467 6: "index_name_prefix",
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
)
2486 _STYLE_CONTENT_TYPE
= """"""
2487 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ListIndexesParams'
2488 class ListIndexesRequest(ProtocolBuffer
.ProtocolMessage
):
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
2511 def clear_app_id(self
):
2512 if self
.has_app_id_
:
2513 self
.has_app_id_
= 0
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
2532 def IsInitialized(self
, debug_strs
=None):
2534 if (not self
.has_params_
):
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
2543 n
+= self
.lengthString(self
.params_
.ByteSize())
2544 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
2547 def ByteSizePartial(self
):
2549 if (self
.has_params_
):
2551 n
+= self
.lengthString(self
.params_
.ByteSizePartial())
2552 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
2559 def OutputUnchecked(self
, out
):
2561 out
.putVarInt32(self
.params_
.ByteSize())
2562 self
.params_
.OutputUnchecked(out
)
2563 if (self
.has_app_id_
):
2565 out
.putPrefixedString(self
.app_id_
)
2567 def OutputPartial(self
, out
):
2568 if (self
.has_params_
):
2570 out
.putVarInt32(self
.params_
.ByteSizePartial())
2571 self
.params_
.OutputPartial(out
)
2572 if (self
.has_app_id_
):
2574 out
.putPrefixedString(self
.app_id_
)
2576 def TryMerge(self
, d
):
2577 while d
.avail() > 0:
2578 tt
= d
.getVarInt32()
2580 length
= d
.getVarInt32()
2581 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2583 self
.mutable_params().TryMerge(tmp
)
2586 self
.set_app_id(d
.getPrefixedString())
2590 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2594 def __str__(self
, prefix
="", printElemNumber
=0):
2596 if self
.has_params_
:
2597 res
+=prefix
+"params <\n"
2598 res
+=self
.params_
.__str
__(prefix
+ " ", printElemNumber
)
2600 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
2604 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2605 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2610 _TEXT
= _BuildTagLookupTable({
2616 _TYPES
= _BuildTagLookupTable({
2617 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2618 1: ProtocolBuffer
.Encoder
.STRING
,
2619 3: ProtocolBuffer
.Encoder
.STRING
,
2620 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2624 _STYLE_CONTENT_TYPE
= """"""
2625 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ListIndexesRequest'
2626 class ListIndexesResponse(ProtocolBuffer
.ProtocolMessage
):
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
):
2653 self
.index_metadata_
.append(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
2673 def IsInitialized(self
, debug_strs
=None):
2675 if (not self
.has_status_
):
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
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())
2691 def ByteSizePartial(self
):
2693 if (self
.has_status_
):
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())
2702 self
.clear_index_metadata()
2704 def OutputUnchecked(self
, out
):
2706 out
.putVarInt32(self
.status_
.ByteSize())
2707 self
.status_
.OutputUnchecked(out
)
2708 for i
in xrange(len(self
.index_metadata_
)):
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_
):
2716 out
.putVarInt32(self
.status_
.ByteSizePartial())
2717 self
.status_
.OutputPartial(out
)
2718 for i
in xrange(len(self
.index_metadata_
)):
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()
2727 length
= d
.getVarInt32()
2728 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2730 self
.mutable_status().TryMerge(tmp
)
2733 length
= d
.getVarInt32()
2734 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2736 self
.add_index_metadata().TryMerge(tmp
)
2740 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2744 def __str__(self
, prefix
="", printElemNumber
=0):
2746 if self
.has_status_
:
2747 res
+=prefix
+"status <\n"
2748 res
+=self
.status_
.__str
__(prefix
+ " ", printElemNumber
)
2751 for e
in self
.index_metadata_
:
2753 if printElemNumber
: elm
="(%d)" % cnt
2754 res
+=prefix
+("index_metadata%s <\n" % elm
)
2755 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
2761 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2762 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2767 _TEXT
= _BuildTagLookupTable({
2770 2: "index_metadata",
2773 _TYPES
= _BuildTagLookupTable({
2774 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2775 1: ProtocolBuffer
.Encoder
.STRING
,
2776 2: ProtocolBuffer
.Encoder
.STRING
,
2777 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2781 _STYLE_CONTENT_TYPE
= """"""
2782 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ListIndexesResponse'
2783 class DeleteSchemaParams(ProtocolBuffer
.ProtocolMessage
):
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
2797 def clear_source(self
):
2798 if self
.has_source_
:
2799 self
.has_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
):
2815 self
.index_spec_
.append(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
2835 def IsInitialized(self
, debug_strs
=None):
2837 for p
in self
.index_spec_
:
2838 if not p
.IsInitialized(debug_strs
): initialized
=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())
2848 def ByteSizePartial(self
):
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())
2857 self
.clear_index_spec()
2859 def OutputUnchecked(self
, out
):
2860 if (self
.has_source_
):
2862 out
.putVarInt32(self
.source_
)
2863 for i
in xrange(len(self
.index_spec_
)):
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_
):
2871 out
.putVarInt32(self
.source_
)
2872 for i
in xrange(len(self
.index_spec_
)):
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()
2881 self
.set_source(d
.getVarInt32())
2884 length
= d
.getVarInt32()
2885 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2887 self
.add_index_spec().TryMerge(tmp
)
2891 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2895 def __str__(self
, prefix
="", printElemNumber
=0):
2897 if self
.has_source_
: res
+=prefix
+("source: %s\n" % self
.DebugFormatInt32(self
.source_
))
2899 for e
in self
.index_spec_
:
2901 if printElemNumber
: elm
="(%d)" % cnt
2902 res
+=prefix
+("index_spec%s <\n" % elm
)
2903 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
2909 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2910 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2915 _TEXT
= _BuildTagLookupTable({
2921 _TYPES
= _BuildTagLookupTable({
2922 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2923 1: ProtocolBuffer
.Encoder
.NUMERIC
,
2924 2: ProtocolBuffer
.Encoder
.STRING
,
2925 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2929 _STYLE_CONTENT_TYPE
= """"""
2930 _PROTO_DESCRIPTOR_NAME
= 'apphosting.DeleteSchemaParams'
2931 class DeleteSchemaRequest(ProtocolBuffer
.ProtocolMessage
):
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
2954 def clear_app_id(self
):
2955 if self
.has_app_id_
:
2956 self
.has_app_id_
= 0
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
2975 def IsInitialized(self
, debug_strs
=None):
2977 if (not self
.has_params_
):
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
2986 n
+= self
.lengthString(self
.params_
.ByteSize())
2987 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
2990 def ByteSizePartial(self
):
2992 if (self
.has_params_
):
2994 n
+= self
.lengthString(self
.params_
.ByteSizePartial())
2995 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
3002 def OutputUnchecked(self
, out
):
3004 out
.putVarInt32(self
.params_
.ByteSize())
3005 self
.params_
.OutputUnchecked(out
)
3006 if (self
.has_app_id_
):
3008 out
.putPrefixedString(self
.app_id_
)
3010 def OutputPartial(self
, out
):
3011 if (self
.has_params_
):
3013 out
.putVarInt32(self
.params_
.ByteSizePartial())
3014 self
.params_
.OutputPartial(out
)
3015 if (self
.has_app_id_
):
3017 out
.putPrefixedString(self
.app_id_
)
3019 def TryMerge(self
, d
):
3020 while d
.avail() > 0:
3021 tt
= d
.getVarInt32()
3023 length
= d
.getVarInt32()
3024 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
3026 self
.mutable_params().TryMerge(tmp
)
3029 self
.set_app_id(d
.getPrefixedString())
3033 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3037 def __str__(self
, prefix
="", printElemNumber
=0):
3039 if self
.has_params_
:
3040 res
+=prefix
+"params <\n"
3041 res
+=self
.params_
.__str
__(prefix
+ " ", printElemNumber
)
3043 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
3047 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3048 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3053 _TEXT
= _BuildTagLookupTable({
3059 _TYPES
= _BuildTagLookupTable({
3060 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3061 1: ProtocolBuffer
.Encoder
.STRING
,
3062 3: ProtocolBuffer
.Encoder
.STRING
,
3063 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3067 _STYLE_CONTENT_TYPE
= """"""
3068 _PROTO_DESCRIPTOR_NAME
= 'apphosting.DeleteSchemaRequest'
3069 class DeleteSchemaResponse(ProtocolBuffer
.ProtocolMessage
):
3071 def __init__(self
, contents
=None):
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
):
3086 self
.status_
.append(x
)
3089 def clear_status(self
):
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
3103 def IsInitialized(self
, debug_strs
=None):
3105 for p
in self
.status_
:
3106 if not p
.IsInitialized(debug_strs
): initialized
=0
3111 n
+= 1 * len(self
.status_
)
3112 for i
in xrange(len(self
.status_
)): n
+= self
.lengthString(self
.status_
[i
].ByteSize())
3115 def ByteSizePartial(self
):
3117 n
+= 1 * len(self
.status_
)
3118 for i
in xrange(len(self
.status_
)): n
+= self
.lengthString(self
.status_
[i
].ByteSizePartial())
3124 def OutputUnchecked(self
, out
):
3125 for i
in xrange(len(self
.status_
)):
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_
)):
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()
3140 length
= d
.getVarInt32()
3141 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
3143 self
.add_status().TryMerge(tmp
)
3147 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3151 def __str__(self
, prefix
="", printElemNumber
=0):
3154 for e
in self
.status_
:
3156 if printElemNumber
: elm
="(%d)" % cnt
3157 res
+=prefix
+("status%s <\n" % elm
)
3158 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
3164 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3165 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3169 _TEXT
= _BuildTagLookupTable({
3174 _TYPES
= _BuildTagLookupTable({
3175 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3176 1: ProtocolBuffer
.Encoder
.STRING
,
3177 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
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
3268 def IsInitialized(self
, debug_strs
=None):
3270 if (not self
.has_sort_expression_
):
3272 if debug_strs
is not None:
3273 debug_strs
.append('Required field: sort_expression not set.')
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
3284 def ByteSizePartial(self
):
3286 if (self
.has_sort_expression_
):
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
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
):
3302 out
.putPrefixedString(self
.sort_expression_
)
3303 if (self
.has_sort_descending_
):
3305 out
.putBoolean(self
.sort_descending_
)
3306 if (self
.has_default_value_text_
):
3308 out
.putPrefixedString(self
.default_value_text_
)
3309 if (self
.has_default_value_numeric_
):
3311 out
.putDouble(self
.default_value_numeric_
)
3313 def OutputPartial(self
, out
):
3314 if (self
.has_sort_expression_
):
3316 out
.putPrefixedString(self
.sort_expression_
)
3317 if (self
.has_sort_descending_
):
3319 out
.putBoolean(self
.sort_descending_
)
3320 if (self
.has_default_value_text_
):
3322 out
.putPrefixedString(self
.default_value_text_
)
3323 if (self
.has_default_value_numeric_
):
3325 out
.putDouble(self
.default_value_numeric_
)
3327 def TryMerge(self
, d
):
3328 while d
.avail() > 0:
3329 tt
= d
.getVarInt32()
3331 self
.set_sort_expression(d
.getPrefixedString())
3334 self
.set_sort_descending(d
.getBoolean())
3337 self
.set_default_value_text(d
.getPrefixedString())
3340 self
.set_default_value_numeric(d
.getDouble())
3344 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3348 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
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({
3367 1: "sort_expression",
3368 2: "sort_descending",
3369 4: "default_value_text",
3370 5: "default_value_numeric",
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
)
3383 _STYLE_CONTENT_TYPE
= """"""
3384 _PROTO_DESCRIPTOR_NAME
= 'apphosting.SortSpec'
3385 class ScorerSpec(ProtocolBuffer
.ProtocolMessage
):
3388 RESCORING_MATCH_SCORER
= 0
3392 0: "RESCORING_MATCH_SCORER",
3396 def Scorer_Name(cls
, x
): return cls
._Scorer
_NAMES
.get(x
, "")
3397 Scorer_Name
= classmethod(Scorer_Name
)
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
3415 def clear_scorer(self
):
3416 if self
.has_scorer_
:
3417 self
.has_scorer_
= 0
3420 def has_scorer(self
): return self
.has_scorer_
3422 def limit(self
): return self
.limit_
3424 def set_limit(self
, x
):
3428 def clear_limit(self
):
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
3465 def IsInitialized(self
, debug_strs
=None):
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_
))
3476 def ByteSizePartial(self
):
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_
))
3486 self
.clear_match_scorer_parameters()
3488 def OutputUnchecked(self
, out
):
3489 if (self
.has_scorer_
):
3491 out
.putVarInt32(self
.scorer_
)
3492 if (self
.has_limit_
):
3494 out
.putVarInt32(self
.limit_
)
3495 if (self
.has_match_scorer_parameters_
):
3497 out
.putPrefixedString(self
.match_scorer_parameters_
)
3499 def OutputPartial(self
, out
):
3500 if (self
.has_scorer_
):
3502 out
.putVarInt32(self
.scorer_
)
3503 if (self
.has_limit_
):
3505 out
.putVarInt32(self
.limit_
)
3506 if (self
.has_match_scorer_parameters_
):
3508 out
.putPrefixedString(self
.match_scorer_parameters_
)
3510 def TryMerge(self
, d
):
3511 while d
.avail() > 0:
3512 tt
= d
.getVarInt32()
3514 self
.set_scorer(d
.getVarInt32())
3517 self
.set_limit(d
.getVarInt32())
3520 self
.set_match_scorer_parameters(d
.getPrefixedString())
3524 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3528 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
3536 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3537 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3541 kmatch_scorer_parameters
= 9
3543 _TEXT
= _BuildTagLookupTable({
3547 9: "match_scorer_parameters",
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
)
3559 _STYLE_CONTENT_TYPE
= """"""
3560 _PROTO_DESCRIPTOR_NAME
= 'apphosting.ScorerSpec'
3561 class FieldSpec_Expression(ProtocolBuffer
.ProtocolMessage
):
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
):
3576 def clear_name(self
):
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
3610 def IsInitialized(self
, debug_strs
=None):
3612 if (not self
.has_name_
):
3614 if debug_strs
is not None:
3615 debug_strs
.append('Required field: name not set.')
3616 if (not self
.has_expression_
):
3618 if debug_strs
is not None:
3619 debug_strs
.append('Required field: expression not set.')
3624 n
+= self
.lengthString(len(self
.name_
))
3625 n
+= self
.lengthString(len(self
.expression_
))
3628 def ByteSizePartial(self
):
3630 if (self
.has_name_
):
3632 n
+= self
.lengthString(len(self
.name_
))
3633 if (self
.has_expression_
):
3635 n
+= self
.lengthString(len(self
.expression_
))
3640 self
.clear_expression()
3642 def OutputUnchecked(self
, out
):
3644 out
.putPrefixedString(self
.name_
)
3646 out
.putPrefixedString(self
.expression_
)
3648 def OutputPartial(self
, out
):
3649 if (self
.has_name_
):
3651 out
.putPrefixedString(self
.name_
)
3652 if (self
.has_expression_
):
3654 out
.putPrefixedString(self
.expression_
)
3656 def TryMerge(self
, d
):
3658 tt
= d
.getVarInt32()
3661 self
.set_name(d
.getPrefixedString())
3664 self
.set_expression(d
.getPrefixedString())
3668 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3672 def __str__(self
, prefix
="", printElemNumber
=0):
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_
))
3678 class FieldSpec(ProtocolBuffer
.ProtocolMessage
):
3680 def __init__(self
, contents
=None):
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_
3689 return self
.name_
[i
]
3691 def set_name(self
, i
, x
):
3694 def add_name(self
, x
):
3695 self
.name_
.append(x
)
3697 def clear_name(self
):
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
)
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
3732 def IsInitialized(self
, debug_strs
=None):
3734 for p
in self
.expression_
:
3735 if not p
.IsInitialized(debug_strs
): initialized
=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()
3746 def ByteSizePartial(self
):
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()
3756 self
.clear_expression()
3758 def OutputUnchecked(self
, out
):
3759 for i
in xrange(len(self
.name_
)):
3761 out
.putPrefixedString(self
.name_
[i
])
3762 for i
in xrange(len(self
.expression_
)):
3764 self
.expression_
[i
].OutputUnchecked(out
)
3767 def OutputPartial(self
, out
):
3768 for i
in xrange(len(self
.name_
)):
3770 out
.putPrefixedString(self
.name_
[i
])
3771 for i
in xrange(len(self
.expression_
)):
3773 self
.expression_
[i
].OutputPartial(out
)
3776 def TryMerge(self
, d
):
3777 while d
.avail() > 0:
3778 tt
= d
.getVarInt32()
3780 self
.add_name(d
.getPrefixedString())
3783 self
.add_expression().TryMerge(d
)
3787 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3791 def __str__(self
, prefix
="", printElemNumber
=0):
3794 for e
in self
.name_
:
3796 if printElemNumber
: elm
="(%d)" % cnt
3797 res
+=prefix
+("name%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
3800 for e
in self
.expression_
:
3802 if printElemNumber
: elm
="(%d)" % cnt
3803 res
+=prefix
+("Expression%s {\n" % elm
)
3804 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
3810 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3811 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3814 kExpressionGroup
= 2
3816 kExpressionexpression
= 4
3818 _TEXT
= _BuildTagLookupTable({
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
)
3836 _STYLE_CONTENT_TYPE
= """"""
3837 _PROTO_DESCRIPTOR_NAME
= 'apphosting.FieldSpec'
3838 class SearchParams(ProtocolBuffer
.ProtocolMessage
):
3845 _CursorType_NAMES
= {
3851 def CursorType_Name(cls
, x
): return cls
._CursorType
_NAMES
.get(x
, "")
3852 CursorType_Name
= classmethod(CursorType_Name
)
3859 _ParsingMode_NAMES
= {
3864 def ParsingMode_Name(cls
, x
): return cls
._ParsingMode
_NAMES
.get(x
, "")
3865 ParsingMode_Name
= classmethod(ParsingMode_Name
)
3874 has_cursor_type_
= 0
3878 has_matched_count_accuracy_
= 0
3879 matched_count_accuracy_
= 0
3880 has_scorer_spec_
= 0
3886 has_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
):
3909 def clear_query(self
):
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
3922 def clear_cursor(self
):
3923 if self
.has_cursor_
:
3924 self
.has_cursor_
= 0
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
3935 def clear_offset(self
):
3936 if self
.has_offset_
:
3937 self
.has_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
):
3961 def clear_limit(self
):
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
):
3992 self
.sort_spec_
.append(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()
4001 if self
.scorer_spec_
is None: self
.scorer_spec_
= ScorerSpec()
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()
4020 if self
.field_spec_
is None: self
.field_spec_
= FieldSpec()
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
4041 def clear_keys_only(self
):
4042 if self
.has_keys_only_
:
4043 self
.has_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
4106 def IsInitialized(self
, debug_strs
=None):
4108 if (not self
.has_index_spec_
):
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_
):
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
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_
)
4140 def ByteSizePartial(self
):
4142 if (self
.has_index_spec_
):
4144 n
+= self
.lengthString(self
.index_spec_
.ByteSizePartial())
4145 if (self
.has_query_
):
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_
)
4162 self
.clear_index_spec()
4166 self
.clear_cursor_type()
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
):
4177 out
.putVarInt32(self
.index_spec_
.ByteSize())
4178 self
.index_spec_
.OutputUnchecked(out
)
4180 out
.putPrefixedString(self
.query_
)
4181 if (self
.has_cursor_
):
4183 out
.putPrefixedString(self
.cursor_
)
4184 if (self
.has_cursor_type_
):
4186 out
.putVarInt32(self
.cursor_type_
)
4187 if (self
.has_limit_
):
4189 out
.putVarInt32(self
.limit_
)
4190 if (self
.has_matched_count_accuracy_
):
4192 out
.putVarInt32(self
.matched_count_accuracy_
)
4193 for i
in xrange(len(self
.sort_spec_
)):
4195 out
.putVarInt32(self
.sort_spec_
[i
].ByteSize())
4196 self
.sort_spec_
[i
].OutputUnchecked(out
)
4197 if (self
.has_scorer_spec_
):
4199 out
.putVarInt32(self
.scorer_spec_
.ByteSize())
4200 self
.scorer_spec_
.OutputUnchecked(out
)
4201 if (self
.has_field_spec_
):
4203 out
.putVarInt32(self
.field_spec_
.ByteSize())
4204 self
.field_spec_
.OutputUnchecked(out
)
4205 if (self
.has_offset_
):
4207 out
.putVarInt32(self
.offset_
)
4208 if (self
.has_keys_only_
):
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_
):
4218 out
.putVarInt32(self
.index_spec_
.ByteSizePartial())
4219 self
.index_spec_
.OutputPartial(out
)
4220 if (self
.has_query_
):
4222 out
.putPrefixedString(self
.query_
)
4223 if (self
.has_cursor_
):
4225 out
.putPrefixedString(self
.cursor_
)
4226 if (self
.has_cursor_type_
):
4228 out
.putVarInt32(self
.cursor_type_
)
4229 if (self
.has_limit_
):
4231 out
.putVarInt32(self
.limit_
)
4232 if (self
.has_matched_count_accuracy_
):
4234 out
.putVarInt32(self
.matched_count_accuracy_
)
4235 for i
in xrange(len(self
.sort_spec_
)):
4237 out
.putVarInt32(self
.sort_spec_
[i
].ByteSizePartial())
4238 self
.sort_spec_
[i
].OutputPartial(out
)
4239 if (self
.has_scorer_spec_
):
4241 out
.putVarInt32(self
.scorer_spec_
.ByteSizePartial())
4242 self
.scorer_spec_
.OutputPartial(out
)
4243 if (self
.has_field_spec_
):
4245 out
.putVarInt32(self
.field_spec_
.ByteSizePartial())
4246 self
.field_spec_
.OutputPartial(out
)
4247 if (self
.has_offset_
):
4249 out
.putVarInt32(self
.offset_
)
4250 if (self
.has_keys_only_
):
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()
4261 length
= d
.getVarInt32()
4262 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4264 self
.mutable_index_spec().TryMerge(tmp
)
4267 self
.set_query(d
.getPrefixedString())
4270 self
.set_cursor(d
.getPrefixedString())
4273 self
.set_cursor_type(d
.getVarInt32())
4276 self
.set_limit(d
.getVarInt32())
4279 self
.set_matched_count_accuracy(d
.getVarInt32())
4282 length
= d
.getVarInt32()
4283 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4285 self
.add_sort_spec().TryMerge(tmp
)
4288 length
= d
.getVarInt32()
4289 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4291 self
.mutable_scorer_spec().TryMerge(tmp
)
4294 length
= d
.getVarInt32()
4295 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4297 self
.mutable_field_spec().TryMerge(tmp
)
4300 self
.set_offset(d
.getVarInt32())
4303 self
.set_keys_only(d
.getBoolean())
4306 self
.set_parsing_mode(d
.getVarInt32())
4310 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4314 def __str__(self
, prefix
="", printElemNumber
=0):
4316 if self
.has_index_spec_
:
4317 res
+=prefix
+"index_spec <\n"
4318 res
+=self
.index_spec_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
4327 for e
in self
.sort_spec_
:
4329 if printElemNumber
: elm
="(%d)" % cnt
4330 res
+=prefix
+("sort_spec%s <\n" % elm
)
4331 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4334 if self
.has_scorer_spec_
:
4335 res
+=prefix
+"scorer_spec <\n"
4336 res
+=self
.scorer_spec_
.__str
__(prefix
+ " ", printElemNumber
)
4338 if self
.has_field_spec_
:
4339 res
+=prefix
+"field_spec <\n"
4340 res
+=self
.field_spec_
.__str
__(prefix
+ " ", printElemNumber
)
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_
))
4347 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4348 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4356 kmatched_count_accuracy
= 7
4363 _TEXT
= _BuildTagLookupTable({
4370 7: "matched_count_accuracy",
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
)
4397 _STYLE_CONTENT_TYPE
= """"""
4398 _PROTO_DESCRIPTOR_NAME
= 'apphosting.SearchParams'
4399 class SearchRequest(ProtocolBuffer
.ProtocolMessage
):
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
4422 def clear_app_id(self
):
4423 if self
.has_app_id_
:
4424 self
.has_app_id_
= 0
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
4443 def IsInitialized(self
, debug_strs
=None):
4445 if (not self
.has_params_
):
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
4454 n
+= self
.lengthString(self
.params_
.ByteSize())
4455 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
4458 def ByteSizePartial(self
):
4460 if (self
.has_params_
):
4462 n
+= self
.lengthString(self
.params_
.ByteSizePartial())
4463 if (self
.has_app_id_
): n
+= 1 + self
.lengthString(len(self
.app_id_
))
4470 def OutputUnchecked(self
, out
):
4472 out
.putVarInt32(self
.params_
.ByteSize())
4473 self
.params_
.OutputUnchecked(out
)
4474 if (self
.has_app_id_
):
4476 out
.putPrefixedString(self
.app_id_
)
4478 def OutputPartial(self
, out
):
4479 if (self
.has_params_
):
4481 out
.putVarInt32(self
.params_
.ByteSizePartial())
4482 self
.params_
.OutputPartial(out
)
4483 if (self
.has_app_id_
):
4485 out
.putPrefixedString(self
.app_id_
)
4487 def TryMerge(self
, d
):
4488 while d
.avail() > 0:
4489 tt
= d
.getVarInt32()
4491 length
= d
.getVarInt32()
4492 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4494 self
.mutable_params().TryMerge(tmp
)
4497 self
.set_app_id(d
.getPrefixedString())
4501 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4505 def __str__(self
, prefix
="", printElemNumber
=0):
4507 if self
.has_params_
:
4508 res
+=prefix
+"params <\n"
4509 res
+=self
.params_
.__str
__(prefix
+ " ", printElemNumber
)
4511 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
4515 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4516 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4521 _TEXT
= _BuildTagLookupTable({
4527 _TYPES
= _BuildTagLookupTable({
4528 0: ProtocolBuffer
.Encoder
.NUMERIC
,
4529 1: ProtocolBuffer
.Encoder
.STRING
,
4530 3: ProtocolBuffer
.Encoder
.STRING
,
4531 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
4535 _STYLE_CONTENT_TYPE
= """"""
4536 _PROTO_DESCRIPTOR_NAME
= 'apphosting.SearchRequest'
4537 class SearchResult(ProtocolBuffer
.ProtocolMessage
):
4542 def __init__(self
, contents
=None):
4543 self
.document_
= Document()
4544 self
.expression_
= []
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
):
4567 self
.expression_
.append(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_
4576 return self
.score_
[i
]
4578 def set_score(self
, i
, x
):
4581 def add_score(self
, x
):
4582 self
.score_
.append(x
)
4584 def clear_score(self
):
4587 def cursor(self
): return self
.cursor_
4589 def set_cursor(self
, x
):
4590 self
.has_cursor_
= 1
4593 def clear_cursor(self
):
4594 if self
.has_cursor_
:
4595 self
.has_cursor_
= 0
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
4622 def IsInitialized(self
, debug_strs
=None):
4624 if (not self
.has_document_
):
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
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_
))
4642 def ByteSizePartial(self
):
4644 if (self
.has_document_
):
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_
))
4654 self
.clear_document()
4655 self
.clear_expression()
4659 def OutputUnchecked(self
, out
):
4661 out
.putVarInt32(self
.document_
.ByteSize())
4662 self
.document_
.OutputUnchecked(out
)
4663 for i
in xrange(len(self
.score_
)):
4665 out
.putDouble(self
.score_
[i
])
4666 if (self
.has_cursor_
):
4668 out
.putPrefixedString(self
.cursor_
)
4669 for i
in xrange(len(self
.expression_
)):
4671 out
.putVarInt32(self
.expression_
[i
].ByteSize())
4672 self
.expression_
[i
].OutputUnchecked(out
)
4674 def OutputPartial(self
, out
):
4675 if (self
.has_document_
):
4677 out
.putVarInt32(self
.document_
.ByteSizePartial())
4678 self
.document_
.OutputPartial(out
)
4679 for i
in xrange(len(self
.score_
)):
4681 out
.putDouble(self
.score_
[i
])
4682 if (self
.has_cursor_
):
4684 out
.putPrefixedString(self
.cursor_
)
4685 for i
in xrange(len(self
.expression_
)):
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()
4694 length
= d
.getVarInt32()
4695 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4697 self
.mutable_document().TryMerge(tmp
)
4700 self
.add_score(d
.getDouble())
4703 self
.set_cursor(d
.getPrefixedString())
4706 length
= d
.getVarInt32()
4707 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4709 self
.add_expression().TryMerge(tmp
)
4713 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4717 def __str__(self
, prefix
="", printElemNumber
=0):
4719 if self
.has_document_
:
4720 res
+=prefix
+"document <\n"
4721 res
+=self
.document_
.__str
__(prefix
+ " ", printElemNumber
)
4724 for e
in self
.expression_
:
4726 if printElemNumber
: elm
="(%d)" % cnt
4727 res
+=prefix
+("expression%s <\n" % elm
)
4728 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
4732 for e
in self
.score_
:
4734 if printElemNumber
: elm
="(%d)" % cnt
4735 res
+=prefix
+("score%s: %s\n" % (elm
, self
.DebugFormat(e
)))
4737 if self
.has_cursor_
: res
+=prefix
+("cursor: %s\n" % self
.DebugFormatString(self
.cursor_
))
4741 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4742 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4749 _TEXT
= _BuildTagLookupTable({
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
)
4767 _STYLE_CONTENT_TYPE
= """"""
4768 _PROTO_DESCRIPTOR_NAME
= 'apphosting.SearchResult'
4769 class SearchResponse(ProtocolBuffer
.ProtocolMessage
):
4770 has_matched_count_
= 0
4776 def __init__(self
, contents
=None):
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
):
4792 self
.result_
.append(x
)
4795 def clear_result(self
):
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
4824 def clear_cursor(self
):
4825 if self
.has_cursor_
:
4826 self
.has_cursor_
= 0
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
4852 def IsInitialized(self
, debug_strs
=None):
4854 for p
in self
.result_
:
4855 if not p
.IsInitialized(debug_strs
): initialized
=0
4856 if (not self
.has_matched_count_
):
4858 if debug_strs
is not None:
4859 debug_strs
.append('Required field: matched_count not set.')
4860 if (not self
.has_status_
):
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
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_
))
4876 def ByteSizePartial(self
):
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_
):
4882 n
+= self
.lengthVarInt64(self
.matched_count_
)
4883 if (self
.has_status_
):
4885 n
+= self
.lengthString(self
.status_
.ByteSizePartial())
4886 if (self
.has_cursor_
): n
+= 1 + self
.lengthString(len(self
.cursor_
))
4891 self
.clear_matched_count()
4895 def OutputUnchecked(self
, out
):
4896 for i
in xrange(len(self
.result_
)):
4898 out
.putVarInt32(self
.result_
[i
].ByteSize())
4899 self
.result_
[i
].OutputUnchecked(out
)
4901 out
.putVarInt64(self
.matched_count_
)
4903 out
.putVarInt32(self
.status_
.ByteSize())
4904 self
.status_
.OutputUnchecked(out
)
4905 if (self
.has_cursor_
):
4907 out
.putPrefixedString(self
.cursor_
)
4909 def OutputPartial(self
, out
):
4910 for i
in xrange(len(self
.result_
)):
4912 out
.putVarInt32(self
.result_
[i
].ByteSizePartial())
4913 self
.result_
[i
].OutputPartial(out
)
4914 if (self
.has_matched_count_
):
4916 out
.putVarInt64(self
.matched_count_
)
4917 if (self
.has_status_
):
4919 out
.putVarInt32(self
.status_
.ByteSizePartial())
4920 self
.status_
.OutputPartial(out
)
4921 if (self
.has_cursor_
):
4923 out
.putPrefixedString(self
.cursor_
)
4925 def TryMerge(self
, d
):
4926 while d
.avail() > 0:
4927 tt
= d
.getVarInt32()
4929 length
= d
.getVarInt32()
4930 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4932 self
.add_result().TryMerge(tmp
)
4935 self
.set_matched_count(d
.getVarInt64())
4938 length
= d
.getVarInt32()
4939 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
4941 self
.mutable_status().TryMerge(tmp
)
4944 self
.set_cursor(d
.getPrefixedString())
4948 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
4952 def __str__(self
, prefix
="", printElemNumber
=0):
4955 for e
in self
.result_
:
4957 if printElemNumber
: elm
="(%d)" % cnt
4958 res
+=prefix
+("result%s <\n" % elm
)
4959 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
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
)
4967 if self
.has_cursor_
: res
+=prefix
+("cursor: %s\n" % self
.DebugFormatString(self
.cursor_
))
4971 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
4972 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
4979 _TEXT
= _BuildTagLookupTable({
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
)
4997 _STYLE_CONTENT_TYPE
= """"""
4998 _PROTO_DESCRIPTOR_NAME
= 'apphosting.SearchResponse'
4999 if _extension_runtime
:
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']