thirdparty/google_appengine/google/appengine/datastore/datastore_pb.py
changeset 2413 d0b7dac5325c
parent 2309 be1b94099f2d
child 2864 2e0b0af889be
equal deleted inserted replaced
2412:c61d96e72e6f 2413:d0b7dac5325c
   380   limit_ = 0
   380   limit_ = 0
   381   has_require_perfect_plan_ = 0
   381   has_require_perfect_plan_ = 0
   382   require_perfect_plan_ = 0
   382   require_perfect_plan_ = 0
   383   has_keys_only_ = 0
   383   has_keys_only_ = 0
   384   keys_only_ = 0
   384   keys_only_ = 0
       
   385   has_transaction_ = 0
       
   386   transaction_ = None
   385 
   387 
   386   def __init__(self, contents=None):
   388   def __init__(self, contents=None):
   387     self.filter_ = []
   389     self.filter_ = []
   388     self.order_ = []
   390     self.order_ = []
   389     self.composite_index_ = []
   391     self.composite_index_ = []
   557     if self.has_keys_only_:
   559     if self.has_keys_only_:
   558       self.has_keys_only_ = 0
   560       self.has_keys_only_ = 0
   559       self.keys_only_ = 0
   561       self.keys_only_ = 0
   560 
   562 
   561   def has_keys_only(self): return self.has_keys_only_
   563   def has_keys_only(self): return self.has_keys_only_
       
   564 
       
   565   def transaction(self):
       
   566     if self.transaction_ is None:
       
   567       self.lazy_init_lock_.acquire()
       
   568       try:
       
   569         if self.transaction_ is None: self.transaction_ = Transaction()
       
   570       finally:
       
   571         self.lazy_init_lock_.release()
       
   572     return self.transaction_
       
   573 
       
   574   def mutable_transaction(self): self.has_transaction_ = 1; return self.transaction()
       
   575 
       
   576   def clear_transaction(self):
       
   577     if self.has_transaction_:
       
   578       self.has_transaction_ = 0;
       
   579       if self.transaction_ is not None: self.transaction_.Clear()
       
   580 
       
   581   def has_transaction(self): return self.has_transaction_
   562 
   582 
   563 
   583 
   564   def MergeFrom(self, x):
   584   def MergeFrom(self, x):
   565     assert x is not self
   585     assert x is not self
   566     if (x.has_app()): self.set_app(x.app())
   586     if (x.has_app()): self.set_app(x.app())
   573     if (x.has_offset()): self.set_offset(x.offset())
   593     if (x.has_offset()): self.set_offset(x.offset())
   574     if (x.has_limit()): self.set_limit(x.limit())
   594     if (x.has_limit()): self.set_limit(x.limit())
   575     for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
   595     for i in xrange(x.composite_index_size()): self.add_composite_index().CopyFrom(x.composite_index(i))
   576     if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan())
   596     if (x.has_require_perfect_plan()): self.set_require_perfect_plan(x.require_perfect_plan())
   577     if (x.has_keys_only()): self.set_keys_only(x.keys_only())
   597     if (x.has_keys_only()): self.set_keys_only(x.keys_only())
       
   598     if (x.has_transaction()): self.mutable_transaction().MergeFrom(x.transaction())
   578 
   599 
   579   def Equals(self, x):
   600   def Equals(self, x):
   580     if x is self: return 1
   601     if x is self: return 1
   581     if self.has_app_ != x.has_app_: return 0
   602     if self.has_app_ != x.has_app_: return 0
   582     if self.has_app_ and self.app_ != x.app_: return 0
   603     if self.has_app_ and self.app_ != x.app_: return 0
   603       if e1 != e2: return 0
   624       if e1 != e2: return 0
   604     if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0
   625     if self.has_require_perfect_plan_ != x.has_require_perfect_plan_: return 0
   605     if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0
   626     if self.has_require_perfect_plan_ and self.require_perfect_plan_ != x.require_perfect_plan_: return 0
   606     if self.has_keys_only_ != x.has_keys_only_: return 0
   627     if self.has_keys_only_ != x.has_keys_only_: return 0
   607     if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
   628     if self.has_keys_only_ and self.keys_only_ != x.keys_only_: return 0
       
   629     if self.has_transaction_ != x.has_transaction_: return 0
       
   630     if self.has_transaction_ and self.transaction_ != x.transaction_: return 0
   608     return 1
   631     return 1
   609 
   632 
   610   def IsInitialized(self, debug_strs=None):
   633   def IsInitialized(self, debug_strs=None):
   611     initialized = 1
   634     initialized = 1
   612     if (not self.has_app_):
   635     if (not self.has_app_):
   618       if not p.IsInitialized(debug_strs): initialized=0
   641       if not p.IsInitialized(debug_strs): initialized=0
   619     for p in self.order_:
   642     for p in self.order_:
   620       if not p.IsInitialized(debug_strs): initialized=0
   643       if not p.IsInitialized(debug_strs): initialized=0
   621     for p in self.composite_index_:
   644     for p in self.composite_index_:
   622       if not p.IsInitialized(debug_strs): initialized=0
   645       if not p.IsInitialized(debug_strs): initialized=0
       
   646     if (self.has_transaction_ and not self.transaction_.IsInitialized(debug_strs)): initialized = 0
   623     return initialized
   647     return initialized
   624 
   648 
   625   def ByteSize(self):
   649   def ByteSize(self):
   626     n = 0
   650     n = 0
   627     n += self.lengthString(len(self.app_))
   651     n += self.lengthString(len(self.app_))
   637     if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_)
   661     if (self.has_limit_): n += 2 + self.lengthVarInt64(self.limit_)
   638     n += 2 * len(self.composite_index_)
   662     n += 2 * len(self.composite_index_)
   639     for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
   663     for i in xrange(len(self.composite_index_)): n += self.lengthString(self.composite_index_[i].ByteSize())
   640     if (self.has_require_perfect_plan_): n += 3
   664     if (self.has_require_perfect_plan_): n += 3
   641     if (self.has_keys_only_): n += 3
   665     if (self.has_keys_only_): n += 3
       
   666     if (self.has_transaction_): n += 2 + self.lengthString(self.transaction_.ByteSize())
   642     return n + 1
   667     return n + 1
   643 
   668 
   644   def Clear(self):
   669   def Clear(self):
   645     self.clear_app()
   670     self.clear_app()
   646     self.clear_kind()
   671     self.clear_kind()
   652     self.clear_offset()
   677     self.clear_offset()
   653     self.clear_limit()
   678     self.clear_limit()
   654     self.clear_composite_index()
   679     self.clear_composite_index()
   655     self.clear_require_perfect_plan()
   680     self.clear_require_perfect_plan()
   656     self.clear_keys_only()
   681     self.clear_keys_only()
       
   682     self.clear_transaction()
   657 
   683 
   658   def OutputUnchecked(self, out):
   684   def OutputUnchecked(self, out):
   659     out.putVarInt32(10)
   685     out.putVarInt32(10)
   660     out.putPrefixedString(self.app_)
   686     out.putPrefixedString(self.app_)
   661     if (self.has_kind_):
   687     if (self.has_kind_):
   693       out.putVarInt32(160)
   719       out.putVarInt32(160)
   694       out.putBoolean(self.require_perfect_plan_)
   720       out.putBoolean(self.require_perfect_plan_)
   695     if (self.has_keys_only_):
   721     if (self.has_keys_only_):
   696       out.putVarInt32(168)
   722       out.putVarInt32(168)
   697       out.putBoolean(self.keys_only_)
   723       out.putBoolean(self.keys_only_)
       
   724     if (self.has_transaction_):
       
   725       out.putVarInt32(178)
       
   726       out.putVarInt32(self.transaction_.ByteSize())
       
   727       self.transaction_.OutputUnchecked(out)
   698 
   728 
   699   def TryMerge(self, d):
   729   def TryMerge(self, d):
   700     while d.avail() > 0:
   730     while d.avail() > 0:
   701       tt = d.getVarInt32()
   731       tt = d.getVarInt32()
   702       if tt == 10:
   732       if tt == 10:
   738       if tt == 160:
   768       if tt == 160:
   739         self.set_require_perfect_plan(d.getBoolean())
   769         self.set_require_perfect_plan(d.getBoolean())
   740         continue
   770         continue
   741       if tt == 168:
   771       if tt == 168:
   742         self.set_keys_only(d.getBoolean())
   772         self.set_keys_only(d.getBoolean())
       
   773         continue
       
   774       if tt == 178:
       
   775         length = d.getVarInt32()
       
   776         tmp = ProtocolBuffer.Decoder(d.buffer(), d.pos(), d.pos() + length)
       
   777         d.skip(length)
       
   778         self.mutable_transaction().TryMerge(tmp)
   743         continue
   779         continue
   744       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   780       if (tt == 0): raise ProtocolBuffer.ProtocolBufferDecodeError
   745       d.skipData(tt)
   781       d.skipData(tt)
   746 
   782 
   747 
   783 
   781       res+=e.__str__(prefix + "  ", printElemNumber)
   817       res+=e.__str__(prefix + "  ", printElemNumber)
   782       res+=prefix+">\n"
   818       res+=prefix+">\n"
   783       cnt+=1
   819       cnt+=1
   784     if self.has_require_perfect_plan_: res+=prefix+("require_perfect_plan: %s\n" % self.DebugFormatBool(self.require_perfect_plan_))
   820     if self.has_require_perfect_plan_: res+=prefix+("require_perfect_plan: %s\n" % self.DebugFormatBool(self.require_perfect_plan_))
   785     if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
   821     if self.has_keys_only_: res+=prefix+("keys_only: %s\n" % self.DebugFormatBool(self.keys_only_))
       
   822     if self.has_transaction_:
       
   823       res+=prefix+"transaction <\n"
       
   824       res+=self.transaction_.__str__(prefix + "  ", printElemNumber)
       
   825       res+=prefix+">\n"
   786     return res
   826     return res
   787 
   827 
   788   kapp = 1
   828   kapp = 1
   789   kkind = 3
   829   kkind = 3
   790   kancestor = 17
   830   kancestor = 17
   799   koffset = 12
   839   koffset = 12
   800   klimit = 16
   840   klimit = 16
   801   kcomposite_index = 19
   841   kcomposite_index = 19
   802   krequire_perfect_plan = 20
   842   krequire_perfect_plan = 20
   803   kkeys_only = 21
   843   kkeys_only = 21
       
   844   ktransaction = 22
   804 
   845 
   805   _TEXT = (
   846   _TEXT = (
   806    "ErrorCode",
   847    "ErrorCode",
   807    "app",
   848    "app",
   808    None,
   849    None,
   823    "ancestor",
   864    "ancestor",
   824    "hint",
   865    "hint",
   825    "composite_index",
   866    "composite_index",
   826    "require_perfect_plan",
   867    "require_perfect_plan",
   827    "keys_only",
   868    "keys_only",
       
   869    "transaction",
   828   )
   870   )
   829 
   871 
   830   _TYPES = (
   872   _TYPES = (
   831    ProtocolBuffer.Encoder.NUMERIC,
   873    ProtocolBuffer.Encoder.NUMERIC,
   832    ProtocolBuffer.Encoder.STRING,
   874    ProtocolBuffer.Encoder.STRING,
   868    ProtocolBuffer.Encoder.STRING,
   910    ProtocolBuffer.Encoder.STRING,
   869 
   911 
   870    ProtocolBuffer.Encoder.NUMERIC,
   912    ProtocolBuffer.Encoder.NUMERIC,
   871 
   913 
   872    ProtocolBuffer.Encoder.NUMERIC,
   914    ProtocolBuffer.Encoder.NUMERIC,
       
   915 
       
   916    ProtocolBuffer.Encoder.STRING,
   873 
   917 
   874   )
   918   )
   875 
   919 
   876   _STYLE = """"""
   920   _STYLE = """"""
   877   _STYLE_CONTENT_TYPE = """"""
   921   _STYLE_CONTENT_TYPE = """"""