thirdparty/google_appengine/google/appengine/datastore/datastore_pb.py
changeset 109 620f9b141567
child 149 f2e327a7c5de
equal deleted inserted replaced
108:261778de26ff 109:620f9b141567
       
     1 #!/usr/bin/env python
       
     2 #
       
     3 # Copyright 2007 Google Inc.
       
     4 #
       
     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
       
     8 #
       
     9 #     http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    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.
       
    16 #
       
    17 
       
    18 from google.net.proto import ProtocolBuffer
       
    19 import array
       
    20 import dummy_thread as thread
       
    21 
       
    22 __pychecker__ = """maxreturns=0 maxbranches=0 no-callinit
       
    23                    unusednames=printElemNumber,debug_strs no-special"""
       
    24 
       
    25 from google.appengine.api.api_base_pb import Integer64Proto;
       
    26 from google.appengine.api.api_base_pb import StringProto;
       
    27 from google.appengine.api.api_base_pb import VoidProto;
       
    28 from google.appengine.datastore.entity_pb import CompositeIndex
       
    29 from google.appengine.datastore.entity_pb import EntityProto
       
    30 from google.appengine.datastore.entity_pb import Index
       
    31 from google.appengine.datastore.entity_pb import Property
       
    32 from google.appengine.datastore.entity_pb import Reference
       
    33 class Transaction(ProtocolBuffer.ProtocolMessage):
       
    34   def __init__(self, contents=None):
       
    35     self.handle_ = 0
       
    36     self.has_handle_ = 0
       
    37     if contents is not None: self.MergeFromString(contents)
       
    38 
       
    39   def handle(self): return self.handle_
       
    40 
       
    41   def set_handle(self, x):
       
    42     self.has_handle_ = 1
       
    43     self.handle_ = x
       
    44 
       
    45   def clear_handle(self):
       
    46     self.has_handle_ = 0
       
    47     self.handle_ = 0
       
    48 
       
    49   def has_handle(self): return self.has_handle_
       
    50 
       
    51 
       
    52   def MergeFrom(self, x):
       
    53     assert x is not self
       
    54     if (x.has_handle()): self.set_handle(x.handle())
       
    55 
       
    56   def Equals(self, x):
       
    57     if x is self: return 1
       
    58     if self.has_handle_ != x.has_handle_: return 0
       
    59     if self.has_handle_ and self.handle_ != x.handle_: return 0
       
    60     return 1
       
    61 
       
    62   def __eq__(self, other):
       
    63     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
    64 
       
    65   def __ne__(self, other):
       
    66     return not (self == other)
       
    67 
       
    68   def IsInitialized(self, debug_strs=None):
       
    69     initialized = 1
       
    70     if (not self.has_handle_):
       
    71       initialized = 0
       
    72       if debug_strs is not None:
       
    73         debug_strs.append('Required field: handle not set.')
       
    74     return initialized
       
    75 
       
    76   def ByteSize(self):
       
    77     n = 0
       
    78     return n + 9
       
    79 
       
    80   def Clear(self):
       
    81     self.clear_handle()
       
    82 
       
    83   def OutputUnchecked(self, out):
       
    84     out.putVarInt32(9)
       
    85     out.put64(self.handle_)
       
    86 
       
    87   def TryMerge(self, d):
       
    88     while d.avail() > 0:
       
    89       tt = d.getVarInt32()
       
    90       if tt == 9:
       
    91         self.set_handle(d.get64())
       
    92         continue
       
    93       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
    94       d.skipData(tt)
       
    95 
       
    96 
       
    97   def __str__(self, prefix="", printElemNumber=0):
       
    98     res=""
       
    99     if self.has_handle_: res+=prefix+("handle: %s\n" % self.DebugFormatFixed64(self.handle_))
       
   100     return res
       
   101 
       
   102   khandle = 1
       
   103 
       
   104   _TEXT = (
       
   105    "ErrorCode",
       
   106    "handle",
       
   107   )
       
   108 
       
   109   _TYPES = (
       
   110    ProtocolBuffer.Encoder.NUMERIC,
       
   111    ProtocolBuffer.Encoder.DOUBLE,
       
   112 
       
   113   )
       
   114 
       
   115   _STYLE = """"""
       
   116   _STYLE_CONTENT_TYPE = """"""
       
   117 class Query_Filter(ProtocolBuffer.ProtocolMessage):
       
   118 
       
   119   LESS_THAN    =    1
       
   120   LESS_THAN_OR_EQUAL =    2
       
   121   GREATER_THAN =    3
       
   122   GREATER_THAN_OR_EQUAL =    4
       
   123   EQUAL        =    5
       
   124   IN           =    6
       
   125   EXISTS       =    7
       
   126 
       
   127   _Operator_NAMES = {
       
   128     1: "LESS_THAN",
       
   129     2: "LESS_THAN_OR_EQUAL",
       
   130     3: "GREATER_THAN",
       
   131     4: "GREATER_THAN_OR_EQUAL",
       
   132     5: "EQUAL",
       
   133     6: "IN",
       
   134     7: "EXISTS",
       
   135   }
       
   136 
       
   137   def Operator_Name(cls, x): return cls._Operator_NAMES.get(x, "")
       
   138   Operator_Name = classmethod(Operator_Name)
       
   139 
       
   140   def __init__(self, contents=None):
       
   141     self.op_ = 0
       
   142     self.property_ = []
       
   143     self.has_op_ = 0
       
   144     if contents is not None: self.MergeFromString(contents)
       
   145 
       
   146   def op(self): return self.op_
       
   147 
       
   148   def set_op(self, x):
       
   149     self.has_op_ = 1
       
   150     self.op_ = x
       
   151 
       
   152   def clear_op(self):
       
   153     self.has_op_ = 0
       
   154     self.op_ = 0
       
   155 
       
   156   def has_op(self): return self.has_op_
       
   157 
       
   158   def property_size(self): return len(self.property_)
       
   159   def property_list(self): return self.property_
       
   160 
       
   161   def property(self, i):
       
   162     return self.property_[i]
       
   163 
       
   164   def mutable_property(self, i):
       
   165     return self.property_[i]
       
   166 
       
   167   def add_property(self):
       
   168     x = Property()
       
   169     self.property_.append(x)
       
   170     return x
       
   171 
       
   172   def clear_property(self):
       
   173     self.property_ = []
       
   174 
       
   175   def MergeFrom(self, x):
       
   176     assert x is not self
       
   177     if (x.has_op()): self.set_op(x.op())
       
   178     for i in xrange(x.property_size()): self.add_property().CopyFrom(x.property(i))
       
   179 
       
   180   def Equals(self, x):
       
   181     if x is self: return 1
       
   182     if self.has_op_ != x.has_op_: return 0
       
   183     if self.has_op_ and self.op_ != x.op_: return 0
       
   184     if len(self.property_) != len(x.property_): return 0
       
   185     for e1, e2 in zip(self.property_, x.property_):
       
   186       if e1 != e2: return 0
       
   187     return 1
       
   188 
       
   189   def __eq__(self, other):
       
   190     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   191 
       
   192   def __ne__(self, other):
       
   193     return not (self == other)
       
   194 
       
   195   def IsInitialized(self, debug_strs=None):
       
   196     initialized = 1
       
   197     if (not self.has_op_):
       
   198       initialized = 0
       
   199       if debug_strs is not None:
       
   200         debug_strs.append('Required field: op not set.')
       
   201     for i in xrange(len(self.property_)):
       
   202       if (not self.property_[i].IsInitialized(debug_strs)): initialized=0
       
   203     return initialized
       
   204 
       
   205   def ByteSize(self):
       
   206     n = 0
       
   207     n += self.lengthVarInt64(self.op_)
       
   208     n += 1 * len(self.property_)
       
   209     for i in xrange(len(self.property_)): n += self.lengthString(self.property_[i].ByteSize())
       
   210     return n + 1
       
   211 
       
   212   def Clear(self):
       
   213     self.clear_op()
       
   214     self.clear_property()
       
   215 
       
   216   def OutputUnchecked(self, out):
       
   217     out.putVarInt32(48)
       
   218     out.putVarInt32(self.op_)
       
   219     for i in xrange(len(self.property_)):
       
   220       out.putVarInt32(114)
       
   221       out.putVarInt32(self.property_[i].ByteSize())
       
   222       self.property_[i].OutputUnchecked(out)
       
   223 
       
   224   def TryMerge(self, d):
       
   225     while 1:
       
   226       tt = d.getVarInt32()
       
   227       if tt == 36: break
       
   228       if tt == 48:
       
   229         self.set_op(d.getVarInt32())
       
   230         continue
       
   231       if tt == 114:
       
   232         length = d.getVarInt32()
       
   233         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   234         d.skip(length)
       
   235         self.add_property().TryMerge(tmp)
       
   236         continue
       
   237       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   238       d.skipData(tt)
       
   239 
       
   240 
       
   241   def __str__(self, prefix="", printElemNumber=0):
       
   242     res=""
       
   243     if self.has_op_: res+=prefix+("op: %s\n" % self.DebugFormatInt32(self.op_))
       
   244     cnt=0
       
   245     for e in self.property_:
       
   246       elm=""
       
   247       if printElemNumber: elm="(%d)" % cnt
       
   248       res+=prefix+("property%s <\n" % elm)
       
   249       res+=e.__str__(prefix + "  ", printElemNumber)
       
   250       res+=prefix+">\n"
       
   251       cnt+=1
       
   252     return res
       
   253 
       
   254 class Query_Order(ProtocolBuffer.ProtocolMessage):
       
   255 
       
   256   ASCENDING    =    1
       
   257   DESCENDING   =    2
       
   258 
       
   259   _Direction_NAMES = {
       
   260     1: "ASCENDING",
       
   261     2: "DESCENDING",
       
   262   }
       
   263 
       
   264   def Direction_Name(cls, x): return cls._Direction_NAMES.get(x, "")
       
   265   Direction_Name = classmethod(Direction_Name)
       
   266 
       
   267   def __init__(self, contents=None):
       
   268     self.property_ = ""
       
   269     self.direction_ = 1
       
   270     self.has_property_ = 0
       
   271     self.has_direction_ = 0
       
   272     if contents is not None: self.MergeFromString(contents)
       
   273 
       
   274   def property(self): return self.property_
       
   275 
       
   276   def set_property(self, x):
       
   277     self.has_property_ = 1
       
   278     self.property_ = x
       
   279 
       
   280   def clear_property(self):
       
   281     self.has_property_ = 0
       
   282     self.property_ = ""
       
   283 
       
   284   def has_property(self): return self.has_property_
       
   285 
       
   286   def direction(self): return self.direction_
       
   287 
       
   288   def set_direction(self, x):
       
   289     self.has_direction_ = 1
       
   290     self.direction_ = x
       
   291 
       
   292   def clear_direction(self):
       
   293     self.has_direction_ = 0
       
   294     self.direction_ = 1
       
   295 
       
   296   def has_direction(self): return self.has_direction_
       
   297 
       
   298 
       
   299   def MergeFrom(self, x):
       
   300     assert x is not self
       
   301     if (x.has_property()): self.set_property(x.property())
       
   302     if (x.has_direction()): self.set_direction(x.direction())
       
   303 
       
   304   def Equals(self, x):
       
   305     if x is self: return 1
       
   306     if self.has_property_ != x.has_property_: return 0
       
   307     if self.has_property_ and self.property_ != x.property_: return 0
       
   308     if self.has_direction_ != x.has_direction_: return 0
       
   309     if self.has_direction_ and self.direction_ != x.direction_: return 0
       
   310     return 1
       
   311 
       
   312   def __eq__(self, other):
       
   313     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   314 
       
   315   def __ne__(self, other):
       
   316     return not (self == other)
       
   317 
       
   318   def IsInitialized(self, debug_strs=None):
       
   319     initialized = 1
       
   320     if (not self.has_property_):
       
   321       initialized = 0
       
   322       if debug_strs is not None:
       
   323         debug_strs.append('Required field: property not set.')
       
   324     return initialized
       
   325 
       
   326   def ByteSize(self):
       
   327     n = 0
       
   328     n += self.lengthString(len(self.property_))
       
   329     if (self.has_direction_): n += 1 + self.lengthVarInt64(self.direction_)
       
   330     return n + 1
       
   331 
       
   332   def Clear(self):
       
   333     self.clear_property()
       
   334     self.clear_direction()
       
   335 
       
   336   def OutputUnchecked(self, out):
       
   337     out.putVarInt32(82)
       
   338     out.putPrefixedString(self.property_)
       
   339     if (self.has_direction_):
       
   340       out.putVarInt32(88)
       
   341       out.putVarInt32(self.direction_)
       
   342 
       
   343   def TryMerge(self, d):
       
   344     while 1:
       
   345       tt = d.getVarInt32()
       
   346       if tt == 76: break
       
   347       if tt == 82:
       
   348         self.set_property(d.getPrefixedString())
       
   349         continue
       
   350       if tt == 88:
       
   351         self.set_direction(d.getVarInt32())
       
   352         continue
       
   353       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   354       d.skipData(tt)
       
   355 
       
   356 
       
   357   def __str__(self, prefix="", printElemNumber=0):
       
   358     res=""
       
   359     if self.has_property_: res+=prefix+("property: %s\n" % self.DebugFormatString(self.property_))
       
   360     if self.has_direction_: res+=prefix+("direction: %s\n" % self.DebugFormatInt32(self.direction_))
       
   361     return res
       
   362 
       
   363 class Query(ProtocolBuffer.ProtocolMessage):
       
   364 
       
   365   ORDER_FIRST  =    1
       
   366   ANCESTOR_FIRST =    2
       
   367   FILTER_FIRST =    3
       
   368 
       
   369   _Plan_NAMES = {
       
   370     1: "ORDER_FIRST",
       
   371     2: "ANCESTOR_FIRST",
       
   372     3: "FILTER_FIRST",
       
   373   }
       
   374 
       
   375   def Plan_Name(cls, x): return cls._Plan_NAMES.get(x, "")
       
   376   Plan_Name = classmethod(Plan_Name)
       
   377 
       
   378   def __init__(self, contents=None):
       
   379     self.app_ = ""
       
   380     self.kind_ = ""
       
   381     self.ancestor_ = None
       
   382     self.filter_ = []
       
   383     self.search_query_ = ""
       
   384     self.order_ = []
       
   385     self.hint_ = 0
       
   386     self.offset_ = 0
       
   387     self.limit_ = 0
       
   388     self.composite_index_ = []
       
   389     self.require_perfect_plan_ = 0
       
   390     self.has_app_ = 0
       
   391     self.has_kind_ = 0
       
   392     self.has_ancestor_ = 0
       
   393     self.has_search_query_ = 0
       
   394     self.has_hint_ = 0
       
   395     self.has_offset_ = 0
       
   396     self.has_limit_ = 0
       
   397     self.has_require_perfect_plan_ = 0
       
   398     self.lazy_init_lock_ = thread.allocate_lock()
       
   399     if contents is not None: self.MergeFromString(contents)
       
   400 
       
   401   def app(self): return self.app_
       
   402 
       
   403   def set_app(self, x):
       
   404     self.has_app_ = 1
       
   405     self.app_ = x
       
   406 
       
   407   def clear_app(self):
       
   408     self.has_app_ = 0
       
   409     self.app_ = ""
       
   410 
       
   411   def has_app(self): return self.has_app_
       
   412 
       
   413   def kind(self): return self.kind_
       
   414 
       
   415   def set_kind(self, x):
       
   416     self.has_kind_ = 1
       
   417     self.kind_ = x
       
   418 
       
   419   def clear_kind(self):
       
   420     self.has_kind_ = 0
       
   421     self.kind_ = ""
       
   422 
       
   423   def has_kind(self): return self.has_kind_
       
   424 
       
   425   def ancestor(self):
       
   426     if self.ancestor_ is None:
       
   427       self.lazy_init_lock_.acquire()
       
   428       try:
       
   429         if self.ancestor_ is None: self.ancestor_ = Reference()
       
   430       finally:
       
   431         self.lazy_init_lock_.release()
       
   432     return self.ancestor_
       
   433 
       
   434   def mutable_ancestor(self): self.has_ancestor_ = 1; return self.ancestor()
       
   435 
       
   436   def clear_ancestor(self):
       
   437     self.has_ancestor_ = 0;
       
   438     if self.ancestor_ is not None: self.ancestor_.Clear()
       
   439 
       
   440   def has_ancestor(self): return self.has_ancestor_
       
   441 
       
   442   def filter_size(self): return len(self.filter_)
       
   443   def filter_list(self): return self.filter_
       
   444 
       
   445   def filter(self, i):
       
   446     return self.filter_[i]
       
   447 
       
   448   def mutable_filter(self, i):
       
   449     return self.filter_[i]
       
   450 
       
   451   def add_filter(self):
       
   452     x = Query_Filter()
       
   453     self.filter_.append(x)
       
   454     return x
       
   455 
       
   456   def clear_filter(self):
       
   457     self.filter_ = []
       
   458   def search_query(self): return self.search_query_
       
   459 
       
   460   def set_search_query(self, x):
       
   461     self.has_search_query_ = 1
       
   462     self.search_query_ = x
       
   463 
       
   464   def clear_search_query(self):
       
   465     self.has_search_query_ = 0
       
   466     self.search_query_ = ""
       
   467 
       
   468   def has_search_query(self): return self.has_search_query_
       
   469 
       
   470   def order_size(self): return len(self.order_)
       
   471   def order_list(self): return self.order_
       
   472 
       
   473   def order(self, i):
       
   474     return self.order_[i]
       
   475 
       
   476   def mutable_order(self, i):
       
   477     return self.order_[i]
       
   478 
       
   479   def add_order(self):
       
   480     x = Query_Order()
       
   481     self.order_.append(x)
       
   482     return x
       
   483 
       
   484   def clear_order(self):
       
   485     self.order_ = []
       
   486   def hint(self): return self.hint_
       
   487 
       
   488   def set_hint(self, x):
       
   489     self.has_hint_ = 1
       
   490     self.hint_ = x
       
   491 
       
   492   def clear_hint(self):
       
   493     self.has_hint_ = 0
       
   494     self.hint_ = 0
       
   495 
       
   496   def has_hint(self): return self.has_hint_
       
   497 
       
   498   def offset(self): return self.offset_
       
   499 
       
   500   def set_offset(self, x):
       
   501     self.has_offset_ = 1
       
   502     self.offset_ = x
       
   503 
       
   504   def clear_offset(self):
       
   505     self.has_offset_ = 0
       
   506     self.offset_ = 0
       
   507 
       
   508   def has_offset(self): return self.has_offset_
       
   509 
       
   510   def limit(self): return self.limit_
       
   511 
       
   512   def set_limit(self, x):
       
   513     self.has_limit_ = 1
       
   514     self.limit_ = x
       
   515 
       
   516   def clear_limit(self):
       
   517     self.has_limit_ = 0
       
   518     self.limit_ = 0
       
   519 
       
   520   def has_limit(self): return self.has_limit_
       
   521 
       
   522   def composite_index_size(self): return len(self.composite_index_)
       
   523   def composite_index_list(self): return self.composite_index_
       
   524 
       
   525   def composite_index(self, i):
       
   526     return self.composite_index_[i]
       
   527 
       
   528   def mutable_composite_index(self, i):
       
   529     return self.composite_index_[i]
       
   530 
       
   531   def add_composite_index(self):
       
   532     x = CompositeIndex()
       
   533     self.composite_index_.append(x)
       
   534     return x
       
   535 
       
   536   def clear_composite_index(self):
       
   537     self.composite_index_ = []
       
   538   def require_perfect_plan(self): return self.require_perfect_plan_
       
   539 
       
   540   def set_require_perfect_plan(self, x):
       
   541     self.has_require_perfect_plan_ = 1
       
   542     self.require_perfect_plan_ = x
       
   543 
       
   544   def clear_require_perfect_plan(self):
       
   545     self.has_require_perfect_plan_ = 0
       
   546     self.require_perfect_plan_ = 0
       
   547 
       
   548   def has_require_perfect_plan(self): return self.has_require_perfect_plan_
       
   549 
       
   550 
       
   551   def MergeFrom(self, x):
       
   552     assert x is not self
       
   553     if (x.has_app()): self.set_app(x.app())
       
   554     if (x.has_kind()): self.set_kind(x.kind())
       
   555     if (x.has_ancestor()): self.mutable_ancestor().MergeFrom(x.ancestor())
       
   556     for i in xrange(x.filter_size()): self.add_filter().CopyFrom(x.filter(i))
       
   557     if (x.has_search_query()): self.set_search_query(x.search_query())
       
   558     for i in xrange(x.order_size()): self.add_order().CopyFrom(x.order(i))
       
   559     if (x.has_hint()): self.set_hint(x.hint())
       
   560     if (x.has_offset()): self.set_offset(x.offset())
       
   561     if (x.has_limit()): self.set_limit(x.limit())
       
   562     for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
       
   563     if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan())
       
   564 
       
   565   def Equals(self, x):
       
   566     if x is self: return 1
       
   567     if self.has_app_ != x.has_app_: return 0
       
   568     if self.has_app_ and self.app_ != x.app_: return 0
       
   569     if self.has_kind_ != x.has_kind_: return 0
       
   570     if self.has_kind_ and self.kind_ != x.kind_: return 0
       
   571     if self.has_ancestor_ != x.has_ancestor_: return 0
       
   572     if self.has_ancestor_ and self.ancestor_ != x.ancestor_: return 0
       
   573     if len(self.filter_) != len(x.filter_): return 0
       
   574     for e1, e2 in zip(self.filter_, x.filter_):
       
   575       if e1 != e2: return 0
       
   576     if self.has_search_query_ != x.has_search_query_: return 0
       
   577     if self.has_search_query_ and self.search_query_ != x.search_query_: return 0
       
   578     if len(self.order_) != len(x.order_): return 0
       
   579     for e1, e2 in zip(self.order_, x.order_):
       
   580       if e1 != e2: return 0
       
   581     if self.has_hint_ != x.has_hint_: return 0
       
   582     if self.has_hint_ and self.hint_ != x.hint_: return 0
       
   583     if self.has_offset_ != x.has_offset_: return 0
       
   584     if self.has_offset_ and self.offset_ != x.offset_: return 0
       
   585     if self.has_limit_ != x.has_limit_: return 0
       
   586     if self.has_limit_ and self.limit_ != x.limit_: return 0
       
   587     if len(self.composite_index_) != len(x.composite_index_): return 0
       
   588     for e1, e2 in zip(self.composite_index_, x.composite_index_):
       
   589       if e1 != e2: return 0
       
   590     if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0
       
   591     if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0
       
   592     return 1
       
   593 
       
   594   def __eq__(self, other):
       
   595     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   596 
       
   597   def __ne__(self, other):
       
   598     return not (self == other)
       
   599 
       
   600   def IsInitialized(self, debug_strs=None):
       
   601     initialized = 1
       
   602     if (not self.has_app_):
       
   603       initialized = 0
       
   604       if debug_strs is not None:
       
   605         debug_strs.append('Required field: app not set.')
       
   606     if (self.has_ancestor_ and not self.ancestor_.IsInitialized(debug_strs)): initialized = 0
       
   607     for i in xrange(len(self.filter_)):
       
   608       if (not self.filter_[i].IsInitialized(debug_strs)): initialized=0
       
   609     for i in xrange(len(self.order_)):
       
   610       if (not self.order_[i].IsInitialized(debug_strs)): initialized=0
       
   611     for i in xrange(len(self.composite_index_)):
       
   612       if (not self.composite_index_[i].IsInitialized(debug_strs)): initialized=0
       
   613     return initialized
       
   614 
       
   615   def ByteSize(self):
       
   616     n = 0
       
   617     n += self.lengthString(len(self.app_))
       
   618     if (self.has_kind_): n += 1 + self.lengthString(len(self.kind_))
       
   619     if (self.has_ancestor_): n += 2 + self.lengthString(self.ancestor_.ByteSize())
       
   620     n += 2 * len(self.filter_)
       
   621     for i in xrange(len(self.filter_)): n += self.filter_[i].ByteSize()
       
   622     if (self.has_search_query_): n += 1 + self.lengthString(len(self.search_query_))
       
   623     n += 2 * len(self.order_)
       
   624     for i in xrange(len(self.order_)): n += self.order_[i].ByteSize()
       
   625     if (self.has_hint_): n += 2 + self.lengthVarInt64(self.hint_)
       
   626     if (self.has_offset_): n += 1 + self.lengthVarInt64(self.offset_)
       
   627     if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_)
       
   628     n += 2 * len(self.composite_index_)
       
   629     for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
       
   630     if (self.has_require_perfect_plan_): n += 3
       
   631     return n + 1
       
   632 
       
   633   def Clear(self):
       
   634     self.clear_app()
       
   635     self.clear_kind()
       
   636     self.clear_ancestor()
       
   637     self.clear_filter()
       
   638     self.clear_search_query()
       
   639     self.clear_order()
       
   640     self.clear_hint()
       
   641     self.clear_offset()
       
   642     self.clear_limit()
       
   643     self.clear_composite_index()
       
   644     self.clear_require_perfect_plan()
       
   645 
       
   646   def OutputUnchecked(self, out):
       
   647     out.putVarInt32(10)
       
   648     out.putPrefixedString(self.app_)
       
   649     if (self.has_kind_):
       
   650       out.putVarInt32(26)
       
   651       out.putPrefixedString(self.kind_)
       
   652     for i in xrange(len(self.filter_)):
       
   653       out.putVarInt32(35)
       
   654       self.filter_[i].OutputUnchecked(out)
       
   655       out.putVarInt32(36)
       
   656     if (self.has_search_query_):
       
   657       out.putVarInt32(66)
       
   658       out.putPrefixedString(self.search_query_)
       
   659     for i in xrange(len(self.order_)):
       
   660       out.putVarInt32(75)
       
   661       self.order_[i].OutputUnchecked(out)
       
   662       out.putVarInt32(76)
       
   663     if (self.has_offset_):
       
   664       out.putVarInt32(96)
       
   665       out.putVarInt32(self.offset_)
       
   666     if (self.has_limit_):
       
   667       out.putVarInt32(128)
       
   668       out.putVarInt32(self.limit_)
       
   669     if (self.has_ancestor_):
       
   670       out.putVarInt32(138)
       
   671       out.putVarInt32(self.ancestor_.ByteSize())
       
   672       self.ancestor_.OutputUnchecked(out)
       
   673     if (self.has_hint_):
       
   674       out.putVarInt32(144)
       
   675       out.putVarInt32(self.hint_)
       
   676     for i in xrange(len(self.composite_index_)):
       
   677       out.putVarInt32(154)
       
   678       out.putVarInt32(self.composite_index_[i].ByteSize())
       
   679       self.composite_index_[i].OutputUnchecked(out)
       
   680     if (self.has_require_perfect_plan_):
       
   681       out.putVarInt32(160)
       
   682       out.putBoolean(self.require_perfect_plan_)
       
   683 
       
   684   def TryMerge(self, d):
       
   685     while d.avail() > 0:
       
   686       tt = d.getVarInt32()
       
   687       if tt == 10:
       
   688         self.set_app(d.getPrefixedString())
       
   689         continue
       
   690       if tt == 26:
       
   691         self.set_kind(d.getPrefixedString())
       
   692         continue
       
   693       if tt == 35:
       
   694         self.add_filter().TryMerge(d)
       
   695         continue
       
   696       if tt == 66:
       
   697         self.set_search_query(d.getPrefixedString())
       
   698         continue
       
   699       if tt == 75:
       
   700         self.add_order().TryMerge(d)
       
   701         continue
       
   702       if tt == 96:
       
   703         self.set_offset(d.getVarInt32())
       
   704         continue
       
   705       if tt == 128:
       
   706         self.set_limit(d.getVarInt32())
       
   707         continue
       
   708       if tt == 138:
       
   709         length = d.getVarInt32()
       
   710         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   711         d.skip(length)
       
   712         self.mutable_ancestor().TryMerge(tmp)
       
   713         continue
       
   714       if tt == 144:
       
   715         self.set_hint(d.getVarInt32())
       
   716         continue
       
   717       if tt == 154:
       
   718         length = d.getVarInt32()
       
   719         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   720         d.skip(length)
       
   721         self.add_composite_index().TryMerge(tmp)
       
   722         continue
       
   723       if tt == 160:
       
   724         self.set_require_perfect_plan(d.getBoolean())
       
   725         continue
       
   726       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
   727       d.skipData(tt)
       
   728 
       
   729 
       
   730   def __str__(self, prefix="", printElemNumber=0):
       
   731     res=""
       
   732     if self.has_app_: res+=prefix+("app: %s\n" % self.DebugFormatString(self.app_))
       
   733     if self.has_kind_: res+=prefix+("kind: %s\n" % self.DebugFormatString(self.kind_))
       
   734     if self.has_ancestor_:
       
   735       res+=prefix+"ancestor <\n"
       
   736       res+=self.ancestor_.__str__(prefix + "  ", printElemNumber)
       
   737       res+=prefix+">\n"
       
   738     cnt=0
       
   739     for e in self.filter_:
       
   740       elm=""
       
   741       if printElemNumber: elm="(%d)" % cnt
       
   742       res+=prefix+("Filter%s {\n" % elm)
       
   743       res+=e.__str__(prefix + "  ", printElemNumber)
       
   744       res+=prefix+"}\n"
       
   745       cnt+=1
       
   746     if self.has_search_query_: res+=prefix+("search_query: %s\n" % self.DebugFormatString(self.search_query_))
       
   747     cnt=0
       
   748     for e in self.order_:
       
   749       elm=""
       
   750       if printElemNumber: elm="(%d)" % cnt
       
   751       res+=prefix+("Order%s {\n" % elm)
       
   752       res+=e.__str__(prefix + "  ", printElemNumber)
       
   753       res+=prefix+"}\n"
       
   754       cnt+=1
       
   755     if self.has_hint_: res+=prefix+("hint: %s\n" % self.DebugFormatInt32(self.hint_))
       
   756     if self.has_offset_: res+=prefix+("offset: %s\n" % self.DebugFormatInt32(self.offset_))
       
   757     if self.has_limit_: res+=prefix+("limit: %s\n" % self.DebugFormatInt32(self.limit_))
       
   758     cnt=0
       
   759     for e in self.composite_index_:
       
   760       elm=""
       
   761       if printElemNumber: elm="(%d)" % cnt
       
   762       res+=prefix+("composite_index%s <\n" % elm)
       
   763       res+=e.__str__(prefix + "  ", printElemNumber)
       
   764       res+=prefix+">\n"
       
   765       cnt+=1
       
   766     if self.has_require_perfect_plan_: res+=prefix+("require_perfect_plan: %s\n" % self.DebugFormatBool(self.require_perfect_plan_))
       
   767     return res
       
   768 
       
   769   kapp = 1
       
   770   kkind = 3
       
   771   kancestor = 17
       
   772   kFilterGroup = 4
       
   773   kFilterop = 6
       
   774   kFilterproperty = 14
       
   775   ksearch_query = 8
       
   776   kOrderGroup = 9
       
   777   kOrderproperty = 10
       
   778   kOrderdirection = 11
       
   779   khint = 18
       
   780   koffset = 12
       
   781   klimit = 16
       
   782   kcomposite_index = 19
       
   783   krequire_perfect_plan = 20
       
   784 
       
   785   _TEXT = (
       
   786    "ErrorCode",
       
   787    "app",
       
   788    None,
       
   789    "kind",
       
   790    "Filter",
       
   791    None,
       
   792    "op",
       
   793    None,
       
   794    "search_query",
       
   795    "Order",
       
   796    "property",
       
   797    "direction",
       
   798    "offset",
       
   799    None,
       
   800    "property",
       
   801    None,
       
   802    "limit",
       
   803    "ancestor",
       
   804    "hint",
       
   805    "composite_index",
       
   806    "require_perfect_plan",
       
   807   )
       
   808 
       
   809   _TYPES = (
       
   810    ProtocolBuffer.Encoder.NUMERIC,
       
   811    ProtocolBuffer.Encoder.STRING,
       
   812 
       
   813    ProtocolBuffer.Encoder.MAX_TYPE,
       
   814 
       
   815    ProtocolBuffer.Encoder.STRING,
       
   816 
       
   817    ProtocolBuffer.Encoder.STARTGROUP,
       
   818 
       
   819    ProtocolBuffer.Encoder.MAX_TYPE,
       
   820 
       
   821    ProtocolBuffer.Encoder.NUMERIC,
       
   822 
       
   823    ProtocolBuffer.Encoder.MAX_TYPE,
       
   824 
       
   825    ProtocolBuffer.Encoder.STRING,
       
   826 
       
   827    ProtocolBuffer.Encoder.STARTGROUP,
       
   828 
       
   829    ProtocolBuffer.Encoder.STRING,
       
   830 
       
   831    ProtocolBuffer.Encoder.NUMERIC,
       
   832 
       
   833    ProtocolBuffer.Encoder.NUMERIC,
       
   834 
       
   835    ProtocolBuffer.Encoder.MAX_TYPE,
       
   836 
       
   837    ProtocolBuffer.Encoder.STRING,
       
   838 
       
   839    ProtocolBuffer.Encoder.MAX_TYPE,
       
   840 
       
   841    ProtocolBuffer.Encoder.NUMERIC,
       
   842 
       
   843    ProtocolBuffer.Encoder.STRING,
       
   844 
       
   845    ProtocolBuffer.Encoder.NUMERIC,
       
   846 
       
   847    ProtocolBuffer.Encoder.STRING,
       
   848 
       
   849    ProtocolBuffer.Encoder.NUMERIC,
       
   850 
       
   851   )
       
   852 
       
   853   _STYLE = """"""
       
   854   _STYLE_CONTENT_TYPE = """"""
       
   855 class QueryExplanation(ProtocolBuffer.ProtocolMessage):
       
   856   def __init__(self, contents=None):
       
   857     self.native_ancestor_ = 0
       
   858     self.native_index_ = []
       
   859     self.native_offset_ = 0
       
   860     self.native_limit_ = 0
       
   861     self.has_native_ancestor_ = 0
       
   862     self.has_native_offset_ = 0
       
   863     self.has_native_limit_ = 0
       
   864     if contents is not None: self.MergeFromString(contents)
       
   865 
       
   866   def native_ancestor(self): return self.native_ancestor_
       
   867 
       
   868   def set_native_ancestor(self, x):
       
   869     self.has_native_ancestor_ = 1
       
   870     self.native_ancestor_ = x
       
   871 
       
   872   def clear_native_ancestor(self):
       
   873     self.has_native_ancestor_ = 0
       
   874     self.native_ancestor_ = 0
       
   875 
       
   876   def has_native_ancestor(self): return self.has_native_ancestor_
       
   877 
       
   878   def native_index_size(self): return len(self.native_index_)
       
   879   def native_index_list(self): return self.native_index_
       
   880 
       
   881   def native_index(self, i):
       
   882     return self.native_index_[i]
       
   883 
       
   884   def mutable_native_index(self, i):
       
   885     return self.native_index_[i]
       
   886 
       
   887   def add_native_index(self):
       
   888     x = Index()
       
   889     self.native_index_.append(x)
       
   890     return x
       
   891 
       
   892   def clear_native_index(self):
       
   893     self.native_index_ = []
       
   894   def native_offset(self): return self.native_offset_
       
   895 
       
   896   def set_native_offset(self, x):
       
   897     self.has_native_offset_ = 1
       
   898     self.native_offset_ = x
       
   899 
       
   900   def clear_native_offset(self):
       
   901     self.has_native_offset_ = 0
       
   902     self.native_offset_ = 0
       
   903 
       
   904   def has_native_offset(self): return self.has_native_offset_
       
   905 
       
   906   def native_limit(self): return self.native_limit_
       
   907 
       
   908   def set_native_limit(self, x):
       
   909     self.has_native_limit_ = 1
       
   910     self.native_limit_ = x
       
   911 
       
   912   def clear_native_limit(self):
       
   913     self.has_native_limit_ = 0
       
   914     self.native_limit_ = 0
       
   915 
       
   916   def has_native_limit(self): return self.has_native_limit_
       
   917 
       
   918 
       
   919   def MergeFrom(self, x):
       
   920     assert x is not self
       
   921     if (x.has_native_ancestor()): self.set_native_ancestor(x.native_ancestor())
       
   922     for i in xrange(x.native_index_size()): self.add_native_index().CopyFrom(x.native_index(i))
       
   923     if (x.has_native_offset()): self.set_native_offset(x.native_offset())
       
   924     if (x.has_native_limit()): self.set_native_limit(x.native_limit())
       
   925 
       
   926   def Equals(self, x):
       
   927     if x is self: return 1
       
   928     if self.has_native_ancestor_ != x.has_native_ancestor_: return 0
       
   929     if self.has_native_ancestor_ and self.native_ancestor_ != x.native_ancestor_: return 0
       
   930     if len(self.native_index_) != len(x.native_index_): return 0
       
   931     for e1, e2 in zip(self.native_index_, x.native_index_):
       
   932       if e1 != e2: return 0
       
   933     if self.has_native_offset_ != x.has_native_offset_: return 0
       
   934     if self.has_native_offset_ and self.native_offset_ != x.native_offset_: return 0
       
   935     if self.has_native_limit_ != x.has_native_limit_: return 0
       
   936     if self.has_native_limit_ and self.native_limit_ != x.native_limit_: return 0
       
   937     return 1
       
   938 
       
   939   def __eq__(self, other):
       
   940     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
   941 
       
   942   def __ne__(self, other):
       
   943     return not (self == other)
       
   944 
       
   945   def IsInitialized(self, debug_strs=None):
       
   946     initialized = 1
       
   947     for i in xrange(len(self.native_index_)):
       
   948       if (not self.native_index_[i].IsInitialized(debug_strs)): initialized=0
       
   949     return initialized
       
   950 
       
   951   def ByteSize(self):
       
   952     n = 0
       
   953     if (self.has_native_ancestor_): n += 2
       
   954     n += 1 * len(self.native_index_)
       
   955     for i in xrange(len(self.native_index_)): n += self.lengthString(self.native_index_[i].ByteSize())
       
   956     if (self.has_native_offset_): n += 1 + self.lengthVarInt64(self.native_offset_)
       
   957     if (self.has_native_limit_): n += 1 + self.lengthVarInt64(self.native_limit_)
       
   958     return n + 0
       
   959 
       
   960   def Clear(self):
       
   961     self.clear_native_ancestor()
       
   962     self.clear_native_index()
       
   963     self.clear_native_offset()
       
   964     self.clear_native_limit()
       
   965 
       
   966   def OutputUnchecked(self, out):
       
   967     if (self.has_native_ancestor_):
       
   968       out.putVarInt32(8)
       
   969       out.putBoolean(self.native_ancestor_)
       
   970     for i in xrange(len(self.native_index_)):
       
   971       out.putVarInt32(18)
       
   972       out.putVarInt32(self.native_index_[i].ByteSize())
       
   973       self.native_index_[i].OutputUnchecked(out)
       
   974     if (self.has_native_offset_):
       
   975       out.putVarInt32(24)
       
   976       out.putVarInt32(self.native_offset_)
       
   977     if (self.has_native_limit_):
       
   978       out.putVarInt32(32)
       
   979       out.putVarInt32(self.native_limit_)
       
   980 
       
   981   def TryMerge(self, d):
       
   982     while d.avail() > 0:
       
   983       tt = d.getVarInt32()
       
   984       if tt == 8:
       
   985         self.set_native_ancestor(d.getBoolean())
       
   986         continue
       
   987       if tt == 18:
       
   988         length = d.getVarInt32()
       
   989         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   990         d.skip(length)
       
   991         self.add_native_index().TryMerge(tmp)
       
   992         continue
       
   993       if tt == 24:
       
   994         self.set_native_offset(d.getVarInt32())
       
   995         continue
       
   996       if tt == 32:
       
   997         self.set_native_limit(d.getVarInt32())
       
   998         continue
       
   999       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1000       d.skipData(tt)
       
  1001 
       
  1002 
       
  1003   def __str__(self, prefix="", printElemNumber=0):
       
  1004     res=""
       
  1005     if self.has_native_ancestor_: res+=prefix+("native_ancestor: %s\n" % self.DebugFormatBool(self.native_ancestor_))
       
  1006     cnt=0
       
  1007     for e in self.native_index_:
       
  1008       elm=""
       
  1009       if printElemNumber: elm="(%d)" % cnt
       
  1010       res+=prefix+("native_index%s <\n" % elm)
       
  1011       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1012       res+=prefix+">\n"
       
  1013       cnt+=1
       
  1014     if self.has_native_offset_: res+=prefix+("native_offset: %s\n" % self.DebugFormatInt32(self.native_offset_))
       
  1015     if self.has_native_limit_: res+=prefix+("native_limit: %s\n" % self.DebugFormatInt32(self.native_limit_))
       
  1016     return res
       
  1017 
       
  1018   knative_ancestor = 1
       
  1019   knative_index = 2
       
  1020   knative_offset = 3
       
  1021   knative_limit = 4
       
  1022 
       
  1023   _TEXT = (
       
  1024    "ErrorCode",
       
  1025    "native_ancestor",
       
  1026    "native_index",
       
  1027    "native_offset",
       
  1028    "native_limit",
       
  1029   )
       
  1030 
       
  1031   _TYPES = (
       
  1032    ProtocolBuffer.Encoder.NUMERIC,
       
  1033    ProtocolBuffer.Encoder.NUMERIC,
       
  1034 
       
  1035    ProtocolBuffer.Encoder.STRING,
       
  1036 
       
  1037    ProtocolBuffer.Encoder.NUMERIC,
       
  1038 
       
  1039    ProtocolBuffer.Encoder.NUMERIC,
       
  1040 
       
  1041   )
       
  1042 
       
  1043   _STYLE = """"""
       
  1044   _STYLE_CONTENT_TYPE = """"""
       
  1045 class Cursor(ProtocolBuffer.ProtocolMessage):
       
  1046   def __init__(self, contents=None):
       
  1047     self.cursor_ = 0
       
  1048     self.has_cursor_ = 0
       
  1049     if contents is not None: self.MergeFromString(contents)
       
  1050 
       
  1051   def cursor(self): return self.cursor_
       
  1052 
       
  1053   def set_cursor(self, x):
       
  1054     self.has_cursor_ = 1
       
  1055     self.cursor_ = x
       
  1056 
       
  1057   def clear_cursor(self):
       
  1058     self.has_cursor_ = 0
       
  1059     self.cursor_ = 0
       
  1060 
       
  1061   def has_cursor(self): return self.has_cursor_
       
  1062 
       
  1063 
       
  1064   def MergeFrom(self, x):
       
  1065     assert x is not self
       
  1066     if (x.has_cursor()): self.set_cursor(x.cursor())
       
  1067 
       
  1068   def Equals(self, x):
       
  1069     if x is self: return 1
       
  1070     if self.has_cursor_ != x.has_cursor_: return 0
       
  1071     if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
       
  1072     return 1
       
  1073 
       
  1074   def __eq__(self, other):
       
  1075     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1076 
       
  1077   def __ne__(self, other):
       
  1078     return not (self == other)
       
  1079 
       
  1080   def IsInitialized(self, debug_strs=None):
       
  1081     initialized = 1
       
  1082     if (not self.has_cursor_):
       
  1083       initialized = 0
       
  1084       if debug_strs is not None:
       
  1085         debug_strs.append('Required field: cursor not set.')
       
  1086     return initialized
       
  1087 
       
  1088   def ByteSize(self):
       
  1089     n = 0
       
  1090     return n + 9
       
  1091 
       
  1092   def Clear(self):
       
  1093     self.clear_cursor()
       
  1094 
       
  1095   def OutputUnchecked(self, out):
       
  1096     out.putVarInt32(9)
       
  1097     out.put64(self.cursor_)
       
  1098 
       
  1099   def TryMerge(self, d):
       
  1100     while d.avail() > 0:
       
  1101       tt = d.getVarInt32()
       
  1102       if tt == 9:
       
  1103         self.set_cursor(d.get64())
       
  1104         continue
       
  1105       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1106       d.skipData(tt)
       
  1107 
       
  1108 
       
  1109   def __str__(self, prefix="", printElemNumber=0):
       
  1110     res=""
       
  1111     if self.has_cursor_: res+=prefix+("cursor: %s\n" % self.DebugFormatFixed64(self.cursor_))
       
  1112     return res
       
  1113 
       
  1114   kcursor = 1
       
  1115 
       
  1116   _TEXT = (
       
  1117    "ErrorCode",
       
  1118    "cursor",
       
  1119   )
       
  1120 
       
  1121   _TYPES = (
       
  1122    ProtocolBuffer.Encoder.NUMERIC,
       
  1123    ProtocolBuffer.Encoder.DOUBLE,
       
  1124 
       
  1125   )
       
  1126 
       
  1127   _STYLE = """"""
       
  1128   _STYLE_CONTENT_TYPE = """"""
       
  1129 class Error(ProtocolBuffer.ProtocolMessage):
       
  1130 
       
  1131   BAD_REQUEST  =    1
       
  1132   CONCURRENT_TRANSACTION =    2
       
  1133   INTERNAL_ERROR =    3
       
  1134   NEED_INDEX   =    4
       
  1135   TIMEOUT      =    5
       
  1136 
       
  1137   _ErrorCode_NAMES = {
       
  1138     1: "BAD_REQUEST",
       
  1139     2: "CONCURRENT_TRANSACTION",
       
  1140     3: "INTERNAL_ERROR",
       
  1141     4: "NEED_INDEX",
       
  1142     5: "TIMEOUT",
       
  1143   }
       
  1144 
       
  1145   def ErrorCode_Name(cls, x): return cls._ErrorCode_NAMES.get(x, "")
       
  1146   ErrorCode_Name = classmethod(ErrorCode_Name)
       
  1147 
       
  1148   def __init__(self, contents=None):
       
  1149     pass
       
  1150     if contents is not None: self.MergeFromString(contents)
       
  1151 
       
  1152 
       
  1153   def MergeFrom(self, x):
       
  1154     assert x is not self
       
  1155 
       
  1156   def Equals(self, x):
       
  1157     if x is self: return 1
       
  1158     return 1
       
  1159 
       
  1160   def __eq__(self, other):
       
  1161     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1162 
       
  1163   def __ne__(self, other):
       
  1164     return not (self == other)
       
  1165 
       
  1166   def IsInitialized(self, debug_strs=None):
       
  1167     initialized = 1
       
  1168     return initialized
       
  1169 
       
  1170   def ByteSize(self):
       
  1171     n = 0
       
  1172     return n + 0
       
  1173 
       
  1174   def Clear(self):
       
  1175     pass
       
  1176 
       
  1177   def OutputUnchecked(self, out):
       
  1178     pass
       
  1179 
       
  1180   def TryMerge(self, d):
       
  1181     while d.avail() > 0:
       
  1182       tt = d.getVarInt32()
       
  1183       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1184       d.skipData(tt)
       
  1185 
       
  1186 
       
  1187   def __str__(self, prefix="", printElemNumber=0):
       
  1188     res=""
       
  1189     return res
       
  1190 
       
  1191 
       
  1192   _TEXT = (
       
  1193    "ErrorCode",
       
  1194   )
       
  1195 
       
  1196   _TYPES = (
       
  1197    ProtocolBuffer.Encoder.NUMERIC,
       
  1198   )
       
  1199 
       
  1200   _STYLE = """"""
       
  1201   _STYLE_CONTENT_TYPE = """"""
       
  1202 class GetRequest(ProtocolBuffer.ProtocolMessage):
       
  1203   def __init__(self, contents=None):
       
  1204     self.key_ = []
       
  1205     self.transaction_ = None
       
  1206     self.has_transaction_ = 0
       
  1207     self.lazy_init_lock_ = thread.allocate_lock()
       
  1208     if contents is not None: self.MergeFromString(contents)
       
  1209 
       
  1210   def key_size(self): return len(self.key_)
       
  1211   def key_list(self): return self.key_
       
  1212 
       
  1213   def key(self, i):
       
  1214     return self.key_[i]
       
  1215 
       
  1216   def mutable_key(self, i):
       
  1217     return self.key_[i]
       
  1218 
       
  1219   def add_key(self):
       
  1220     x = Reference()
       
  1221     self.key_.append(x)
       
  1222     return x
       
  1223 
       
  1224   def clear_key(self):
       
  1225     self.key_ = []
       
  1226   def transaction(self):
       
  1227     if self.transaction_ is None:
       
  1228       self.lazy_init_lock_.acquire()
       
  1229       try:
       
  1230         if self.transaction_ is None: self.transaction_ = Transaction()
       
  1231       finally:
       
  1232         self.lazy_init_lock_.release()
       
  1233     return self.transaction_
       
  1234 
       
  1235   def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
       
  1236 
       
  1237   def clear_transaction(self):
       
  1238     self.has_transaction_ = 0;
       
  1239     if self.transaction_ is not None: self.transaction_.Clear()
       
  1240 
       
  1241   def has_transaction(self): return self.has_transaction_
       
  1242 
       
  1243 
       
  1244   def MergeFrom(self, x):
       
  1245     assert x is not self
       
  1246     for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
       
  1247     if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
       
  1248 
       
  1249   def Equals(self, x):
       
  1250     if x is self: return 1
       
  1251     if len(self.key_) != len(x.key_): return 0
       
  1252     for e1, e2 in zip(self.key_, x.key_):
       
  1253       if e1 != e2: return 0
       
  1254     if self.has_transaction_ != x.has_transaction_: return 0
       
  1255     if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
       
  1256     return 1
       
  1257 
       
  1258   def __eq__(self, other):
       
  1259     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1260 
       
  1261   def __ne__(self, other):
       
  1262     return not (self == other)
       
  1263 
       
  1264   def IsInitialized(self, debug_strs=None):
       
  1265     initialized = 1
       
  1266     for i in xrange(len(self.key_)):
       
  1267       if (not self.key_[i].IsInitialized(debug_strs)): initialized=0
       
  1268     if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
       
  1269     return initialized
       
  1270 
       
  1271   def ByteSize(self):
       
  1272     n = 0
       
  1273     n += 1 * len(self.key_)
       
  1274     for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
       
  1275     if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
       
  1276     return n + 0
       
  1277 
       
  1278   def Clear(self):
       
  1279     self.clear_key()
       
  1280     self.clear_transaction()
       
  1281 
       
  1282   def OutputUnchecked(self, out):
       
  1283     for i in xrange(len(self.key_)):
       
  1284       out.putVarInt32(10)
       
  1285       out.putVarInt32(self.key_[i].ByteSize())
       
  1286       self.key_[i].OutputUnchecked(out)
       
  1287     if (self.has_transaction_):
       
  1288       out.putVarInt32(18)
       
  1289       out.putVarInt32(self.transaction_.ByteSize())
       
  1290       self.transaction_.OutputUnchecked(out)
       
  1291 
       
  1292   def TryMerge(self, d):
       
  1293     while d.avail() > 0:
       
  1294       tt = d.getVarInt32()
       
  1295       if tt == 10:
       
  1296         length = d.getVarInt32()
       
  1297         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1298         d.skip(length)
       
  1299         self.add_key().TryMerge(tmp)
       
  1300         continue
       
  1301       if tt == 18:
       
  1302         length = d.getVarInt32()
       
  1303         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1304         d.skip(length)
       
  1305         self.mutable_transaction().TryMerge(tmp)
       
  1306         continue
       
  1307       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1308       d.skipData(tt)
       
  1309 
       
  1310 
       
  1311   def __str__(self, prefix="", printElemNumber=0):
       
  1312     res=""
       
  1313     cnt=0
       
  1314     for e in self.key_:
       
  1315       elm=""
       
  1316       if printElemNumber: elm="(%d)" % cnt
       
  1317       res+=prefix+("key%s <\n" % elm)
       
  1318       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1319       res+=prefix+">\n"
       
  1320       cnt+=1
       
  1321     if self.has_transaction_:
       
  1322       res+=prefix+"transaction <\n"
       
  1323       res+=self.transaction_.__str__(prefix + "  ", printElemNumber)
       
  1324       res+=prefix+">\n"
       
  1325     return res
       
  1326 
       
  1327   kkey = 1
       
  1328   ktransaction = 2
       
  1329 
       
  1330   _TEXT = (
       
  1331    "ErrorCode",
       
  1332    "key",
       
  1333    "transaction",
       
  1334   )
       
  1335 
       
  1336   _TYPES = (
       
  1337    ProtocolBuffer.Encoder.NUMERIC,
       
  1338    ProtocolBuffer.Encoder.STRING,
       
  1339 
       
  1340    ProtocolBuffer.Encoder.STRING,
       
  1341 
       
  1342   )
       
  1343 
       
  1344   _STYLE = """"""
       
  1345   _STYLE_CONTENT_TYPE = """"""
       
  1346 class GetResponse_Entity(ProtocolBuffer.ProtocolMessage):
       
  1347   def __init__(self, contents=None):
       
  1348     self.entity_ = None
       
  1349     self.has_entity_ = 0
       
  1350     self.lazy_init_lock_ = thread.allocate_lock()
       
  1351     if contents is not None: self.MergeFromString(contents)
       
  1352 
       
  1353   def entity(self):
       
  1354     if self.entity_ is None:
       
  1355       self.lazy_init_lock_.acquire()
       
  1356       try:
       
  1357         if self.entity_ is None: self.entity_ = EntityProto()
       
  1358       finally:
       
  1359         self.lazy_init_lock_.release()
       
  1360     return self.entity_
       
  1361 
       
  1362   def mutable_entity(self): self.has_entity_ = 1; return self.entity()
       
  1363 
       
  1364   def clear_entity(self):
       
  1365     self.has_entity_ = 0;
       
  1366     if self.entity_ is not None: self.entity_.Clear()
       
  1367 
       
  1368   def has_entity(self): return self.has_entity_
       
  1369 
       
  1370 
       
  1371   def MergeFrom(self, x):
       
  1372     assert x is not self
       
  1373     if (x.has_entity()): self.mutable_entity().MergeFrom(x.entity())
       
  1374 
       
  1375   def Equals(self, x):
       
  1376     if x is self: return 1
       
  1377     if self.has_entity_ != x.has_entity_: return 0
       
  1378     if self.has_entity_ and self.entity_ != x.entity_: return 0
       
  1379     return 1
       
  1380 
       
  1381   def __eq__(self, other):
       
  1382     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1383 
       
  1384   def __ne__(self, other):
       
  1385     return not (self == other)
       
  1386 
       
  1387   def IsInitialized(self, debug_strs=None):
       
  1388     initialized = 1
       
  1389     if (self.has_entity_ and not self.entity_.IsInitialized(debug_strs)): initialized = 0
       
  1390     return initialized
       
  1391 
       
  1392   def ByteSize(self):
       
  1393     n = 0
       
  1394     if (self.has_entity_): n += 1 + self.lengthString(self.entity_.ByteSize())
       
  1395     return n + 0
       
  1396 
       
  1397   def Clear(self):
       
  1398     self.clear_entity()
       
  1399 
       
  1400   def OutputUnchecked(self, out):
       
  1401     if (self.has_entity_):
       
  1402       out.putVarInt32(18)
       
  1403       out.putVarInt32(self.entity_.ByteSize())
       
  1404       self.entity_.OutputUnchecked(out)
       
  1405 
       
  1406   def TryMerge(self, d):
       
  1407     while 1:
       
  1408       tt = d.getVarInt32()
       
  1409       if tt == 12: break
       
  1410       if tt == 18:
       
  1411         length = d.getVarInt32()
       
  1412         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1413         d.skip(length)
       
  1414         self.mutable_entity().TryMerge(tmp)
       
  1415         continue
       
  1416       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1417       d.skipData(tt)
       
  1418 
       
  1419 
       
  1420   def __str__(self, prefix="", printElemNumber=0):
       
  1421     res=""
       
  1422     if self.has_entity_:
       
  1423       res+=prefix+"entity <\n"
       
  1424       res+=self.entity_.__str__(prefix + "  ", printElemNumber)
       
  1425       res+=prefix+">\n"
       
  1426     return res
       
  1427 
       
  1428 class GetResponse(ProtocolBuffer.ProtocolMessage):
       
  1429   def __init__(self, contents=None):
       
  1430     self.entity_ = []
       
  1431     if contents is not None: self.MergeFromString(contents)
       
  1432 
       
  1433   def entity_size(self): return len(self.entity_)
       
  1434   def entity_list(self): return self.entity_
       
  1435 
       
  1436   def entity(self, i):
       
  1437     return self.entity_[i]
       
  1438 
       
  1439   def mutable_entity(self, i):
       
  1440     return self.entity_[i]
       
  1441 
       
  1442   def add_entity(self):
       
  1443     x = GetResponse_Entity()
       
  1444     self.entity_.append(x)
       
  1445     return x
       
  1446 
       
  1447   def clear_entity(self):
       
  1448     self.entity_ = []
       
  1449 
       
  1450   def MergeFrom(self, x):
       
  1451     assert x is not self
       
  1452     for i in xrange(x.entity_size()): self.add_entity().CopyFrom(x.entity(i))
       
  1453 
       
  1454   def Equals(self, x):
       
  1455     if x is self: return 1
       
  1456     if len(self.entity_) != len(x.entity_): return 0
       
  1457     for e1, e2 in zip(self.entity_, x.entity_):
       
  1458       if e1 != e2: return 0
       
  1459     return 1
       
  1460 
       
  1461   def __eq__(self, other):
       
  1462     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1463 
       
  1464   def __ne__(self, other):
       
  1465     return not (self == other)
       
  1466 
       
  1467   def IsInitialized(self, debug_strs=None):
       
  1468     initialized = 1
       
  1469     for i in xrange(len(self.entity_)):
       
  1470       if (not self.entity_[i].IsInitialized(debug_strs)): initialized=0
       
  1471     return initialized
       
  1472 
       
  1473   def ByteSize(self):
       
  1474     n = 0
       
  1475     n += 2 * len(self.entity_)
       
  1476     for i in xrange(len(self.entity_)): n += self.entity_[i].ByteSize()
       
  1477     return n + 0
       
  1478 
       
  1479   def Clear(self):
       
  1480     self.clear_entity()
       
  1481 
       
  1482   def OutputUnchecked(self, out):
       
  1483     for i in xrange(len(self.entity_)):
       
  1484       out.putVarInt32(11)
       
  1485       self.entity_[i].OutputUnchecked(out)
       
  1486       out.putVarInt32(12)
       
  1487 
       
  1488   def TryMerge(self, d):
       
  1489     while d.avail() > 0:
       
  1490       tt = d.getVarInt32()
       
  1491       if tt == 11:
       
  1492         self.add_entity().TryMerge(d)
       
  1493         continue
       
  1494       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1495       d.skipData(tt)
       
  1496 
       
  1497 
       
  1498   def __str__(self, prefix="", printElemNumber=0):
       
  1499     res=""
       
  1500     cnt=0
       
  1501     for e in self.entity_:
       
  1502       elm=""
       
  1503       if printElemNumber: elm="(%d)" % cnt
       
  1504       res+=prefix+("Entity%s {\n" % elm)
       
  1505       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1506       res+=prefix+"}\n"
       
  1507       cnt+=1
       
  1508     return res
       
  1509 
       
  1510   kEntityGroup = 1
       
  1511   kEntityentity = 2
       
  1512 
       
  1513   _TEXT = (
       
  1514    "ErrorCode",
       
  1515    "Entity",
       
  1516    "entity",
       
  1517   )
       
  1518 
       
  1519   _TYPES = (
       
  1520    ProtocolBuffer.Encoder.NUMERIC,
       
  1521    ProtocolBuffer.Encoder.STARTGROUP,
       
  1522 
       
  1523    ProtocolBuffer.Encoder.STRING,
       
  1524 
       
  1525   )
       
  1526 
       
  1527   _STYLE = """"""
       
  1528   _STYLE_CONTENT_TYPE = """"""
       
  1529 class PutRequest(ProtocolBuffer.ProtocolMessage):
       
  1530   def __init__(self, contents=None):
       
  1531     self.entity_ = []
       
  1532     self.transaction_ = None
       
  1533     self.composite_index_ = []
       
  1534     self.has_transaction_ = 0
       
  1535     self.lazy_init_lock_ = thread.allocate_lock()
       
  1536     if contents is not None: self.MergeFromString(contents)
       
  1537 
       
  1538   def entity_size(self): return len(self.entity_)
       
  1539   def entity_list(self): return self.entity_
       
  1540 
       
  1541   def entity(self, i):
       
  1542     return self.entity_[i]
       
  1543 
       
  1544   def mutable_entity(self, i):
       
  1545     return self.entity_[i]
       
  1546 
       
  1547   def add_entity(self):
       
  1548     x = EntityProto()
       
  1549     self.entity_.append(x)
       
  1550     return x
       
  1551 
       
  1552   def clear_entity(self):
       
  1553     self.entity_ = []
       
  1554   def transaction(self):
       
  1555     if self.transaction_ is None:
       
  1556       self.lazy_init_lock_.acquire()
       
  1557       try:
       
  1558         if self.transaction_ is None: self.transaction_ = Transaction()
       
  1559       finally:
       
  1560         self.lazy_init_lock_.release()
       
  1561     return self.transaction_
       
  1562 
       
  1563   def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
       
  1564 
       
  1565   def clear_transaction(self):
       
  1566     self.has_transaction_ = 0;
       
  1567     if self.transaction_ is not None: self.transaction_.Clear()
       
  1568 
       
  1569   def has_transaction(self): return self.has_transaction_
       
  1570 
       
  1571   def composite_index_size(self): return len(self.composite_index_)
       
  1572   def composite_index_list(self): return self.composite_index_
       
  1573 
       
  1574   def composite_index(self, i):
       
  1575     return self.composite_index_[i]
       
  1576 
       
  1577   def mutable_composite_index(self, i):
       
  1578     return self.composite_index_[i]
       
  1579 
       
  1580   def add_composite_index(self):
       
  1581     x = CompositeIndex()
       
  1582     self.composite_index_.append(x)
       
  1583     return x
       
  1584 
       
  1585   def clear_composite_index(self):
       
  1586     self.composite_index_ = []
       
  1587 
       
  1588   def MergeFrom(self, x):
       
  1589     assert x is not self
       
  1590     for i in xrange(x.entity_size()): self.add_entity().CopyFrom(x.entity(i))
       
  1591     if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
       
  1592     for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
       
  1593 
       
  1594   def Equals(self, x):
       
  1595     if x is self: return 1
       
  1596     if len(self.entity_) != len(x.entity_): return 0
       
  1597     for e1, e2 in zip(self.entity_, x.entity_):
       
  1598       if e1 != e2: return 0
       
  1599     if self.has_transaction_ != x.has_transaction_: return 0
       
  1600     if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
       
  1601     if len(self.composite_index_) != len(x.composite_index_): return 0
       
  1602     for e1, e2 in zip(self.composite_index_, x.composite_index_):
       
  1603       if e1 != e2: return 0
       
  1604     return 1
       
  1605 
       
  1606   def __eq__(self, other):
       
  1607     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1608 
       
  1609   def __ne__(self, other):
       
  1610     return not (self == other)
       
  1611 
       
  1612   def IsInitialized(self, debug_strs=None):
       
  1613     initialized = 1
       
  1614     for i in xrange(len(self.entity_)):
       
  1615       if (not self.entity_[i].IsInitialized(debug_strs)): initialized=0
       
  1616     if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
       
  1617     for i in xrange(len(self.composite_index_)):
       
  1618       if (not self.composite_index_[i].IsInitialized(debug_strs)): initialized=0
       
  1619     return initialized
       
  1620 
       
  1621   def ByteSize(self):
       
  1622     n = 0
       
  1623     n += 1 * len(self.entity_)
       
  1624     for i in xrange(len(self.entity_)): n += self.lengthString(self.entity_[i].ByteSize())
       
  1625     if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
       
  1626     n += 1 * len(self.composite_index_)
       
  1627     for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
       
  1628     return n + 0
       
  1629 
       
  1630   def Clear(self):
       
  1631     self.clear_entity()
       
  1632     self.clear_transaction()
       
  1633     self.clear_composite_index()
       
  1634 
       
  1635   def OutputUnchecked(self, out):
       
  1636     for i in xrange(len(self.entity_)):
       
  1637       out.putVarInt32(10)
       
  1638       out.putVarInt32(self.entity_[i].ByteSize())
       
  1639       self.entity_[i].OutputUnchecked(out)
       
  1640     if (self.has_transaction_):
       
  1641       out.putVarInt32(18)
       
  1642       out.putVarInt32(self.transaction_.ByteSize())
       
  1643       self.transaction_.OutputUnchecked(out)
       
  1644     for i in xrange(len(self.composite_index_)):
       
  1645       out.putVarInt32(26)
       
  1646       out.putVarInt32(self.composite_index_[i].ByteSize())
       
  1647       self.composite_index_[i].OutputUnchecked(out)
       
  1648 
       
  1649   def TryMerge(self, d):
       
  1650     while d.avail() > 0:
       
  1651       tt = d.getVarInt32()
       
  1652       if tt == 10:
       
  1653         length = d.getVarInt32()
       
  1654         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1655         d.skip(length)
       
  1656         self.add_entity().TryMerge(tmp)
       
  1657         continue
       
  1658       if tt == 18:
       
  1659         length = d.getVarInt32()
       
  1660         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1661         d.skip(length)
       
  1662         self.mutable_transaction().TryMerge(tmp)
       
  1663         continue
       
  1664       if tt == 26:
       
  1665         length = d.getVarInt32()
       
  1666         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1667         d.skip(length)
       
  1668         self.add_composite_index().TryMerge(tmp)
       
  1669         continue
       
  1670       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1671       d.skipData(tt)
       
  1672 
       
  1673 
       
  1674   def __str__(self, prefix="", printElemNumber=0):
       
  1675     res=""
       
  1676     cnt=0
       
  1677     for e in self.entity_:
       
  1678       elm=""
       
  1679       if printElemNumber: elm="(%d)" % cnt
       
  1680       res+=prefix+("entity%s <\n" % elm)
       
  1681       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1682       res+=prefix+">\n"
       
  1683       cnt+=1
       
  1684     if self.has_transaction_:
       
  1685       res+=prefix+"transaction <\n"
       
  1686       res+=self.transaction_.__str__(prefix + "  ", printElemNumber)
       
  1687       res+=prefix+">\n"
       
  1688     cnt=0
       
  1689     for e in self.composite_index_:
       
  1690       elm=""
       
  1691       if printElemNumber: elm="(%d)" % cnt
       
  1692       res+=prefix+("composite_index%s <\n" % elm)
       
  1693       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1694       res+=prefix+">\n"
       
  1695       cnt+=1
       
  1696     return res
       
  1697 
       
  1698   kentity = 1
       
  1699   ktransaction = 2
       
  1700   kcomposite_index = 3
       
  1701 
       
  1702   _TEXT = (
       
  1703    "ErrorCode",
       
  1704    "entity",
       
  1705    "transaction",
       
  1706    "composite_index",
       
  1707   )
       
  1708 
       
  1709   _TYPES = (
       
  1710    ProtocolBuffer.Encoder.NUMERIC,
       
  1711    ProtocolBuffer.Encoder.STRING,
       
  1712 
       
  1713    ProtocolBuffer.Encoder.STRING,
       
  1714 
       
  1715    ProtocolBuffer.Encoder.STRING,
       
  1716 
       
  1717   )
       
  1718 
       
  1719   _STYLE = """"""
       
  1720   _STYLE_CONTENT_TYPE = """"""
       
  1721 class PutResponse(ProtocolBuffer.ProtocolMessage):
       
  1722   def __init__(self, contents=None):
       
  1723     self.key_ = []
       
  1724     if contents is not None: self.MergeFromString(contents)
       
  1725 
       
  1726   def key_size(self): return len(self.key_)
       
  1727   def key_list(self): return self.key_
       
  1728 
       
  1729   def key(self, i):
       
  1730     return self.key_[i]
       
  1731 
       
  1732   def mutable_key(self, i):
       
  1733     return self.key_[i]
       
  1734 
       
  1735   def add_key(self):
       
  1736     x = Reference()
       
  1737     self.key_.append(x)
       
  1738     return x
       
  1739 
       
  1740   def clear_key(self):
       
  1741     self.key_ = []
       
  1742 
       
  1743   def MergeFrom(self, x):
       
  1744     assert x is not self
       
  1745     for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
       
  1746 
       
  1747   def Equals(self, x):
       
  1748     if x is self: return 1
       
  1749     if len(self.key_) != len(x.key_): return 0
       
  1750     for e1, e2 in zip(self.key_, x.key_):
       
  1751       if e1 != e2: return 0
       
  1752     return 1
       
  1753 
       
  1754   def __eq__(self, other):
       
  1755     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1756 
       
  1757   def __ne__(self, other):
       
  1758     return not (self == other)
       
  1759 
       
  1760   def IsInitialized(self, debug_strs=None):
       
  1761     initialized = 1
       
  1762     for i in xrange(len(self.key_)):
       
  1763       if (not self.key_[i].IsInitialized(debug_strs)): initialized=0
       
  1764     return initialized
       
  1765 
       
  1766   def ByteSize(self):
       
  1767     n = 0
       
  1768     n += 1 * len(self.key_)
       
  1769     for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
       
  1770     return n + 0
       
  1771 
       
  1772   def Clear(self):
       
  1773     self.clear_key()
       
  1774 
       
  1775   def OutputUnchecked(self, out):
       
  1776     for i in xrange(len(self.key_)):
       
  1777       out.putVarInt32(10)
       
  1778       out.putVarInt32(self.key_[i].ByteSize())
       
  1779       self.key_[i].OutputUnchecked(out)
       
  1780 
       
  1781   def TryMerge(self, d):
       
  1782     while d.avail() > 0:
       
  1783       tt = d.getVarInt32()
       
  1784       if tt == 10:
       
  1785         length = d.getVarInt32()
       
  1786         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1787         d.skip(length)
       
  1788         self.add_key().TryMerge(tmp)
       
  1789         continue
       
  1790       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1791       d.skipData(tt)
       
  1792 
       
  1793 
       
  1794   def __str__(self, prefix="", printElemNumber=0):
       
  1795     res=""
       
  1796     cnt=0
       
  1797     for e in self.key_:
       
  1798       elm=""
       
  1799       if printElemNumber: elm="(%d)" % cnt
       
  1800       res+=prefix+("key%s <\n" % elm)
       
  1801       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1802       res+=prefix+">\n"
       
  1803       cnt+=1
       
  1804     return res
       
  1805 
       
  1806   kkey = 1
       
  1807 
       
  1808   _TEXT = (
       
  1809    "ErrorCode",
       
  1810    "key",
       
  1811   )
       
  1812 
       
  1813   _TYPES = (
       
  1814    ProtocolBuffer.Encoder.NUMERIC,
       
  1815    ProtocolBuffer.Encoder.STRING,
       
  1816 
       
  1817   )
       
  1818 
       
  1819   _STYLE = """"""
       
  1820   _STYLE_CONTENT_TYPE = """"""
       
  1821 class DeleteRequest(ProtocolBuffer.ProtocolMessage):
       
  1822   def __init__(self, contents=None):
       
  1823     self.key_ = []
       
  1824     self.transaction_ = None
       
  1825     self.has_transaction_ = 0
       
  1826     self.lazy_init_lock_ = thread.allocate_lock()
       
  1827     if contents is not None: self.MergeFromString(contents)
       
  1828 
       
  1829   def key_size(self): return len(self.key_)
       
  1830   def key_list(self): return self.key_
       
  1831 
       
  1832   def key(self, i):
       
  1833     return self.key_[i]
       
  1834 
       
  1835   def mutable_key(self, i):
       
  1836     return self.key_[i]
       
  1837 
       
  1838   def add_key(self):
       
  1839     x = Reference()
       
  1840     self.key_.append(x)
       
  1841     return x
       
  1842 
       
  1843   def clear_key(self):
       
  1844     self.key_ = []
       
  1845   def transaction(self):
       
  1846     if self.transaction_ is None:
       
  1847       self.lazy_init_lock_.acquire()
       
  1848       try:
       
  1849         if self.transaction_ is None: self.transaction_ = Transaction()
       
  1850       finally:
       
  1851         self.lazy_init_lock_.release()
       
  1852     return self.transaction_
       
  1853 
       
  1854   def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
       
  1855 
       
  1856   def clear_transaction(self):
       
  1857     self.has_transaction_ = 0;
       
  1858     if self.transaction_ is not None: self.transaction_.Clear()
       
  1859 
       
  1860   def has_transaction(self): return self.has_transaction_
       
  1861 
       
  1862 
       
  1863   def MergeFrom(self, x):
       
  1864     assert x is not self
       
  1865     for i in xrange(x.key_size()): self.add_key().CopyFrom(x.key(i))
       
  1866     if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
       
  1867 
       
  1868   def Equals(self, x):
       
  1869     if x is self: return 1
       
  1870     if len(self.key_) != len(x.key_): return 0
       
  1871     for e1, e2 in zip(self.key_, x.key_):
       
  1872       if e1 != e2: return 0
       
  1873     if self.has_transaction_ != x.has_transaction_: return 0
       
  1874     if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
       
  1875     return 1
       
  1876 
       
  1877   def __eq__(self, other):
       
  1878     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  1879 
       
  1880   def __ne__(self, other):
       
  1881     return not (self == other)
       
  1882 
       
  1883   def IsInitialized(self, debug_strs=None):
       
  1884     initialized = 1
       
  1885     for i in xrange(len(self.key_)):
       
  1886       if (not self.key_[i].IsInitialized(debug_strs)): initialized=0
       
  1887     if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
       
  1888     return initialized
       
  1889 
       
  1890   def ByteSize(self):
       
  1891     n = 0
       
  1892     n += 1 * len(self.key_)
       
  1893     for i in xrange(len(self.key_)): n += self.lengthString(self.key_[i].ByteSize())
       
  1894     if (self.has_transaction_): n += 1 + self.lengthString(self.transaction_.ByteSize())
       
  1895     return n + 0
       
  1896 
       
  1897   def Clear(self):
       
  1898     self.clear_key()
       
  1899     self.clear_transaction()
       
  1900 
       
  1901   def OutputUnchecked(self, out):
       
  1902     if (self.has_transaction_):
       
  1903       out.putVarInt32(42)
       
  1904       out.putVarInt32(self.transaction_.ByteSize())
       
  1905       self.transaction_.OutputUnchecked(out)
       
  1906     for i in xrange(len(self.key_)):
       
  1907       out.putVarInt32(50)
       
  1908       out.putVarInt32(self.key_[i].ByteSize())
       
  1909       self.key_[i].OutputUnchecked(out)
       
  1910 
       
  1911   def TryMerge(self, d):
       
  1912     while d.avail() > 0:
       
  1913       tt = d.getVarInt32()
       
  1914       if tt == 42:
       
  1915         length = d.getVarInt32()
       
  1916         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1917         d.skip(length)
       
  1918         self.mutable_transaction().TryMerge(tmp)
       
  1919         continue
       
  1920       if tt == 50:
       
  1921         length = d.getVarInt32()
       
  1922         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  1923         d.skip(length)
       
  1924         self.add_key().TryMerge(tmp)
       
  1925         continue
       
  1926       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  1927       d.skipData(tt)
       
  1928 
       
  1929 
       
  1930   def __str__(self, prefix="", printElemNumber=0):
       
  1931     res=""
       
  1932     cnt=0
       
  1933     for e in self.key_:
       
  1934       elm=""
       
  1935       if printElemNumber: elm="(%d)" % cnt
       
  1936       res+=prefix+("key%s <\n" % elm)
       
  1937       res+=e.__str__(prefix + "  ", printElemNumber)
       
  1938       res+=prefix+">\n"
       
  1939       cnt+=1
       
  1940     if self.has_transaction_:
       
  1941       res+=prefix+"transaction <\n"
       
  1942       res+=self.transaction_.__str__(prefix + "  ", printElemNumber)
       
  1943       res+=prefix+">\n"
       
  1944     return res
       
  1945 
       
  1946   kkey = 6
       
  1947   ktransaction = 5
       
  1948 
       
  1949   _TEXT = (
       
  1950    "ErrorCode",
       
  1951    None,
       
  1952    None,
       
  1953    None,
       
  1954    None,
       
  1955    "transaction",
       
  1956    "key",
       
  1957   )
       
  1958 
       
  1959   _TYPES = (
       
  1960    ProtocolBuffer.Encoder.NUMERIC,
       
  1961    ProtocolBuffer.Encoder.MAX_TYPE,
       
  1962 
       
  1963    ProtocolBuffer.Encoder.MAX_TYPE,
       
  1964 
       
  1965    ProtocolBuffer.Encoder.MAX_TYPE,
       
  1966 
       
  1967    ProtocolBuffer.Encoder.MAX_TYPE,
       
  1968 
       
  1969    ProtocolBuffer.Encoder.STRING,
       
  1970 
       
  1971    ProtocolBuffer.Encoder.STRING,
       
  1972 
       
  1973   )
       
  1974 
       
  1975   _STYLE = """"""
       
  1976   _STYLE_CONTENT_TYPE = """"""
       
  1977 class NextRequest(ProtocolBuffer.ProtocolMessage):
       
  1978   def __init__(self, contents=None):
       
  1979     self.cursor_ = Cursor()
       
  1980     self.count_ = 1
       
  1981     self.has_cursor_ = 0
       
  1982     self.has_count_ = 0
       
  1983     if contents is not None: self.MergeFromString(contents)
       
  1984 
       
  1985   def cursor(self): return self.cursor_
       
  1986 
       
  1987   def mutable_cursor(self): self.has_cursor_ = 1; return self.cursor_
       
  1988 
       
  1989   def clear_cursor(self):self.has_cursor_ = 0; self.cursor_.Clear()
       
  1990 
       
  1991   def has_cursor(self): return self.has_cursor_
       
  1992 
       
  1993   def count(self): return self.count_
       
  1994 
       
  1995   def set_count(self, x):
       
  1996     self.has_count_ = 1
       
  1997     self.count_ = x
       
  1998 
       
  1999   def clear_count(self):
       
  2000     self.has_count_ = 0
       
  2001     self.count_ = 1
       
  2002 
       
  2003   def has_count(self): return self.has_count_
       
  2004 
       
  2005 
       
  2006   def MergeFrom(self, x):
       
  2007     assert x is not self
       
  2008     if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor())
       
  2009     if (x.has_count()): self.set_count(x.count())
       
  2010 
       
  2011   def Equals(self, x):
       
  2012     if x is self: return 1
       
  2013     if self.has_cursor_ != x.has_cursor_: return 0
       
  2014     if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
       
  2015     if self.has_count_ != x.has_count_: return 0
       
  2016     if self.has_count_ and self.count_ != x.count_: return 0
       
  2017     return 1
       
  2018 
       
  2019   def __eq__(self, other):
       
  2020     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  2021 
       
  2022   def __ne__(self, other):
       
  2023     return not (self == other)
       
  2024 
       
  2025   def IsInitialized(self, debug_strs=None):
       
  2026     initialized = 1
       
  2027     if (not self.has_cursor_):
       
  2028       initialized = 0
       
  2029       if debug_strs is not None:
       
  2030         debug_strs.append('Required field: cursor not set.')
       
  2031     elif not self.cursor_.IsInitialized(debug_strs): initialized = 0
       
  2032     return initialized
       
  2033 
       
  2034   def ByteSize(self):
       
  2035     n = 0
       
  2036     n += self.lengthString(self.cursor_.ByteSize())
       
  2037     if (self.has_count_): n += 1 + self.lengthVarInt64(self.count_)
       
  2038     return n + 1
       
  2039 
       
  2040   def Clear(self):
       
  2041     self.clear_cursor()
       
  2042     self.clear_count()
       
  2043 
       
  2044   def OutputUnchecked(self, out):
       
  2045     out.putVarInt32(10)
       
  2046     out.putVarInt32(self.cursor_.ByteSize())
       
  2047     self.cursor_.OutputUnchecked(out)
       
  2048     if (self.has_count_):
       
  2049       out.putVarInt32(16)
       
  2050       out.putVarInt32(self.count_)
       
  2051 
       
  2052   def TryMerge(self, d):
       
  2053     while d.avail() > 0:
       
  2054       tt = d.getVarInt32()
       
  2055       if tt == 10:
       
  2056         length = d.getVarInt32()
       
  2057         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  2058         d.skip(length)
       
  2059         self.mutable_cursor().TryMerge(tmp)
       
  2060         continue
       
  2061       if tt == 16:
       
  2062         self.set_count(d.getVarInt32())
       
  2063         continue
       
  2064       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  2065       d.skipData(tt)
       
  2066 
       
  2067 
       
  2068   def __str__(self, prefix="", printElemNumber=0):
       
  2069     res=""
       
  2070     if self.has_cursor_:
       
  2071       res+=prefix+"cursor <\n"
       
  2072       res+=self.cursor_.__str__(prefix + "  ", printElemNumber)
       
  2073       res+=prefix+">\n"
       
  2074     if self.has_count_: res+=prefix+("count: %s\n" % self.DebugFormatInt32(self.count_))
       
  2075     return res
       
  2076 
       
  2077   kcursor = 1
       
  2078   kcount = 2
       
  2079 
       
  2080   _TEXT = (
       
  2081    "ErrorCode",
       
  2082    "cursor",
       
  2083    "count",
       
  2084   )
       
  2085 
       
  2086   _TYPES = (
       
  2087    ProtocolBuffer.Encoder.NUMERIC,
       
  2088    ProtocolBuffer.Encoder.STRING,
       
  2089 
       
  2090    ProtocolBuffer.Encoder.NUMERIC,
       
  2091 
       
  2092   )
       
  2093 
       
  2094   _STYLE = """"""
       
  2095   _STYLE_CONTENT_TYPE = """"""
       
  2096 class QueryResult(ProtocolBuffer.ProtocolMessage):
       
  2097   def __init__(self, contents=None):
       
  2098     self.cursor_ = None
       
  2099     self.result_ = []
       
  2100     self.more_results_ = 0
       
  2101     self.has_cursor_ = 0
       
  2102     self.has_more_results_ = 0
       
  2103     self.lazy_init_lock_ = thread.allocate_lock()
       
  2104     if contents is not None: self.MergeFromString(contents)
       
  2105 
       
  2106   def cursor(self):
       
  2107     if self.cursor_ is None:
       
  2108       self.lazy_init_lock_.acquire()
       
  2109       try:
       
  2110         if self.cursor_ is None: self.cursor_ = Cursor()
       
  2111       finally:
       
  2112         self.lazy_init_lock_.release()
       
  2113     return self.cursor_
       
  2114 
       
  2115   def mutable_cursor(self): self.has_cursor_ = 1; return self.cursor()
       
  2116 
       
  2117   def clear_cursor(self):
       
  2118     self.has_cursor_ = 0;
       
  2119     if self.cursor_ is not None: self.cursor_.Clear()
       
  2120 
       
  2121   def has_cursor(self): return self.has_cursor_
       
  2122 
       
  2123   def result_size(self): return len(self.result_)
       
  2124   def result_list(self): return self.result_
       
  2125 
       
  2126   def result(self, i):
       
  2127     return self.result_[i]
       
  2128 
       
  2129   def mutable_result(self, i):
       
  2130     return self.result_[i]
       
  2131 
       
  2132   def add_result(self):
       
  2133     x = EntityProto()
       
  2134     self.result_.append(x)
       
  2135     return x
       
  2136 
       
  2137   def clear_result(self):
       
  2138     self.result_ = []
       
  2139   def more_results(self): return self.more_results_
       
  2140 
       
  2141   def set_more_results(self, x):
       
  2142     self.has_more_results_ = 1
       
  2143     self.more_results_ = x
       
  2144 
       
  2145   def clear_more_results(self):
       
  2146     self.has_more_results_ = 0
       
  2147     self.more_results_ = 0
       
  2148 
       
  2149   def has_more_results(self): return self.has_more_results_
       
  2150 
       
  2151 
       
  2152   def MergeFrom(self, x):
       
  2153     assert x is not self
       
  2154     if (x.has_cursor()): self.mutable_cursor().MergeFrom(x.cursor())
       
  2155     for i in xrange(x.result_size()): self.add_result().CopyFrom(x.result(i))
       
  2156     if (x.has_more_results()): self.set_more_results(x.more_results())
       
  2157 
       
  2158   def Equals(self, x):
       
  2159     if x is self: return 1
       
  2160     if self.has_cursor_ != x.has_cursor_: return 0
       
  2161     if self.has_cursor_ and self.cursor_ != x.cursor_: return 0
       
  2162     if len(self.result_) != len(x.result_): return 0
       
  2163     for e1, e2 in zip(self.result_, x.result_):
       
  2164       if e1 != e2: return 0
       
  2165     if self.has_more_results_ != x.has_more_results_: return 0
       
  2166     if self.has_more_results_ and self.more_results_ != x.more_results_: return 0
       
  2167     return 1
       
  2168 
       
  2169   def __eq__(self, other):
       
  2170     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  2171 
       
  2172   def __ne__(self, other):
       
  2173     return not (self == other)
       
  2174 
       
  2175   def IsInitialized(self, debug_strs=None):
       
  2176     initialized = 1
       
  2177     if (self.has_cursor_ and not self.cursor_.IsInitialized(debug_strs)): initialized = 0
       
  2178     for i in xrange(len(self.result_)):
       
  2179       if (not self.result_[i].IsInitialized(debug_strs)): initialized=0
       
  2180     if (not self.has_more_results_):
       
  2181       initialized = 0
       
  2182       if debug_strs is not None:
       
  2183         debug_strs.append('Required field: more_results not set.')
       
  2184     return initialized
       
  2185 
       
  2186   def ByteSize(self):
       
  2187     n = 0
       
  2188     if (self.has_cursor_): n += 1 + self.lengthString(self.cursor_.ByteSize())
       
  2189     n += 1 * len(self.result_)
       
  2190     for i in xrange(len(self.result_)): n += self.lengthString(self.result_[i].ByteSize())
       
  2191     return n + 2
       
  2192 
       
  2193   def Clear(self):
       
  2194     self.clear_cursor()
       
  2195     self.clear_result()
       
  2196     self.clear_more_results()
       
  2197 
       
  2198   def OutputUnchecked(self, out):
       
  2199     if (self.has_cursor_):
       
  2200       out.putVarInt32(10)
       
  2201       out.putVarInt32(self.cursor_.ByteSize())
       
  2202       self.cursor_.OutputUnchecked(out)
       
  2203     for i in xrange(len(self.result_)):
       
  2204       out.putVarInt32(18)
       
  2205       out.putVarInt32(self.result_[i].ByteSize())
       
  2206       self.result_[i].OutputUnchecked(out)
       
  2207     out.putVarInt32(24)
       
  2208     out.putBoolean(self.more_results_)
       
  2209 
       
  2210   def TryMerge(self, d):
       
  2211     while d.avail() > 0:
       
  2212       tt = d.getVarInt32()
       
  2213       if tt == 10:
       
  2214         length = d.getVarInt32()
       
  2215         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  2216         d.skip(length)
       
  2217         self.mutable_cursor().TryMerge(tmp)
       
  2218         continue
       
  2219       if tt == 18:
       
  2220         length = d.getVarInt32()
       
  2221         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  2222         d.skip(length)
       
  2223         self.add_result().TryMerge(tmp)
       
  2224         continue
       
  2225       if tt == 24:
       
  2226         self.set_more_results(d.getBoolean())
       
  2227         continue
       
  2228       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  2229       d.skipData(tt)
       
  2230 
       
  2231 
       
  2232   def __str__(self, prefix="", printElemNumber=0):
       
  2233     res=""
       
  2234     if self.has_cursor_:
       
  2235       res+=prefix+"cursor <\n"
       
  2236       res+=self.cursor_.__str__(prefix + "  ", printElemNumber)
       
  2237       res+=prefix+">\n"
       
  2238     cnt=0
       
  2239     for e in self.result_:
       
  2240       elm=""
       
  2241       if printElemNumber: elm="(%d)" % cnt
       
  2242       res+=prefix+("result%s <\n" % elm)
       
  2243       res+=e.__str__(prefix + "  ", printElemNumber)
       
  2244       res+=prefix+">\n"
       
  2245       cnt+=1
       
  2246     if self.has_more_results_: res+=prefix+("more_results: %s\n" % self.DebugFormatBool(self.more_results_))
       
  2247     return res
       
  2248 
       
  2249   kcursor = 1
       
  2250   kresult = 2
       
  2251   kmore_results = 3
       
  2252 
       
  2253   _TEXT = (
       
  2254    "ErrorCode",
       
  2255    "cursor",
       
  2256    "result",
       
  2257    "more_results",
       
  2258   )
       
  2259 
       
  2260   _TYPES = (
       
  2261    ProtocolBuffer.Encoder.NUMERIC,
       
  2262    ProtocolBuffer.Encoder.STRING,
       
  2263 
       
  2264    ProtocolBuffer.Encoder.STRING,
       
  2265 
       
  2266    ProtocolBuffer.Encoder.NUMERIC,
       
  2267 
       
  2268   )
       
  2269 
       
  2270   _STYLE = """"""
       
  2271   _STYLE_CONTENT_TYPE = """"""
       
  2272 class Schema(ProtocolBuffer.ProtocolMessage):
       
  2273   def __init__(self, contents=None):
       
  2274     self.kind_ = []
       
  2275     if contents is not None: self.MergeFromString(contents)
       
  2276 
       
  2277   def kind_size(self): return len(self.kind_)
       
  2278   def kind_list(self): return self.kind_
       
  2279 
       
  2280   def kind(self, i):
       
  2281     return self.kind_[i]
       
  2282 
       
  2283   def mutable_kind(self, i):
       
  2284     return self.kind_[i]
       
  2285 
       
  2286   def add_kind(self):
       
  2287     x = EntityProto()
       
  2288     self.kind_.append(x)
       
  2289     return x
       
  2290 
       
  2291   def clear_kind(self):
       
  2292     self.kind_ = []
       
  2293 
       
  2294   def MergeFrom(self, x):
       
  2295     assert x is not self
       
  2296     for i in xrange(x.kind_size()): self.add_kind().CopyFrom(x.kind(i))
       
  2297 
       
  2298   def Equals(self, x):
       
  2299     if x is self: return 1
       
  2300     if len(self.kind_) != len(x.kind_): return 0
       
  2301     for e1, e2 in zip(self.kind_, x.kind_):
       
  2302       if e1 != e2: return 0
       
  2303     return 1
       
  2304 
       
  2305   def __eq__(self, other):
       
  2306     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  2307 
       
  2308   def __ne__(self, other):
       
  2309     return not (self == other)
       
  2310 
       
  2311   def IsInitialized(self, debug_strs=None):
       
  2312     initialized = 1
       
  2313     for i in xrange(len(self.kind_)):
       
  2314       if (not self.kind_[i].IsInitialized(debug_strs)): initialized=0
       
  2315     return initialized
       
  2316 
       
  2317   def ByteSize(self):
       
  2318     n = 0
       
  2319     n += 1 * len(self.kind_)
       
  2320     for i in xrange(len(self.kind_)): n += self.lengthString(self.kind_[i].ByteSize())
       
  2321     return n + 0
       
  2322 
       
  2323   def Clear(self):
       
  2324     self.clear_kind()
       
  2325 
       
  2326   def OutputUnchecked(self, out):
       
  2327     for i in xrange(len(self.kind_)):
       
  2328       out.putVarInt32(10)
       
  2329       out.putVarInt32(self.kind_[i].ByteSize())
       
  2330       self.kind_[i].OutputUnchecked(out)
       
  2331 
       
  2332   def TryMerge(self, d):
       
  2333     while d.avail() > 0:
       
  2334       tt = d.getVarInt32()
       
  2335       if tt == 10:
       
  2336         length = d.getVarInt32()
       
  2337         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  2338         d.skip(length)
       
  2339         self.add_kind().TryMerge(tmp)
       
  2340         continue
       
  2341       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  2342       d.skipData(tt)
       
  2343 
       
  2344 
       
  2345   def __str__(self, prefix="", printElemNumber=0):
       
  2346     res=""
       
  2347     cnt=0
       
  2348     for e in self.kind_:
       
  2349       elm=""
       
  2350       if printElemNumber: elm="(%d)" % cnt
       
  2351       res+=prefix+("kind%s <\n" % elm)
       
  2352       res+=e.__str__(prefix + "  ", printElemNumber)
       
  2353       res+=prefix+">\n"
       
  2354       cnt+=1
       
  2355     return res
       
  2356 
       
  2357   kkind = 1
       
  2358 
       
  2359   _TEXT = (
       
  2360    "ErrorCode",
       
  2361    "kind",
       
  2362   )
       
  2363 
       
  2364   _TYPES = (
       
  2365    ProtocolBuffer.Encoder.NUMERIC,
       
  2366    ProtocolBuffer.Encoder.STRING,
       
  2367 
       
  2368   )
       
  2369 
       
  2370   _STYLE = """"""
       
  2371   _STYLE_CONTENT_TYPE = """"""
       
  2372 class CompositeIndices(ProtocolBuffer.ProtocolMessage):
       
  2373   def __init__(self, contents=None):
       
  2374     self.index_ = []
       
  2375     if contents is not None: self.MergeFromString(contents)
       
  2376 
       
  2377   def index_size(self): return len(self.index_)
       
  2378   def index_list(self): return self.index_
       
  2379 
       
  2380   def index(self, i):
       
  2381     return self.index_[i]
       
  2382 
       
  2383   def mutable_index(self, i):
       
  2384     return self.index_[i]
       
  2385 
       
  2386   def add_index(self):
       
  2387     x = CompositeIndex()
       
  2388     self.index_.append(x)
       
  2389     return x
       
  2390 
       
  2391   def clear_index(self):
       
  2392     self.index_ = []
       
  2393 
       
  2394   def MergeFrom(self, x):
       
  2395     assert x is not self
       
  2396     for i in xrange(x.index_size()): self.add_index().CopyFrom(x.index(i))
       
  2397 
       
  2398   def Equals(self, x):
       
  2399     if x is self: return 1
       
  2400     if len(self.index_) != len(x.index_): return 0
       
  2401     for e1, e2 in zip(self.index_, x.index_):
       
  2402       if e1 != e2: return 0
       
  2403     return 1
       
  2404 
       
  2405   def __eq__(self, other):
       
  2406     return (other is not None) and (other.__class__ == self.__class__) and self.Equals(other)
       
  2407 
       
  2408   def __ne__(self, other):
       
  2409     return not (self == other)
       
  2410 
       
  2411   def IsInitialized(self, debug_strs=None):
       
  2412     initialized = 1
       
  2413     for i in xrange(len(self.index_)):
       
  2414       if (not self.index_[i].IsInitialized(debug_strs)): initialized=0
       
  2415     return initialized
       
  2416 
       
  2417   def ByteSize(self):
       
  2418     n = 0
       
  2419     n += 1 * len(self.index_)
       
  2420     for i in xrange(len(self.index_)): n += self.lengthString(self.index_[i].ByteSize())
       
  2421     return n + 0
       
  2422 
       
  2423   def Clear(self):
       
  2424     self.clear_index()
       
  2425 
       
  2426   def OutputUnchecked(self, out):
       
  2427     for i in xrange(len(self.index_)):
       
  2428       out.putVarInt32(10)
       
  2429       out.putVarInt32(self.index_[i].ByteSize())
       
  2430       self.index_[i].OutputUnchecked(out)
       
  2431 
       
  2432   def TryMerge(self, d):
       
  2433     while d.avail() > 0:
       
  2434       tt = d.getVarInt32()
       
  2435       if tt == 10:
       
  2436         length = d.getVarInt32()
       
  2437         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
  2438         d.skip(length)
       
  2439         self.add_index().TryMerge(tmp)
       
  2440         continue
       
  2441       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
       
  2442       d.skipData(tt)
       
  2443 
       
  2444 
       
  2445   def __str__(self, prefix="", printElemNumber=0):
       
  2446     res=""
       
  2447     cnt=0
       
  2448     for e in self.index_:
       
  2449       elm=""
       
  2450       if printElemNumber: elm="(%d)" % cnt
       
  2451       res+=prefix+("index%s <\n" % elm)
       
  2452       res+=e.__str__(prefix + "  ", printElemNumber)
       
  2453       res+=prefix+">\n"
       
  2454       cnt+=1
       
  2455     return res
       
  2456 
       
  2457   kindex = 1
       
  2458 
       
  2459   _TEXT = (
       
  2460    "ErrorCode",
       
  2461    "index",
       
  2462   )
       
  2463 
       
  2464   _TYPES = (
       
  2465    ProtocolBuffer.Encoder.NUMERIC,
       
  2466    ProtocolBuffer.Encoder.STRING,
       
  2467 
       
  2468   )
       
  2469 
       
  2470   _STYLE = """"""
       
  2471   _STYLE_CONTENT_TYPE = """"""
       
  2472 
       
  2473 __all__ = ['Transaction','Query','Query_Filter','Query_Order','QueryExplanation','Cursor','Error','GetRequest','GetResponse','GetResponse_Entity','PutRequest','PutResponse','DeleteRequest','NextRequest','QueryResult','Schema','CompositeIndices']