3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from google
.net
.proto
import ProtocolBuffer
22 import dummy_thread
as thread
24 __pychecker__
= """maxreturns=0 maxbranches=0 no-callinit
25 unusednames=printElemNumber,debug_strs no-special"""
27 if hasattr(ProtocolBuffer
, 'ExtendableProtocolMessage'):
28 _extension_runtime
= True
29 _ExtendableProtocolMessage
= ProtocolBuffer
.ExtendableProtocolMessage
31 _extension_runtime
= False
32 _ExtendableProtocolMessage
= ProtocolBuffer
.ProtocolMessage
34 class MemcacheServiceError(ProtocolBuffer
.ProtocolMessage
):
46 1: "UNSPECIFIED_ERROR",
47 2: "NAMESPACE_NOT_SET",
48 3: "PERMISSION_DENIED",
53 def ErrorCode_Name(cls
, x
): return cls
._ErrorCode
_NAMES
.get(x
, "")
54 ErrorCode_Name
= classmethod(ErrorCode_Name
)
57 def __init__(self
, contents
=None):
59 if contents
is not None: self
.MergeFromString(contents
)
62 def MergeFrom(self
, x
):
66 if x
is self
: return 1
69 def IsInitialized(self
, debug_strs
=None):
77 def ByteSizePartial(self
):
84 def OutputUnchecked(self
, out
):
87 def OutputPartial(self
, out
):
90 def TryMerge(self
, d
):
95 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
99 def __str__(self
, prefix
="", printElemNumber
=0):
104 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
105 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
108 _TEXT
= _BuildTagLookupTable({
112 _TYPES
= _BuildTagLookupTable({
113 0: ProtocolBuffer
.Encoder
.NUMERIC
,
114 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
118 _STYLE_CONTENT_TYPE
= """"""
119 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheServiceError'
120 class AppOverride(ProtocolBuffer
.ProtocolMessage
):
123 has_num_memcacheg_backends_
= 0
124 num_memcacheg_backends_
= 0
125 has_ignore_shardlock_
= 0
126 ignore_shardlock_
= 0
127 has_memcache_pool_hint_
= 0
128 memcache_pool_hint_
= ""
129 has_memcache_sharding_strategy_
= 0
130 memcache_sharding_strategy_
= ""
132 def __init__(self
, contents
=None):
133 if contents
is not None: self
.MergeFromString(contents
)
135 def app_id(self
): return self
.app_id_
137 def set_app_id(self
, x
):
141 def clear_app_id(self
):
146 def has_app_id(self
): return self
.has_app_id_
148 def num_memcacheg_backends(self
): return self
.num_memcacheg_backends_
150 def set_num_memcacheg_backends(self
, x
):
151 self
.has_num_memcacheg_backends_
= 1
152 self
.num_memcacheg_backends_
= x
154 def clear_num_memcacheg_backends(self
):
155 if self
.has_num_memcacheg_backends_
:
156 self
.has_num_memcacheg_backends_
= 0
157 self
.num_memcacheg_backends_
= 0
159 def has_num_memcacheg_backends(self
): return self
.has_num_memcacheg_backends_
161 def ignore_shardlock(self
): return self
.ignore_shardlock_
163 def set_ignore_shardlock(self
, x
):
164 self
.has_ignore_shardlock_
= 1
165 self
.ignore_shardlock_
= x
167 def clear_ignore_shardlock(self
):
168 if self
.has_ignore_shardlock_
:
169 self
.has_ignore_shardlock_
= 0
170 self
.ignore_shardlock_
= 0
172 def has_ignore_shardlock(self
): return self
.has_ignore_shardlock_
174 def memcache_pool_hint(self
): return self
.memcache_pool_hint_
176 def set_memcache_pool_hint(self
, x
):
177 self
.has_memcache_pool_hint_
= 1
178 self
.memcache_pool_hint_
= x
180 def clear_memcache_pool_hint(self
):
181 if self
.has_memcache_pool_hint_
:
182 self
.has_memcache_pool_hint_
= 0
183 self
.memcache_pool_hint_
= ""
185 def has_memcache_pool_hint(self
): return self
.has_memcache_pool_hint_
187 def memcache_sharding_strategy(self
): return self
.memcache_sharding_strategy_
189 def set_memcache_sharding_strategy(self
, x
):
190 self
.has_memcache_sharding_strategy_
= 1
191 self
.memcache_sharding_strategy_
= x
193 def clear_memcache_sharding_strategy(self
):
194 if self
.has_memcache_sharding_strategy_
:
195 self
.has_memcache_sharding_strategy_
= 0
196 self
.memcache_sharding_strategy_
= ""
198 def has_memcache_sharding_strategy(self
): return self
.has_memcache_sharding_strategy_
201 def MergeFrom(self
, x
):
203 if (x
.has_app_id()): self
.set_app_id(x
.app_id())
204 if (x
.has_num_memcacheg_backends()): self
.set_num_memcacheg_backends(x
.num_memcacheg_backends())
205 if (x
.has_ignore_shardlock()): self
.set_ignore_shardlock(x
.ignore_shardlock())
206 if (x
.has_memcache_pool_hint()): self
.set_memcache_pool_hint(x
.memcache_pool_hint())
207 if (x
.has_memcache_sharding_strategy()): self
.set_memcache_sharding_strategy(x
.memcache_sharding_strategy())
210 if x
is self
: return 1
211 if self
.has_app_id_
!= x
.has_app_id_
: return 0
212 if self
.has_app_id_
and self
.app_id_
!= x
.app_id_
: return 0
213 if self
.has_num_memcacheg_backends_
!= x
.has_num_memcacheg_backends_
: return 0
214 if self
.has_num_memcacheg_backends_
and self
.num_memcacheg_backends_
!= x
.num_memcacheg_backends_
: return 0
215 if self
.has_ignore_shardlock_
!= x
.has_ignore_shardlock_
: return 0
216 if self
.has_ignore_shardlock_
and self
.ignore_shardlock_
!= x
.ignore_shardlock_
: return 0
217 if self
.has_memcache_pool_hint_
!= x
.has_memcache_pool_hint_
: return 0
218 if self
.has_memcache_pool_hint_
and self
.memcache_pool_hint_
!= x
.memcache_pool_hint_
: return 0
219 if self
.has_memcache_sharding_strategy_
!= x
.has_memcache_sharding_strategy_
: return 0
220 if self
.has_memcache_sharding_strategy_
and self
.memcache_sharding_strategy_
!= x
.memcache_sharding_strategy_
: return 0
223 def IsInitialized(self
, debug_strs
=None):
225 if (not self
.has_app_id_
):
227 if debug_strs
is not None:
228 debug_strs
.append('Required field: app_id not set.')
233 n
+= self
.lengthString(len(self
.app_id_
))
234 if (self
.has_num_memcacheg_backends_
): n
+= 1 + self
.lengthVarInt64(self
.num_memcacheg_backends_
)
235 if (self
.has_ignore_shardlock_
): n
+= 2
236 if (self
.has_memcache_pool_hint_
): n
+= 1 + self
.lengthString(len(self
.memcache_pool_hint_
))
237 if (self
.has_memcache_sharding_strategy_
): n
+= 1 + self
.lengthString(len(self
.memcache_sharding_strategy_
))
240 def ByteSizePartial(self
):
242 if (self
.has_app_id_
):
244 n
+= self
.lengthString(len(self
.app_id_
))
245 if (self
.has_num_memcacheg_backends_
): n
+= 1 + self
.lengthVarInt64(self
.num_memcacheg_backends_
)
246 if (self
.has_ignore_shardlock_
): n
+= 2
247 if (self
.has_memcache_pool_hint_
): n
+= 1 + self
.lengthString(len(self
.memcache_pool_hint_
))
248 if (self
.has_memcache_sharding_strategy_
): n
+= 1 + self
.lengthString(len(self
.memcache_sharding_strategy_
))
253 self
.clear_num_memcacheg_backends()
254 self
.clear_ignore_shardlock()
255 self
.clear_memcache_pool_hint()
256 self
.clear_memcache_sharding_strategy()
258 def OutputUnchecked(self
, out
):
260 out
.putPrefixedString(self
.app_id_
)
261 if (self
.has_num_memcacheg_backends_
):
263 out
.putVarInt32(self
.num_memcacheg_backends_
)
264 if (self
.has_ignore_shardlock_
):
266 out
.putBoolean(self
.ignore_shardlock_
)
267 if (self
.has_memcache_pool_hint_
):
269 out
.putPrefixedString(self
.memcache_pool_hint_
)
270 if (self
.has_memcache_sharding_strategy_
):
272 out
.putPrefixedString(self
.memcache_sharding_strategy_
)
274 def OutputPartial(self
, out
):
275 if (self
.has_app_id_
):
277 out
.putPrefixedString(self
.app_id_
)
278 if (self
.has_num_memcacheg_backends_
):
280 out
.putVarInt32(self
.num_memcacheg_backends_
)
281 if (self
.has_ignore_shardlock_
):
283 out
.putBoolean(self
.ignore_shardlock_
)
284 if (self
.has_memcache_pool_hint_
):
286 out
.putPrefixedString(self
.memcache_pool_hint_
)
287 if (self
.has_memcache_sharding_strategy_
):
289 out
.putPrefixedString(self
.memcache_sharding_strategy_
)
291 def TryMerge(self
, d
):
295 self
.set_app_id(d
.getPrefixedString())
298 self
.set_num_memcacheg_backends(d
.getVarInt32())
301 self
.set_ignore_shardlock(d
.getBoolean())
304 self
.set_memcache_pool_hint(d
.getPrefixedString())
307 self
.set_memcache_sharding_strategy(d
.getPrefixedString())
311 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
315 def __str__(self
, prefix
="", printElemNumber
=0):
317 if self
.has_app_id_
: res
+=prefix
+("app_id: %s\n" % self
.DebugFormatString(self
.app_id_
))
318 if self
.has_num_memcacheg_backends_
: res
+=prefix
+("num_memcacheg_backends: %s\n" % self
.DebugFormatInt32(self
.num_memcacheg_backends_
))
319 if self
.has_ignore_shardlock_
: res
+=prefix
+("ignore_shardlock: %s\n" % self
.DebugFormatBool(self
.ignore_shardlock_
))
320 if self
.has_memcache_pool_hint_
: res
+=prefix
+("memcache_pool_hint: %s\n" % self
.DebugFormatString(self
.memcache_pool_hint_
))
321 if self
.has_memcache_sharding_strategy_
: res
+=prefix
+("memcache_sharding_strategy: %s\n" % self
.DebugFormatString(self
.memcache_sharding_strategy_
))
325 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
326 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
329 knum_memcacheg_backends
= 2
330 kignore_shardlock
= 3
331 kmemcache_pool_hint
= 4
332 kmemcache_sharding_strategy
= 5
334 _TEXT
= _BuildTagLookupTable({
337 2: "num_memcacheg_backends",
338 3: "ignore_shardlock",
339 4: "memcache_pool_hint",
340 5: "memcache_sharding_strategy",
343 _TYPES
= _BuildTagLookupTable({
344 0: ProtocolBuffer
.Encoder
.NUMERIC
,
345 1: ProtocolBuffer
.Encoder
.STRING
,
346 2: ProtocolBuffer
.Encoder
.NUMERIC
,
347 3: ProtocolBuffer
.Encoder
.NUMERIC
,
348 4: ProtocolBuffer
.Encoder
.STRING
,
349 5: ProtocolBuffer
.Encoder
.STRING
,
350 }, 5, ProtocolBuffer
.Encoder
.MAX_TYPE
)
354 _STYLE_CONTENT_TYPE
= """"""
355 _PROTO_DESCRIPTOR_NAME
= 'apphosting.AppOverride'
356 class MemcacheGetRequest(ProtocolBuffer
.ProtocolMessage
):
364 def __init__(self
, contents
=None):
366 self
.lazy_init_lock_
= thread
.allocate_lock()
367 if contents
is not None: self
.MergeFromString(contents
)
369 def key_size(self
): return len(self
.key_
)
370 def key_list(self
): return self
.key_
375 def set_key(self
, i
, x
):
378 def add_key(self
, x
):
384 def name_space(self
): return self
.name_space_
386 def set_name_space(self
, x
):
387 self
.has_name_space_
= 1
390 def clear_name_space(self
):
391 if self
.has_name_space_
:
392 self
.has_name_space_
= 0
393 self
.name_space_
= ""
395 def has_name_space(self
): return self
.has_name_space_
397 def for_cas(self
): return self
.for_cas_
399 def set_for_cas(self
, x
):
400 self
.has_for_cas_
= 1
403 def clear_for_cas(self
):
404 if self
.has_for_cas_
:
405 self
.has_for_cas_
= 0
408 def has_for_cas(self
): return self
.has_for_cas_
411 if self
.override_
is None:
412 self
.lazy_init_lock_
.acquire()
414 if self
.override_
is None: self
.override_
= AppOverride()
416 self
.lazy_init_lock_
.release()
417 return self
.override_
419 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
421 def clear_override(self
):
423 if self
.has_override_
:
424 self
.has_override_
= 0;
425 if self
.override_
is not None: self
.override_
.Clear()
427 def has_override(self
): return self
.has_override_
430 def MergeFrom(self
, x
):
432 for i
in xrange(x
.key_size()): self
.add_key(x
.key(i
))
433 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
434 if (x
.has_for_cas()): self
.set_for_cas(x
.for_cas())
435 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
438 if x
is self
: return 1
439 if len(self
.key_
) != len(x
.key_
): return 0
440 for e1
, e2
in zip(self
.key_
, x
.key_
):
441 if e1
!= e2
: return 0
442 if self
.has_name_space_
!= x
.has_name_space_
: return 0
443 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
444 if self
.has_for_cas_
!= x
.has_for_cas_
: return 0
445 if self
.has_for_cas_
and self
.for_cas_
!= x
.for_cas_
: return 0
446 if self
.has_override_
!= x
.has_override_
: return 0
447 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
450 def IsInitialized(self
, debug_strs
=None):
452 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
457 n
+= 1 * len(self
.key_
)
458 for i
in xrange(len(self
.key_
)): n
+= self
.lengthString(len(self
.key_
[i
]))
459 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
460 if (self
.has_for_cas_
): n
+= 2
461 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
464 def ByteSizePartial(self
):
466 n
+= 1 * len(self
.key_
)
467 for i
in xrange(len(self
.key_
)): n
+= self
.lengthString(len(self
.key_
[i
]))
468 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
469 if (self
.has_for_cas_
): n
+= 2
470 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
475 self
.clear_name_space()
477 self
.clear_override()
479 def OutputUnchecked(self
, out
):
480 for i
in xrange(len(self
.key_
)):
482 out
.putPrefixedString(self
.key_
[i
])
483 if (self
.has_name_space_
):
485 out
.putPrefixedString(self
.name_space_
)
486 if (self
.has_for_cas_
):
488 out
.putBoolean(self
.for_cas_
)
489 if (self
.has_override_
):
491 out
.putVarInt32(self
.override_
.ByteSize())
492 self
.override_
.OutputUnchecked(out
)
494 def OutputPartial(self
, out
):
495 for i
in xrange(len(self
.key_
)):
497 out
.putPrefixedString(self
.key_
[i
])
498 if (self
.has_name_space_
):
500 out
.putPrefixedString(self
.name_space_
)
501 if (self
.has_for_cas_
):
503 out
.putBoolean(self
.for_cas_
)
504 if (self
.has_override_
):
506 out
.putVarInt32(self
.override_
.ByteSizePartial())
507 self
.override_
.OutputPartial(out
)
509 def TryMerge(self
, d
):
513 self
.add_key(d
.getPrefixedString())
516 self
.set_name_space(d
.getPrefixedString())
519 self
.set_for_cas(d
.getBoolean())
522 length
= d
.getVarInt32()
523 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
525 self
.mutable_override().TryMerge(tmp
)
529 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
533 def __str__(self
, prefix
="", printElemNumber
=0):
538 if printElemNumber
: elm
="(%d)" % cnt
539 res
+=prefix
+("key%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
541 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
542 if self
.has_for_cas_
: res
+=prefix
+("for_cas: %s\n" % self
.DebugFormatBool(self
.for_cas_
))
543 if self
.has_override_
:
544 res
+=prefix
+"override <\n"
545 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
550 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
551 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
558 _TEXT
= _BuildTagLookupTable({
566 _TYPES
= _BuildTagLookupTable({
567 0: ProtocolBuffer
.Encoder
.NUMERIC
,
568 1: ProtocolBuffer
.Encoder
.STRING
,
569 2: ProtocolBuffer
.Encoder
.STRING
,
570 4: ProtocolBuffer
.Encoder
.NUMERIC
,
571 5: ProtocolBuffer
.Encoder
.STRING
,
572 }, 5, ProtocolBuffer
.Encoder
.MAX_TYPE
)
576 _STYLE_CONTENT_TYPE
= """"""
577 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheGetRequest'
578 class MemcacheGetResponse_Item(ProtocolBuffer
.ProtocolMessage
):
587 has_expires_in_seconds_
= 0
588 expires_in_seconds_
= 0
590 def __init__(self
, contents
=None):
591 if contents
is not None: self
.MergeFromString(contents
)
593 def key(self
): return self
.key_
595 def set_key(self
, x
):
604 def has_key(self
): return self
.has_key_
606 def value(self
): return self
.value_
608 def set_value(self
, x
):
612 def clear_value(self
):
617 def has_value(self
): return self
.has_value_
619 def flags(self
): return self
.flags_
621 def set_flags(self
, x
):
625 def clear_flags(self
):
630 def has_flags(self
): return self
.has_flags_
632 def cas_id(self
): return self
.cas_id_
634 def set_cas_id(self
, x
):
638 def clear_cas_id(self
):
643 def has_cas_id(self
): return self
.has_cas_id_
645 def expires_in_seconds(self
): return self
.expires_in_seconds_
647 def set_expires_in_seconds(self
, x
):
648 self
.has_expires_in_seconds_
= 1
649 self
.expires_in_seconds_
= x
651 def clear_expires_in_seconds(self
):
652 if self
.has_expires_in_seconds_
:
653 self
.has_expires_in_seconds_
= 0
654 self
.expires_in_seconds_
= 0
656 def has_expires_in_seconds(self
): return self
.has_expires_in_seconds_
659 def MergeFrom(self
, x
):
661 if (x
.has_key()): self
.set_key(x
.key())
662 if (x
.has_value()): self
.set_value(x
.value())
663 if (x
.has_flags()): self
.set_flags(x
.flags())
664 if (x
.has_cas_id()): self
.set_cas_id(x
.cas_id())
665 if (x
.has_expires_in_seconds()): self
.set_expires_in_seconds(x
.expires_in_seconds())
668 if x
is self
: return 1
669 if self
.has_key_
!= x
.has_key_
: return 0
670 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
671 if self
.has_value_
!= x
.has_value_
: return 0
672 if self
.has_value_
and self
.value_
!= x
.value_
: return 0
673 if self
.has_flags_
!= x
.has_flags_
: return 0
674 if self
.has_flags_
and self
.flags_
!= x
.flags_
: return 0
675 if self
.has_cas_id_
!= x
.has_cas_id_
: return 0
676 if self
.has_cas_id_
and self
.cas_id_
!= x
.cas_id_
: return 0
677 if self
.has_expires_in_seconds_
!= x
.has_expires_in_seconds_
: return 0
678 if self
.has_expires_in_seconds_
and self
.expires_in_seconds_
!= x
.expires_in_seconds_
: return 0
681 def IsInitialized(self
, debug_strs
=None):
683 if (not self
.has_key_
):
685 if debug_strs
is not None:
686 debug_strs
.append('Required field: key not set.')
687 if (not self
.has_value_
):
689 if debug_strs
is not None:
690 debug_strs
.append('Required field: value not set.')
695 n
+= self
.lengthString(len(self
.key_
))
696 n
+= self
.lengthString(len(self
.value_
))
697 if (self
.has_flags_
): n
+= 5
698 if (self
.has_cas_id_
): n
+= 9
699 if (self
.has_expires_in_seconds_
): n
+= 1 + self
.lengthVarInt64(self
.expires_in_seconds_
)
702 def ByteSizePartial(self
):
706 n
+= self
.lengthString(len(self
.key_
))
707 if (self
.has_value_
):
709 n
+= self
.lengthString(len(self
.value_
))
710 if (self
.has_flags_
): n
+= 5
711 if (self
.has_cas_id_
): n
+= 9
712 if (self
.has_expires_in_seconds_
): n
+= 1 + self
.lengthVarInt64(self
.expires_in_seconds_
)
720 self
.clear_expires_in_seconds()
722 def OutputUnchecked(self
, out
):
724 out
.putPrefixedString(self
.key_
)
726 out
.putPrefixedString(self
.value_
)
727 if (self
.has_flags_
):
729 out
.put32(self
.flags_
)
730 if (self
.has_cas_id_
):
732 out
.put64(self
.cas_id_
)
733 if (self
.has_expires_in_seconds_
):
735 out
.putVarInt32(self
.expires_in_seconds_
)
737 def OutputPartial(self
, out
):
740 out
.putPrefixedString(self
.key_
)
741 if (self
.has_value_
):
743 out
.putPrefixedString(self
.value_
)
744 if (self
.has_flags_
):
746 out
.put32(self
.flags_
)
747 if (self
.has_cas_id_
):
749 out
.put64(self
.cas_id_
)
750 if (self
.has_expires_in_seconds_
):
752 out
.putVarInt32(self
.expires_in_seconds_
)
754 def TryMerge(self
, d
):
759 self
.set_key(d
.getPrefixedString())
762 self
.set_value(d
.getPrefixedString())
765 self
.set_flags(d
.get32())
768 self
.set_cas_id(d
.get64())
771 self
.set_expires_in_seconds(d
.getVarInt32())
775 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
779 def __str__(self
, prefix
="", printElemNumber
=0):
781 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
782 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
783 if self
.has_flags_
: res
+=prefix
+("flags: %s\n" % self
.DebugFormatFixed32(self
.flags_
))
784 if self
.has_cas_id_
: res
+=prefix
+("cas_id: %s\n" % self
.DebugFormatFixed64(self
.cas_id_
))
785 if self
.has_expires_in_seconds_
: res
+=prefix
+("expires_in_seconds: %s\n" % self
.DebugFormatInt32(self
.expires_in_seconds_
))
788 class MemcacheGetResponse(ProtocolBuffer
.ProtocolMessage
):
790 def __init__(self
, contents
=None):
792 if contents
is not None: self
.MergeFromString(contents
)
794 def item_size(self
): return len(self
.item_
)
795 def item_list(self
): return self
.item_
800 def mutable_item(self
, i
):
804 x
= MemcacheGetResponse_Item()
808 def clear_item(self
):
811 def MergeFrom(self
, x
):
813 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
816 if x
is self
: return 1
817 if len(self
.item_
) != len(x
.item_
): return 0
818 for e1
, e2
in zip(self
.item_
, x
.item_
):
819 if e1
!= e2
: return 0
822 def IsInitialized(self
, debug_strs
=None):
825 if not p
.IsInitialized(debug_strs
): initialized
=0
830 n
+= 2 * len(self
.item_
)
831 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
834 def ByteSizePartial(self
):
836 n
+= 2 * len(self
.item_
)
837 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSizePartial()
843 def OutputUnchecked(self
, out
):
844 for i
in xrange(len(self
.item_
)):
846 self
.item_
[i
].OutputUnchecked(out
)
849 def OutputPartial(self
, out
):
850 for i
in xrange(len(self
.item_
)):
852 self
.item_
[i
].OutputPartial(out
)
855 def TryMerge(self
, d
):
859 self
.add_item().TryMerge(d
)
863 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
867 def __str__(self
, prefix
="", printElemNumber
=0):
872 if printElemNumber
: elm
="(%d)" % cnt
873 res
+=prefix
+("Item%s {\n" % elm
)
874 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
880 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
881 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
888 kItemexpires_in_seconds
= 6
890 _TEXT
= _BuildTagLookupTable({
897 6: "expires_in_seconds",
900 _TYPES
= _BuildTagLookupTable({
901 0: ProtocolBuffer
.Encoder
.NUMERIC
,
902 1: ProtocolBuffer
.Encoder
.STARTGROUP
,
903 2: ProtocolBuffer
.Encoder
.STRING
,
904 3: ProtocolBuffer
.Encoder
.STRING
,
905 4: ProtocolBuffer
.Encoder
.FLOAT
,
906 5: ProtocolBuffer
.Encoder
.DOUBLE
,
907 6: ProtocolBuffer
.Encoder
.NUMERIC
,
908 }, 6, ProtocolBuffer
.Encoder
.MAX_TYPE
)
912 _STYLE_CONTENT_TYPE
= """"""
913 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheGetResponse'
914 class MemcacheSetRequest_Item(ProtocolBuffer
.ProtocolMessage
):
923 has_expiration_time_
= 0
930 def __init__(self
, contents
=None):
931 if contents
is not None: self
.MergeFromString(contents
)
933 def key(self
): return self
.key_
935 def set_key(self
, x
):
944 def has_key(self
): return self
.has_key_
946 def value(self
): return self
.value_
948 def set_value(self
, x
):
952 def clear_value(self
):
957 def has_value(self
): return self
.has_value_
959 def flags(self
): return self
.flags_
961 def set_flags(self
, x
):
965 def clear_flags(self
):
970 def has_flags(self
): return self
.has_flags_
972 def set_policy(self
): return self
.set_policy_
974 def set_set_policy(self
, x
):
975 self
.has_set_policy_
= 1
978 def clear_set_policy(self
):
979 if self
.has_set_policy_
:
980 self
.has_set_policy_
= 0
983 def has_set_policy(self
): return self
.has_set_policy_
985 def expiration_time(self
): return self
.expiration_time_
987 def set_expiration_time(self
, x
):
988 self
.has_expiration_time_
= 1
989 self
.expiration_time_
= x
991 def clear_expiration_time(self
):
992 if self
.has_expiration_time_
:
993 self
.has_expiration_time_
= 0
994 self
.expiration_time_
= 0
996 def has_expiration_time(self
): return self
.has_expiration_time_
998 def cas_id(self
): return self
.cas_id_
1000 def set_cas_id(self
, x
):
1001 self
.has_cas_id_
= 1
1004 def clear_cas_id(self
):
1005 if self
.has_cas_id_
:
1006 self
.has_cas_id_
= 0
1009 def has_cas_id(self
): return self
.has_cas_id_
1011 def for_cas(self
): return self
.for_cas_
1013 def set_for_cas(self
, x
):
1014 self
.has_for_cas_
= 1
1017 def clear_for_cas(self
):
1018 if self
.has_for_cas_
:
1019 self
.has_for_cas_
= 0
1022 def has_for_cas(self
): return self
.has_for_cas_
1025 def MergeFrom(self
, x
):
1026 assert x
is not self
1027 if (x
.has_key()): self
.set_key(x
.key())
1028 if (x
.has_value()): self
.set_value(x
.value())
1029 if (x
.has_flags()): self
.set_flags(x
.flags())
1030 if (x
.has_set_policy()): self
.set_set_policy(x
.set_policy())
1031 if (x
.has_expiration_time()): self
.set_expiration_time(x
.expiration_time())
1032 if (x
.has_cas_id()): self
.set_cas_id(x
.cas_id())
1033 if (x
.has_for_cas()): self
.set_for_cas(x
.for_cas())
1035 def Equals(self
, x
):
1036 if x
is self
: return 1
1037 if self
.has_key_
!= x
.has_key_
: return 0
1038 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
1039 if self
.has_value_
!= x
.has_value_
: return 0
1040 if self
.has_value_
and self
.value_
!= x
.value_
: return 0
1041 if self
.has_flags_
!= x
.has_flags_
: return 0
1042 if self
.has_flags_
and self
.flags_
!= x
.flags_
: return 0
1043 if self
.has_set_policy_
!= x
.has_set_policy_
: return 0
1044 if self
.has_set_policy_
and self
.set_policy_
!= x
.set_policy_
: return 0
1045 if self
.has_expiration_time_
!= x
.has_expiration_time_
: return 0
1046 if self
.has_expiration_time_
and self
.expiration_time_
!= x
.expiration_time_
: return 0
1047 if self
.has_cas_id_
!= x
.has_cas_id_
: return 0
1048 if self
.has_cas_id_
and self
.cas_id_
!= x
.cas_id_
: return 0
1049 if self
.has_for_cas_
!= x
.has_for_cas_
: return 0
1050 if self
.has_for_cas_
and self
.for_cas_
!= x
.for_cas_
: return 0
1053 def IsInitialized(self
, debug_strs
=None):
1055 if (not self
.has_key_
):
1057 if debug_strs
is not None:
1058 debug_strs
.append('Required field: key not set.')
1059 if (not self
.has_value_
):
1061 if debug_strs
is not None:
1062 debug_strs
.append('Required field: value not set.')
1067 n
+= self
.lengthString(len(self
.key_
))
1068 n
+= self
.lengthString(len(self
.value_
))
1069 if (self
.has_flags_
): n
+= 5
1070 if (self
.has_set_policy_
): n
+= 1 + self
.lengthVarInt64(self
.set_policy_
)
1071 if (self
.has_expiration_time_
): n
+= 5
1072 if (self
.has_cas_id_
): n
+= 9
1073 if (self
.has_for_cas_
): n
+= 2
1076 def ByteSizePartial(self
):
1080 n
+= self
.lengthString(len(self
.key_
))
1081 if (self
.has_value_
):
1083 n
+= self
.lengthString(len(self
.value_
))
1084 if (self
.has_flags_
): n
+= 5
1085 if (self
.has_set_policy_
): n
+= 1 + self
.lengthVarInt64(self
.set_policy_
)
1086 if (self
.has_expiration_time_
): n
+= 5
1087 if (self
.has_cas_id_
): n
+= 9
1088 if (self
.has_for_cas_
): n
+= 2
1095 self
.clear_set_policy()
1096 self
.clear_expiration_time()
1098 self
.clear_for_cas()
1100 def OutputUnchecked(self
, out
):
1102 out
.putPrefixedString(self
.key_
)
1104 out
.putPrefixedString(self
.value_
)
1105 if (self
.has_flags_
):
1107 out
.put32(self
.flags_
)
1108 if (self
.has_set_policy_
):
1110 out
.putVarInt32(self
.set_policy_
)
1111 if (self
.has_expiration_time_
):
1113 out
.put32(self
.expiration_time_
)
1114 if (self
.has_cas_id_
):
1116 out
.put64(self
.cas_id_
)
1117 if (self
.has_for_cas_
):
1119 out
.putBoolean(self
.for_cas_
)
1121 def OutputPartial(self
, out
):
1124 out
.putPrefixedString(self
.key_
)
1125 if (self
.has_value_
):
1127 out
.putPrefixedString(self
.value_
)
1128 if (self
.has_flags_
):
1130 out
.put32(self
.flags_
)
1131 if (self
.has_set_policy_
):
1133 out
.putVarInt32(self
.set_policy_
)
1134 if (self
.has_expiration_time_
):
1136 out
.put32(self
.expiration_time_
)
1137 if (self
.has_cas_id_
):
1139 out
.put64(self
.cas_id_
)
1140 if (self
.has_for_cas_
):
1142 out
.putBoolean(self
.for_cas_
)
1144 def TryMerge(self
, d
):
1146 tt
= d
.getVarInt32()
1149 self
.set_key(d
.getPrefixedString())
1152 self
.set_value(d
.getPrefixedString())
1155 self
.set_flags(d
.get32())
1158 self
.set_set_policy(d
.getVarInt32())
1161 self
.set_expiration_time(d
.get32())
1164 self
.set_cas_id(d
.get64())
1167 self
.set_for_cas(d
.getBoolean())
1171 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1175 def __str__(self
, prefix
="", printElemNumber
=0):
1177 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
1178 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
1179 if self
.has_flags_
: res
+=prefix
+("flags: %s\n" % self
.DebugFormatFixed32(self
.flags_
))
1180 if self
.has_set_policy_
: res
+=prefix
+("set_policy: %s\n" % self
.DebugFormatInt32(self
.set_policy_
))
1181 if self
.has_expiration_time_
: res
+=prefix
+("expiration_time: %s\n" % self
.DebugFormatFixed32(self
.expiration_time_
))
1182 if self
.has_cas_id_
: res
+=prefix
+("cas_id: %s\n" % self
.DebugFormatFixed64(self
.cas_id_
))
1183 if self
.has_for_cas_
: res
+=prefix
+("for_cas: %s\n" % self
.DebugFormatBool(self
.for_cas_
))
1186 class MemcacheSetRequest(ProtocolBuffer
.ProtocolMessage
):
1194 _SetPolicy_NAMES
= {
1201 def SetPolicy_Name(cls
, x
): return cls
._SetPolicy
_NAMES
.get(x
, "")
1202 SetPolicy_Name
= classmethod(SetPolicy_Name
)
1209 def __init__(self
, contents
=None):
1211 self
.lazy_init_lock_
= thread
.allocate_lock()
1212 if contents
is not None: self
.MergeFromString(contents
)
1214 def item_size(self
): return len(self
.item_
)
1215 def item_list(self
): return self
.item_
1218 return self
.item_
[i
]
1220 def mutable_item(self
, i
):
1221 return self
.item_
[i
]
1224 x
= MemcacheSetRequest_Item()
1225 self
.item_
.append(x
)
1228 def clear_item(self
):
1230 def name_space(self
): return self
.name_space_
1232 def set_name_space(self
, x
):
1233 self
.has_name_space_
= 1
1234 self
.name_space_
= x
1236 def clear_name_space(self
):
1237 if self
.has_name_space_
:
1238 self
.has_name_space_
= 0
1239 self
.name_space_
= ""
1241 def has_name_space(self
): return self
.has_name_space_
1244 if self
.override_
is None:
1245 self
.lazy_init_lock_
.acquire()
1247 if self
.override_
is None: self
.override_
= AppOverride()
1249 self
.lazy_init_lock_
.release()
1250 return self
.override_
1252 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
1254 def clear_override(self
):
1256 if self
.has_override_
:
1257 self
.has_override_
= 0;
1258 if self
.override_
is not None: self
.override_
.Clear()
1260 def has_override(self
): return self
.has_override_
1263 def MergeFrom(self
, x
):
1264 assert x
is not self
1265 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
1266 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
1267 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
1269 def Equals(self
, x
):
1270 if x
is self
: return 1
1271 if len(self
.item_
) != len(x
.item_
): return 0
1272 for e1
, e2
in zip(self
.item_
, x
.item_
):
1273 if e1
!= e2
: return 0
1274 if self
.has_name_space_
!= x
.has_name_space_
: return 0
1275 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
1276 if self
.has_override_
!= x
.has_override_
: return 0
1277 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
1280 def IsInitialized(self
, debug_strs
=None):
1282 for p
in self
.item_
:
1283 if not p
.IsInitialized(debug_strs
): initialized
=0
1284 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
1289 n
+= 2 * len(self
.item_
)
1290 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
1291 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
1292 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
1295 def ByteSizePartial(self
):
1297 n
+= 2 * len(self
.item_
)
1298 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSizePartial()
1299 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
1300 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
1305 self
.clear_name_space()
1306 self
.clear_override()
1308 def OutputUnchecked(self
, out
):
1309 for i
in xrange(len(self
.item_
)):
1311 self
.item_
[i
].OutputUnchecked(out
)
1313 if (self
.has_name_space_
):
1315 out
.putPrefixedString(self
.name_space_
)
1316 if (self
.has_override_
):
1318 out
.putVarInt32(self
.override_
.ByteSize())
1319 self
.override_
.OutputUnchecked(out
)
1321 def OutputPartial(self
, out
):
1322 for i
in xrange(len(self
.item_
)):
1324 self
.item_
[i
].OutputPartial(out
)
1326 if (self
.has_name_space_
):
1328 out
.putPrefixedString(self
.name_space_
)
1329 if (self
.has_override_
):
1331 out
.putVarInt32(self
.override_
.ByteSizePartial())
1332 self
.override_
.OutputPartial(out
)
1334 def TryMerge(self
, d
):
1335 while d
.avail() > 0:
1336 tt
= d
.getVarInt32()
1338 self
.add_item().TryMerge(d
)
1341 self
.set_name_space(d
.getPrefixedString())
1344 length
= d
.getVarInt32()
1345 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1347 self
.mutable_override().TryMerge(tmp
)
1351 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1355 def __str__(self
, prefix
="", printElemNumber
=0):
1358 for e
in self
.item_
:
1360 if printElemNumber
: elm
="(%d)" % cnt
1361 res
+=prefix
+("Item%s {\n" % elm
)
1362 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1365 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
1366 if self
.has_override_
:
1367 res
+=prefix
+"override <\n"
1368 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
1373 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1374 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1381 kItemexpiration_time
= 6
1387 _TEXT
= _BuildTagLookupTable({
1394 6: "expiration_time",
1401 _TYPES
= _BuildTagLookupTable({
1402 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1403 1: ProtocolBuffer
.Encoder
.STARTGROUP
,
1404 2: ProtocolBuffer
.Encoder
.STRING
,
1405 3: ProtocolBuffer
.Encoder
.STRING
,
1406 4: ProtocolBuffer
.Encoder
.FLOAT
,
1407 5: ProtocolBuffer
.Encoder
.NUMERIC
,
1408 6: ProtocolBuffer
.Encoder
.FLOAT
,
1409 7: ProtocolBuffer
.Encoder
.STRING
,
1410 8: ProtocolBuffer
.Encoder
.DOUBLE
,
1411 9: ProtocolBuffer
.Encoder
.NUMERIC
,
1412 10: ProtocolBuffer
.Encoder
.STRING
,
1413 }, 10, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1417 _STYLE_CONTENT_TYPE
= """"""
1418 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheSetRequest'
1419 class MemcacheSetResponse(ProtocolBuffer
.ProtocolMessage
):
1427 _SetStatusCode_NAMES
= {
1434 def SetStatusCode_Name(cls
, x
): return cls
._SetStatusCode
_NAMES
.get(x
, "")
1435 SetStatusCode_Name
= classmethod(SetStatusCode_Name
)
1438 def __init__(self
, contents
=None):
1439 self
.set_status_
= []
1440 if contents
is not None: self
.MergeFromString(contents
)
1442 def set_status_size(self
): return len(self
.set_status_
)
1443 def set_status_list(self
): return self
.set_status_
1445 def set_status(self
, i
):
1446 return self
.set_status_
[i
]
1448 def set_set_status(self
, i
, x
):
1449 self
.set_status_
[i
] = x
1451 def add_set_status(self
, x
):
1452 self
.set_status_
.append(x
)
1454 def clear_set_status(self
):
1455 self
.set_status_
= []
1458 def MergeFrom(self
, x
):
1459 assert x
is not self
1460 for i
in xrange(x
.set_status_size()): self
.add_set_status(x
.set_status(i
))
1462 def Equals(self
, x
):
1463 if x
is self
: return 1
1464 if len(self
.set_status_
) != len(x
.set_status_
): return 0
1465 for e1
, e2
in zip(self
.set_status_
, x
.set_status_
):
1466 if e1
!= e2
: return 0
1469 def IsInitialized(self
, debug_strs
=None):
1475 n
+= 1 * len(self
.set_status_
)
1476 for i
in xrange(len(self
.set_status_
)): n
+= self
.lengthVarInt64(self
.set_status_
[i
])
1479 def ByteSizePartial(self
):
1481 n
+= 1 * len(self
.set_status_
)
1482 for i
in xrange(len(self
.set_status_
)): n
+= self
.lengthVarInt64(self
.set_status_
[i
])
1486 self
.clear_set_status()
1488 def OutputUnchecked(self
, out
):
1489 for i
in xrange(len(self
.set_status_
)):
1491 out
.putVarInt32(self
.set_status_
[i
])
1493 def OutputPartial(self
, out
):
1494 for i
in xrange(len(self
.set_status_
)):
1496 out
.putVarInt32(self
.set_status_
[i
])
1498 def TryMerge(self
, d
):
1499 while d
.avail() > 0:
1500 tt
= d
.getVarInt32()
1502 self
.add_set_status(d
.getVarInt32())
1506 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1510 def __str__(self
, prefix
="", printElemNumber
=0):
1513 for e
in self
.set_status_
:
1515 if printElemNumber
: elm
="(%d)" % cnt
1516 res
+=prefix
+("set_status%s: %s\n" % (elm
, self
.DebugFormatInt32(e
)))
1521 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1522 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1526 _TEXT
= _BuildTagLookupTable({
1531 _TYPES
= _BuildTagLookupTable({
1532 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1533 1: ProtocolBuffer
.Encoder
.NUMERIC
,
1534 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1538 _STYLE_CONTENT_TYPE
= """"""
1539 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheSetResponse'
1540 class MemcacheDeleteRequest_Item(ProtocolBuffer
.ProtocolMessage
):
1543 has_delete_time_
= 0
1546 def __init__(self
, contents
=None):
1547 if contents
is not None: self
.MergeFromString(contents
)
1549 def key(self
): return self
.key_
1551 def set_key(self
, x
):
1555 def clear_key(self
):
1560 def has_key(self
): return self
.has_key_
1562 def delete_time(self
): return self
.delete_time_
1564 def set_delete_time(self
, x
):
1565 self
.has_delete_time_
= 1
1566 self
.delete_time_
= x
1568 def clear_delete_time(self
):
1569 if self
.has_delete_time_
:
1570 self
.has_delete_time_
= 0
1571 self
.delete_time_
= 0
1573 def has_delete_time(self
): return self
.has_delete_time_
1576 def MergeFrom(self
, x
):
1577 assert x
is not self
1578 if (x
.has_key()): self
.set_key(x
.key())
1579 if (x
.has_delete_time()): self
.set_delete_time(x
.delete_time())
1581 def Equals(self
, x
):
1582 if x
is self
: return 1
1583 if self
.has_key_
!= x
.has_key_
: return 0
1584 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
1585 if self
.has_delete_time_
!= x
.has_delete_time_
: return 0
1586 if self
.has_delete_time_
and self
.delete_time_
!= x
.delete_time_
: return 0
1589 def IsInitialized(self
, debug_strs
=None):
1591 if (not self
.has_key_
):
1593 if debug_strs
is not None:
1594 debug_strs
.append('Required field: key not set.')
1599 n
+= self
.lengthString(len(self
.key_
))
1600 if (self
.has_delete_time_
): n
+= 5
1603 def ByteSizePartial(self
):
1607 n
+= self
.lengthString(len(self
.key_
))
1608 if (self
.has_delete_time_
): n
+= 5
1613 self
.clear_delete_time()
1615 def OutputUnchecked(self
, out
):
1617 out
.putPrefixedString(self
.key_
)
1618 if (self
.has_delete_time_
):
1620 out
.put32(self
.delete_time_
)
1622 def OutputPartial(self
, out
):
1625 out
.putPrefixedString(self
.key_
)
1626 if (self
.has_delete_time_
):
1628 out
.put32(self
.delete_time_
)
1630 def TryMerge(self
, d
):
1632 tt
= d
.getVarInt32()
1635 self
.set_key(d
.getPrefixedString())
1638 self
.set_delete_time(d
.get32())
1642 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1646 def __str__(self
, prefix
="", printElemNumber
=0):
1648 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
1649 if self
.has_delete_time_
: res
+=prefix
+("delete_time: %s\n" % self
.DebugFormatFixed32(self
.delete_time_
))
1652 class MemcacheDeleteRequest(ProtocolBuffer
.ProtocolMessage
):
1658 def __init__(self
, contents
=None):
1660 self
.lazy_init_lock_
= thread
.allocate_lock()
1661 if contents
is not None: self
.MergeFromString(contents
)
1663 def item_size(self
): return len(self
.item_
)
1664 def item_list(self
): return self
.item_
1667 return self
.item_
[i
]
1669 def mutable_item(self
, i
):
1670 return self
.item_
[i
]
1673 x
= MemcacheDeleteRequest_Item()
1674 self
.item_
.append(x
)
1677 def clear_item(self
):
1679 def name_space(self
): return self
.name_space_
1681 def set_name_space(self
, x
):
1682 self
.has_name_space_
= 1
1683 self
.name_space_
= x
1685 def clear_name_space(self
):
1686 if self
.has_name_space_
:
1687 self
.has_name_space_
= 0
1688 self
.name_space_
= ""
1690 def has_name_space(self
): return self
.has_name_space_
1693 if self
.override_
is None:
1694 self
.lazy_init_lock_
.acquire()
1696 if self
.override_
is None: self
.override_
= AppOverride()
1698 self
.lazy_init_lock_
.release()
1699 return self
.override_
1701 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
1703 def clear_override(self
):
1705 if self
.has_override_
:
1706 self
.has_override_
= 0;
1707 if self
.override_
is not None: self
.override_
.Clear()
1709 def has_override(self
): return self
.has_override_
1712 def MergeFrom(self
, x
):
1713 assert x
is not self
1714 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
1715 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
1716 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
1718 def Equals(self
, x
):
1719 if x
is self
: return 1
1720 if len(self
.item_
) != len(x
.item_
): return 0
1721 for e1
, e2
in zip(self
.item_
, x
.item_
):
1722 if e1
!= e2
: return 0
1723 if self
.has_name_space_
!= x
.has_name_space_
: return 0
1724 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
1725 if self
.has_override_
!= x
.has_override_
: return 0
1726 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
1729 def IsInitialized(self
, debug_strs
=None):
1731 for p
in self
.item_
:
1732 if not p
.IsInitialized(debug_strs
): initialized
=0
1733 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
1738 n
+= 2 * len(self
.item_
)
1739 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
1740 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
1741 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
1744 def ByteSizePartial(self
):
1746 n
+= 2 * len(self
.item_
)
1747 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSizePartial()
1748 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
1749 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
1754 self
.clear_name_space()
1755 self
.clear_override()
1757 def OutputUnchecked(self
, out
):
1758 for i
in xrange(len(self
.item_
)):
1760 self
.item_
[i
].OutputUnchecked(out
)
1762 if (self
.has_name_space_
):
1764 out
.putPrefixedString(self
.name_space_
)
1765 if (self
.has_override_
):
1767 out
.putVarInt32(self
.override_
.ByteSize())
1768 self
.override_
.OutputUnchecked(out
)
1770 def OutputPartial(self
, out
):
1771 for i
in xrange(len(self
.item_
)):
1773 self
.item_
[i
].OutputPartial(out
)
1775 if (self
.has_name_space_
):
1777 out
.putPrefixedString(self
.name_space_
)
1778 if (self
.has_override_
):
1780 out
.putVarInt32(self
.override_
.ByteSizePartial())
1781 self
.override_
.OutputPartial(out
)
1783 def TryMerge(self
, d
):
1784 while d
.avail() > 0:
1785 tt
= d
.getVarInt32()
1787 self
.add_item().TryMerge(d
)
1790 self
.set_name_space(d
.getPrefixedString())
1793 length
= d
.getVarInt32()
1794 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1796 self
.mutable_override().TryMerge(tmp
)
1800 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1804 def __str__(self
, prefix
="", printElemNumber
=0):
1807 for e
in self
.item_
:
1809 if printElemNumber
: elm
="(%d)" % cnt
1810 res
+=prefix
+("Item%s {\n" % elm
)
1811 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1814 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
1815 if self
.has_override_
:
1816 res
+=prefix
+"override <\n"
1817 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
1822 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1823 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1827 kItemdelete_time
= 3
1831 _TEXT
= _BuildTagLookupTable({
1840 _TYPES
= _BuildTagLookupTable({
1841 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1842 1: ProtocolBuffer
.Encoder
.STARTGROUP
,
1843 2: ProtocolBuffer
.Encoder
.STRING
,
1844 3: ProtocolBuffer
.Encoder
.FLOAT
,
1845 4: ProtocolBuffer
.Encoder
.STRING
,
1846 5: ProtocolBuffer
.Encoder
.STRING
,
1847 }, 5, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1851 _STYLE_CONTENT_TYPE
= """"""
1852 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheDeleteRequest'
1853 class MemcacheDeleteResponse(ProtocolBuffer
.ProtocolMessage
):
1859 _DeleteStatusCode_NAMES
= {
1864 def DeleteStatusCode_Name(cls
, x
): return cls
._DeleteStatusCode
_NAMES
.get(x
, "")
1865 DeleteStatusCode_Name
= classmethod(DeleteStatusCode_Name
)
1868 def __init__(self
, contents
=None):
1869 self
.delete_status_
= []
1870 if contents
is not None: self
.MergeFromString(contents
)
1872 def delete_status_size(self
): return len(self
.delete_status_
)
1873 def delete_status_list(self
): return self
.delete_status_
1875 def delete_status(self
, i
):
1876 return self
.delete_status_
[i
]
1878 def set_delete_status(self
, i
, x
):
1879 self
.delete_status_
[i
] = x
1881 def add_delete_status(self
, x
):
1882 self
.delete_status_
.append(x
)
1884 def clear_delete_status(self
):
1885 self
.delete_status_
= []
1888 def MergeFrom(self
, x
):
1889 assert x
is not self
1890 for i
in xrange(x
.delete_status_size()): self
.add_delete_status(x
.delete_status(i
))
1892 def Equals(self
, x
):
1893 if x
is self
: return 1
1894 if len(self
.delete_status_
) != len(x
.delete_status_
): return 0
1895 for e1
, e2
in zip(self
.delete_status_
, x
.delete_status_
):
1896 if e1
!= e2
: return 0
1899 def IsInitialized(self
, debug_strs
=None):
1905 n
+= 1 * len(self
.delete_status_
)
1906 for i
in xrange(len(self
.delete_status_
)): n
+= self
.lengthVarInt64(self
.delete_status_
[i
])
1909 def ByteSizePartial(self
):
1911 n
+= 1 * len(self
.delete_status_
)
1912 for i
in xrange(len(self
.delete_status_
)): n
+= self
.lengthVarInt64(self
.delete_status_
[i
])
1916 self
.clear_delete_status()
1918 def OutputUnchecked(self
, out
):
1919 for i
in xrange(len(self
.delete_status_
)):
1921 out
.putVarInt32(self
.delete_status_
[i
])
1923 def OutputPartial(self
, out
):
1924 for i
in xrange(len(self
.delete_status_
)):
1926 out
.putVarInt32(self
.delete_status_
[i
])
1928 def TryMerge(self
, d
):
1929 while d
.avail() > 0:
1930 tt
= d
.getVarInt32()
1932 self
.add_delete_status(d
.getVarInt32())
1936 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1940 def __str__(self
, prefix
="", printElemNumber
=0):
1943 for e
in self
.delete_status_
:
1945 if printElemNumber
: elm
="(%d)" % cnt
1946 res
+=prefix
+("delete_status%s: %s\n" % (elm
, self
.DebugFormatInt32(e
)))
1951 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1952 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1956 _TEXT
= _BuildTagLookupTable({
1961 _TYPES
= _BuildTagLookupTable({
1962 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1963 1: ProtocolBuffer
.Encoder
.NUMERIC
,
1964 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1968 _STYLE_CONTENT_TYPE
= """"""
1969 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheDeleteResponse'
1970 class MemcacheIncrementRequest(ProtocolBuffer
.ProtocolMessage
):
1976 _Direction_NAMES
= {
1981 def Direction_Name(cls
, x
): return cls
._Direction
_NAMES
.get(x
, "")
1982 Direction_Name
= classmethod(Direction_Name
)
1992 has_initial_value_
= 0
1994 has_initial_flags_
= 0
1999 def __init__(self
, contents
=None):
2000 self
.lazy_init_lock_
= thread
.allocate_lock()
2001 if contents
is not None: self
.MergeFromString(contents
)
2003 def key(self
): return self
.key_
2005 def set_key(self
, x
):
2009 def clear_key(self
):
2014 def has_key(self
): return self
.has_key_
2016 def name_space(self
): return self
.name_space_
2018 def set_name_space(self
, x
):
2019 self
.has_name_space_
= 1
2020 self
.name_space_
= x
2022 def clear_name_space(self
):
2023 if self
.has_name_space_
:
2024 self
.has_name_space_
= 0
2025 self
.name_space_
= ""
2027 def has_name_space(self
): return self
.has_name_space_
2029 def delta(self
): return self
.delta_
2031 def set_delta(self
, x
):
2035 def clear_delta(self
):
2040 def has_delta(self
): return self
.has_delta_
2042 def direction(self
): return self
.direction_
2044 def set_direction(self
, x
):
2045 self
.has_direction_
= 1
2048 def clear_direction(self
):
2049 if self
.has_direction_
:
2050 self
.has_direction_
= 0
2053 def has_direction(self
): return self
.has_direction_
2055 def initial_value(self
): return self
.initial_value_
2057 def set_initial_value(self
, x
):
2058 self
.has_initial_value_
= 1
2059 self
.initial_value_
= x
2061 def clear_initial_value(self
):
2062 if self
.has_initial_value_
:
2063 self
.has_initial_value_
= 0
2064 self
.initial_value_
= 0
2066 def has_initial_value(self
): return self
.has_initial_value_
2068 def initial_flags(self
): return self
.initial_flags_
2070 def set_initial_flags(self
, x
):
2071 self
.has_initial_flags_
= 1
2072 self
.initial_flags_
= x
2074 def clear_initial_flags(self
):
2075 if self
.has_initial_flags_
:
2076 self
.has_initial_flags_
= 0
2077 self
.initial_flags_
= 0
2079 def has_initial_flags(self
): return self
.has_initial_flags_
2082 if self
.override_
is None:
2083 self
.lazy_init_lock_
.acquire()
2085 if self
.override_
is None: self
.override_
= AppOverride()
2087 self
.lazy_init_lock_
.release()
2088 return self
.override_
2090 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
2092 def clear_override(self
):
2094 if self
.has_override_
:
2095 self
.has_override_
= 0;
2096 if self
.override_
is not None: self
.override_
.Clear()
2098 def has_override(self
): return self
.has_override_
2101 def MergeFrom(self
, x
):
2102 assert x
is not self
2103 if (x
.has_key()): self
.set_key(x
.key())
2104 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
2105 if (x
.has_delta()): self
.set_delta(x
.delta())
2106 if (x
.has_direction()): self
.set_direction(x
.direction())
2107 if (x
.has_initial_value()): self
.set_initial_value(x
.initial_value())
2108 if (x
.has_initial_flags()): self
.set_initial_flags(x
.initial_flags())
2109 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
2111 def Equals(self
, x
):
2112 if x
is self
: return 1
2113 if self
.has_key_
!= x
.has_key_
: return 0
2114 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
2115 if self
.has_name_space_
!= x
.has_name_space_
: return 0
2116 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
2117 if self
.has_delta_
!= x
.has_delta_
: return 0
2118 if self
.has_delta_
and self
.delta_
!= x
.delta_
: return 0
2119 if self
.has_direction_
!= x
.has_direction_
: return 0
2120 if self
.has_direction_
and self
.direction_
!= x
.direction_
: return 0
2121 if self
.has_initial_value_
!= x
.has_initial_value_
: return 0
2122 if self
.has_initial_value_
and self
.initial_value_
!= x
.initial_value_
: return 0
2123 if self
.has_initial_flags_
!= x
.has_initial_flags_
: return 0
2124 if self
.has_initial_flags_
and self
.initial_flags_
!= x
.initial_flags_
: return 0
2125 if self
.has_override_
!= x
.has_override_
: return 0
2126 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
2129 def IsInitialized(self
, debug_strs
=None):
2131 if (not self
.has_key_
):
2133 if debug_strs
is not None:
2134 debug_strs
.append('Required field: key not set.')
2135 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
2140 n
+= self
.lengthString(len(self
.key_
))
2141 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
2142 if (self
.has_delta_
): n
+= 1 + self
.lengthVarInt64(self
.delta_
)
2143 if (self
.has_direction_
): n
+= 1 + self
.lengthVarInt64(self
.direction_
)
2144 if (self
.has_initial_value_
): n
+= 1 + self
.lengthVarInt64(self
.initial_value_
)
2145 if (self
.has_initial_flags_
): n
+= 5
2146 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
2149 def ByteSizePartial(self
):
2153 n
+= self
.lengthString(len(self
.key_
))
2154 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
2155 if (self
.has_delta_
): n
+= 1 + self
.lengthVarInt64(self
.delta_
)
2156 if (self
.has_direction_
): n
+= 1 + self
.lengthVarInt64(self
.direction_
)
2157 if (self
.has_initial_value_
): n
+= 1 + self
.lengthVarInt64(self
.initial_value_
)
2158 if (self
.has_initial_flags_
): n
+= 5
2159 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
2164 self
.clear_name_space()
2166 self
.clear_direction()
2167 self
.clear_initial_value()
2168 self
.clear_initial_flags()
2169 self
.clear_override()
2171 def OutputUnchecked(self
, out
):
2173 out
.putPrefixedString(self
.key_
)
2174 if (self
.has_delta_
):
2176 out
.putVarUint64(self
.delta_
)
2177 if (self
.has_direction_
):
2179 out
.putVarInt32(self
.direction_
)
2180 if (self
.has_name_space_
):
2182 out
.putPrefixedString(self
.name_space_
)
2183 if (self
.has_initial_value_
):
2185 out
.putVarUint64(self
.initial_value_
)
2186 if (self
.has_initial_flags_
):
2188 out
.put32(self
.initial_flags_
)
2189 if (self
.has_override_
):
2191 out
.putVarInt32(self
.override_
.ByteSize())
2192 self
.override_
.OutputUnchecked(out
)
2194 def OutputPartial(self
, out
):
2197 out
.putPrefixedString(self
.key_
)
2198 if (self
.has_delta_
):
2200 out
.putVarUint64(self
.delta_
)
2201 if (self
.has_direction_
):
2203 out
.putVarInt32(self
.direction_
)
2204 if (self
.has_name_space_
):
2206 out
.putPrefixedString(self
.name_space_
)
2207 if (self
.has_initial_value_
):
2209 out
.putVarUint64(self
.initial_value_
)
2210 if (self
.has_initial_flags_
):
2212 out
.put32(self
.initial_flags_
)
2213 if (self
.has_override_
):
2215 out
.putVarInt32(self
.override_
.ByteSizePartial())
2216 self
.override_
.OutputPartial(out
)
2218 def TryMerge(self
, d
):
2219 while d
.avail() > 0:
2220 tt
= d
.getVarInt32()
2222 self
.set_key(d
.getPrefixedString())
2225 self
.set_delta(d
.getVarUint64())
2228 self
.set_direction(d
.getVarInt32())
2231 self
.set_name_space(d
.getPrefixedString())
2234 self
.set_initial_value(d
.getVarUint64())
2237 self
.set_initial_flags(d
.get32())
2240 length
= d
.getVarInt32()
2241 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2243 self
.mutable_override().TryMerge(tmp
)
2247 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2251 def __str__(self
, prefix
="", printElemNumber
=0):
2253 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
2254 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
2255 if self
.has_delta_
: res
+=prefix
+("delta: %s\n" % self
.DebugFormatInt64(self
.delta_
))
2256 if self
.has_direction_
: res
+=prefix
+("direction: %s\n" % self
.DebugFormatInt32(self
.direction_
))
2257 if self
.has_initial_value_
: res
+=prefix
+("initial_value: %s\n" % self
.DebugFormatInt64(self
.initial_value_
))
2258 if self
.has_initial_flags_
: res
+=prefix
+("initial_flags: %s\n" % self
.DebugFormatFixed32(self
.initial_flags_
))
2259 if self
.has_override_
:
2260 res
+=prefix
+"override <\n"
2261 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
2266 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2267 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2277 _TEXT
= _BuildTagLookupTable({
2288 _TYPES
= _BuildTagLookupTable({
2289 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2290 1: ProtocolBuffer
.Encoder
.STRING
,
2291 2: ProtocolBuffer
.Encoder
.NUMERIC
,
2292 3: ProtocolBuffer
.Encoder
.NUMERIC
,
2293 4: ProtocolBuffer
.Encoder
.STRING
,
2294 5: ProtocolBuffer
.Encoder
.NUMERIC
,
2295 6: ProtocolBuffer
.Encoder
.FLOAT
,
2296 7: ProtocolBuffer
.Encoder
.STRING
,
2297 }, 7, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2301 _STYLE_CONTENT_TYPE
= """"""
2302 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheIncrementRequest'
2303 class MemcacheIncrementResponse(ProtocolBuffer
.ProtocolMessage
):
2310 _IncrementStatusCode_NAMES
= {
2316 def IncrementStatusCode_Name(cls
, x
): return cls
._IncrementStatusCode
_NAMES
.get(x
, "")
2317 IncrementStatusCode_Name
= classmethod(IncrementStatusCode_Name
)
2321 has_increment_status_
= 0
2322 increment_status_
= 0
2324 def __init__(self
, contents
=None):
2325 if contents
is not None: self
.MergeFromString(contents
)
2327 def new_value(self
): return self
.new_value_
2329 def set_new_value(self
, x
):
2330 self
.has_new_value_
= 1
2333 def clear_new_value(self
):
2334 if self
.has_new_value_
:
2335 self
.has_new_value_
= 0
2338 def has_new_value(self
): return self
.has_new_value_
2340 def increment_status(self
): return self
.increment_status_
2342 def set_increment_status(self
, x
):
2343 self
.has_increment_status_
= 1
2344 self
.increment_status_
= x
2346 def clear_increment_status(self
):
2347 if self
.has_increment_status_
:
2348 self
.has_increment_status_
= 0
2349 self
.increment_status_
= 0
2351 def has_increment_status(self
): return self
.has_increment_status_
2354 def MergeFrom(self
, x
):
2355 assert x
is not self
2356 if (x
.has_new_value()): self
.set_new_value(x
.new_value())
2357 if (x
.has_increment_status()): self
.set_increment_status(x
.increment_status())
2359 def Equals(self
, x
):
2360 if x
is self
: return 1
2361 if self
.has_new_value_
!= x
.has_new_value_
: return 0
2362 if self
.has_new_value_
and self
.new_value_
!= x
.new_value_
: return 0
2363 if self
.has_increment_status_
!= x
.has_increment_status_
: return 0
2364 if self
.has_increment_status_
and self
.increment_status_
!= x
.increment_status_
: return 0
2367 def IsInitialized(self
, debug_strs
=None):
2373 if (self
.has_new_value_
): n
+= 1 + self
.lengthVarInt64(self
.new_value_
)
2374 if (self
.has_increment_status_
): n
+= 1 + self
.lengthVarInt64(self
.increment_status_
)
2377 def ByteSizePartial(self
):
2379 if (self
.has_new_value_
): n
+= 1 + self
.lengthVarInt64(self
.new_value_
)
2380 if (self
.has_increment_status_
): n
+= 1 + self
.lengthVarInt64(self
.increment_status_
)
2384 self
.clear_new_value()
2385 self
.clear_increment_status()
2387 def OutputUnchecked(self
, out
):
2388 if (self
.has_new_value_
):
2390 out
.putVarUint64(self
.new_value_
)
2391 if (self
.has_increment_status_
):
2393 out
.putVarInt32(self
.increment_status_
)
2395 def OutputPartial(self
, out
):
2396 if (self
.has_new_value_
):
2398 out
.putVarUint64(self
.new_value_
)
2399 if (self
.has_increment_status_
):
2401 out
.putVarInt32(self
.increment_status_
)
2403 def TryMerge(self
, d
):
2404 while d
.avail() > 0:
2405 tt
= d
.getVarInt32()
2407 self
.set_new_value(d
.getVarUint64())
2410 self
.set_increment_status(d
.getVarInt32())
2414 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2418 def __str__(self
, prefix
="", printElemNumber
=0):
2420 if self
.has_new_value_
: res
+=prefix
+("new_value: %s\n" % self
.DebugFormatInt64(self
.new_value_
))
2421 if self
.has_increment_status_
: res
+=prefix
+("increment_status: %s\n" % self
.DebugFormatInt32(self
.increment_status_
))
2425 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2426 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2429 kincrement_status
= 2
2431 _TEXT
= _BuildTagLookupTable({
2434 2: "increment_status",
2437 _TYPES
= _BuildTagLookupTable({
2438 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2439 1: ProtocolBuffer
.Encoder
.NUMERIC
,
2440 2: ProtocolBuffer
.Encoder
.NUMERIC
,
2441 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2445 _STYLE_CONTENT_TYPE
= """"""
2446 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheIncrementResponse'
2447 class MemcacheBatchIncrementRequest(ProtocolBuffer
.ProtocolMessage
):
2453 def __init__(self
, contents
=None):
2455 self
.lazy_init_lock_
= thread
.allocate_lock()
2456 if contents
is not None: self
.MergeFromString(contents
)
2458 def name_space(self
): return self
.name_space_
2460 def set_name_space(self
, x
):
2461 self
.has_name_space_
= 1
2462 self
.name_space_
= x
2464 def clear_name_space(self
):
2465 if self
.has_name_space_
:
2466 self
.has_name_space_
= 0
2467 self
.name_space_
= ""
2469 def has_name_space(self
): return self
.has_name_space_
2471 def item_size(self
): return len(self
.item_
)
2472 def item_list(self
): return self
.item_
2475 return self
.item_
[i
]
2477 def mutable_item(self
, i
):
2478 return self
.item_
[i
]
2481 x
= MemcacheIncrementRequest()
2482 self
.item_
.append(x
)
2485 def clear_item(self
):
2488 if self
.override_
is None:
2489 self
.lazy_init_lock_
.acquire()
2491 if self
.override_
is None: self
.override_
= AppOverride()
2493 self
.lazy_init_lock_
.release()
2494 return self
.override_
2496 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
2498 def clear_override(self
):
2500 if self
.has_override_
:
2501 self
.has_override_
= 0;
2502 if self
.override_
is not None: self
.override_
.Clear()
2504 def has_override(self
): return self
.has_override_
2507 def MergeFrom(self
, x
):
2508 assert x
is not self
2509 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
2510 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
2511 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
2513 def Equals(self
, x
):
2514 if x
is self
: return 1
2515 if self
.has_name_space_
!= x
.has_name_space_
: return 0
2516 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
2517 if len(self
.item_
) != len(x
.item_
): return 0
2518 for e1
, e2
in zip(self
.item_
, x
.item_
):
2519 if e1
!= e2
: return 0
2520 if self
.has_override_
!= x
.has_override_
: return 0
2521 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
2524 def IsInitialized(self
, debug_strs
=None):
2526 for p
in self
.item_
:
2527 if not p
.IsInitialized(debug_strs
): initialized
=0
2528 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
2533 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
2534 n
+= 1 * len(self
.item_
)
2535 for i
in xrange(len(self
.item_
)): n
+= self
.lengthString(self
.item_
[i
].ByteSize())
2536 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
2539 def ByteSizePartial(self
):
2541 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
2542 n
+= 1 * len(self
.item_
)
2543 for i
in xrange(len(self
.item_
)): n
+= self
.lengthString(self
.item_
[i
].ByteSizePartial())
2544 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
2548 self
.clear_name_space()
2550 self
.clear_override()
2552 def OutputUnchecked(self
, out
):
2553 if (self
.has_name_space_
):
2555 out
.putPrefixedString(self
.name_space_
)
2556 for i
in xrange(len(self
.item_
)):
2558 out
.putVarInt32(self
.item_
[i
].ByteSize())
2559 self
.item_
[i
].OutputUnchecked(out
)
2560 if (self
.has_override_
):
2562 out
.putVarInt32(self
.override_
.ByteSize())
2563 self
.override_
.OutputUnchecked(out
)
2565 def OutputPartial(self
, out
):
2566 if (self
.has_name_space_
):
2568 out
.putPrefixedString(self
.name_space_
)
2569 for i
in xrange(len(self
.item_
)):
2571 out
.putVarInt32(self
.item_
[i
].ByteSizePartial())
2572 self
.item_
[i
].OutputPartial(out
)
2573 if (self
.has_override_
):
2575 out
.putVarInt32(self
.override_
.ByteSizePartial())
2576 self
.override_
.OutputPartial(out
)
2578 def TryMerge(self
, d
):
2579 while d
.avail() > 0:
2580 tt
= d
.getVarInt32()
2582 self
.set_name_space(d
.getPrefixedString())
2585 length
= d
.getVarInt32()
2586 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2588 self
.add_item().TryMerge(tmp
)
2591 length
= d
.getVarInt32()
2592 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2594 self
.mutable_override().TryMerge(tmp
)
2598 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2602 def __str__(self
, prefix
="", printElemNumber
=0):
2604 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
2606 for e
in self
.item_
:
2608 if printElemNumber
: elm
="(%d)" % cnt
2609 res
+=prefix
+("item%s <\n" % elm
)
2610 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
2613 if self
.has_override_
:
2614 res
+=prefix
+"override <\n"
2615 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
2620 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2621 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2627 _TEXT
= _BuildTagLookupTable({
2634 _TYPES
= _BuildTagLookupTable({
2635 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2636 1: ProtocolBuffer
.Encoder
.STRING
,
2637 2: ProtocolBuffer
.Encoder
.STRING
,
2638 3: ProtocolBuffer
.Encoder
.STRING
,
2639 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2643 _STYLE_CONTENT_TYPE
= """"""
2644 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheBatchIncrementRequest'
2645 class MemcacheBatchIncrementResponse(ProtocolBuffer
.ProtocolMessage
):
2647 def __init__(self
, contents
=None):
2649 if contents
is not None: self
.MergeFromString(contents
)
2651 def item_size(self
): return len(self
.item_
)
2652 def item_list(self
): return self
.item_
2655 return self
.item_
[i
]
2657 def mutable_item(self
, i
):
2658 return self
.item_
[i
]
2661 x
= MemcacheIncrementResponse()
2662 self
.item_
.append(x
)
2665 def clear_item(self
):
2668 def MergeFrom(self
, x
):
2669 assert x
is not self
2670 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
2672 def Equals(self
, x
):
2673 if x
is self
: return 1
2674 if len(self
.item_
) != len(x
.item_
): return 0
2675 for e1
, e2
in zip(self
.item_
, x
.item_
):
2676 if e1
!= e2
: return 0
2679 def IsInitialized(self
, debug_strs
=None):
2681 for p
in self
.item_
:
2682 if not p
.IsInitialized(debug_strs
): initialized
=0
2687 n
+= 1 * len(self
.item_
)
2688 for i
in xrange(len(self
.item_
)): n
+= self
.lengthString(self
.item_
[i
].ByteSize())
2691 def ByteSizePartial(self
):
2693 n
+= 1 * len(self
.item_
)
2694 for i
in xrange(len(self
.item_
)): n
+= self
.lengthString(self
.item_
[i
].ByteSizePartial())
2700 def OutputUnchecked(self
, out
):
2701 for i
in xrange(len(self
.item_
)):
2703 out
.putVarInt32(self
.item_
[i
].ByteSize())
2704 self
.item_
[i
].OutputUnchecked(out
)
2706 def OutputPartial(self
, out
):
2707 for i
in xrange(len(self
.item_
)):
2709 out
.putVarInt32(self
.item_
[i
].ByteSizePartial())
2710 self
.item_
[i
].OutputPartial(out
)
2712 def TryMerge(self
, d
):
2713 while d
.avail() > 0:
2714 tt
= d
.getVarInt32()
2716 length
= d
.getVarInt32()
2717 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2719 self
.add_item().TryMerge(tmp
)
2723 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2727 def __str__(self
, prefix
="", printElemNumber
=0):
2730 for e
in self
.item_
:
2732 if printElemNumber
: elm
="(%d)" % cnt
2733 res
+=prefix
+("item%s <\n" % elm
)
2734 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
2740 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2741 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2745 _TEXT
= _BuildTagLookupTable({
2750 _TYPES
= _BuildTagLookupTable({
2751 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2752 1: ProtocolBuffer
.Encoder
.STRING
,
2753 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2757 _STYLE_CONTENT_TYPE
= """"""
2758 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheBatchIncrementResponse'
2759 class MemcacheFlushRequest(ProtocolBuffer
.ProtocolMessage
):
2763 def __init__(self
, contents
=None):
2764 self
.lazy_init_lock_
= thread
.allocate_lock()
2765 if contents
is not None: self
.MergeFromString(contents
)
2768 if self
.override_
is None:
2769 self
.lazy_init_lock_
.acquire()
2771 if self
.override_
is None: self
.override_
= AppOverride()
2773 self
.lazy_init_lock_
.release()
2774 return self
.override_
2776 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
2778 def clear_override(self
):
2780 if self
.has_override_
:
2781 self
.has_override_
= 0;
2782 if self
.override_
is not None: self
.override_
.Clear()
2784 def has_override(self
): return self
.has_override_
2787 def MergeFrom(self
, x
):
2788 assert x
is not self
2789 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
2791 def Equals(self
, x
):
2792 if x
is self
: return 1
2793 if self
.has_override_
!= x
.has_override_
: return 0
2794 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
2797 def IsInitialized(self
, debug_strs
=None):
2799 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
2804 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
2807 def ByteSizePartial(self
):
2809 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
2813 self
.clear_override()
2815 def OutputUnchecked(self
, out
):
2816 if (self
.has_override_
):
2818 out
.putVarInt32(self
.override_
.ByteSize())
2819 self
.override_
.OutputUnchecked(out
)
2821 def OutputPartial(self
, out
):
2822 if (self
.has_override_
):
2824 out
.putVarInt32(self
.override_
.ByteSizePartial())
2825 self
.override_
.OutputPartial(out
)
2827 def TryMerge(self
, d
):
2828 while d
.avail() > 0:
2829 tt
= d
.getVarInt32()
2831 length
= d
.getVarInt32()
2832 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
2834 self
.mutable_override().TryMerge(tmp
)
2838 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2842 def __str__(self
, prefix
="", printElemNumber
=0):
2844 if self
.has_override_
:
2845 res
+=prefix
+"override <\n"
2846 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
2851 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2852 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2856 _TEXT
= _BuildTagLookupTable({
2861 _TYPES
= _BuildTagLookupTable({
2862 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2863 1: ProtocolBuffer
.Encoder
.STRING
,
2864 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2868 _STYLE_CONTENT_TYPE
= """"""
2869 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheFlushRequest'
2870 class MemcacheFlushResponse(ProtocolBuffer
.ProtocolMessage
):
2872 def __init__(self
, contents
=None):
2874 if contents
is not None: self
.MergeFromString(contents
)
2877 def MergeFrom(self
, x
):
2878 assert x
is not self
2880 def Equals(self
, x
):
2881 if x
is self
: return 1
2884 def IsInitialized(self
, debug_strs
=None):
2892 def ByteSizePartial(self
):
2899 def OutputUnchecked(self
, out
):
2902 def OutputPartial(self
, out
):
2905 def TryMerge(self
, d
):
2906 while d
.avail() > 0:
2907 tt
= d
.getVarInt32()
2910 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
2914 def __str__(self
, prefix
="", printElemNumber
=0):
2919 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
2920 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
2923 _TEXT
= _BuildTagLookupTable({
2927 _TYPES
= _BuildTagLookupTable({
2928 0: ProtocolBuffer
.Encoder
.NUMERIC
,
2929 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
2933 _STYLE_CONTENT_TYPE
= """"""
2934 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheFlushResponse'
2935 class MemcacheStatsRequest(ProtocolBuffer
.ProtocolMessage
):
2939 def __init__(self
, contents
=None):
2940 self
.lazy_init_lock_
= thread
.allocate_lock()
2941 if contents
is not None: self
.MergeFromString(contents
)
2944 if self
.override_
is None:
2945 self
.lazy_init_lock_
.acquire()
2947 if self
.override_
is None: self
.override_
= AppOverride()
2949 self
.lazy_init_lock_
.release()
2950 return self
.override_
2952 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
2954 def clear_override(self
):
2956 if self
.has_override_
:
2957 self
.has_override_
= 0;
2958 if self
.override_
is not None: self
.override_
.Clear()
2960 def has_override(self
): return self
.has_override_
2963 def MergeFrom(self
, x
):
2964 assert x
is not self
2965 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
2967 def Equals(self
, x
):
2968 if x
is self
: return 1
2969 if self
.has_override_
!= x
.has_override_
: return 0
2970 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
2973 def IsInitialized(self
, debug_strs
=None):
2975 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
2980 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
2983 def ByteSizePartial(self
):
2985 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
2989 self
.clear_override()
2991 def OutputUnchecked(self
, out
):
2992 if (self
.has_override_
):
2994 out
.putVarInt32(self
.override_
.ByteSize())
2995 self
.override_
.OutputUnchecked(out
)
2997 def OutputPartial(self
, out
):
2998 if (self
.has_override_
):
3000 out
.putVarInt32(self
.override_
.ByteSizePartial())
3001 self
.override_
.OutputPartial(out
)
3003 def TryMerge(self
, d
):
3004 while d
.avail() > 0:
3005 tt
= d
.getVarInt32()
3007 length
= d
.getVarInt32()
3008 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
3010 self
.mutable_override().TryMerge(tmp
)
3014 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3018 def __str__(self
, prefix
="", printElemNumber
=0):
3020 if self
.has_override_
:
3021 res
+=prefix
+"override <\n"
3022 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
3027 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3028 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3032 _TEXT
= _BuildTagLookupTable({
3037 _TYPES
= _BuildTagLookupTable({
3038 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3039 1: ProtocolBuffer
.Encoder
.STRING
,
3040 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3044 _STYLE_CONTENT_TYPE
= """"""
3045 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheStatsRequest'
3046 class MergedNamespaceStats(ProtocolBuffer
.ProtocolMessage
):
3057 has_oldest_item_age_
= 0
3058 oldest_item_age_
= 0
3060 def __init__(self
, contents
=None):
3061 if contents
is not None: self
.MergeFromString(contents
)
3063 def hits(self
): return self
.hits_
3065 def set_hits(self
, x
):
3069 def clear_hits(self
):
3074 def has_hits(self
): return self
.has_hits_
3076 def misses(self
): return self
.misses_
3078 def set_misses(self
, x
):
3079 self
.has_misses_
= 1
3082 def clear_misses(self
):
3083 if self
.has_misses_
:
3084 self
.has_misses_
= 0
3087 def has_misses(self
): return self
.has_misses_
3089 def byte_hits(self
): return self
.byte_hits_
3091 def set_byte_hits(self
, x
):
3092 self
.has_byte_hits_
= 1
3095 def clear_byte_hits(self
):
3096 if self
.has_byte_hits_
:
3097 self
.has_byte_hits_
= 0
3100 def has_byte_hits(self
): return self
.has_byte_hits_
3102 def items(self
): return self
.items_
3104 def set_items(self
, x
):
3108 def clear_items(self
):
3113 def has_items(self
): return self
.has_items_
3115 def bytes(self
): return self
.bytes_
3117 def set_bytes(self
, x
):
3121 def clear_bytes(self
):
3126 def has_bytes(self
): return self
.has_bytes_
3128 def oldest_item_age(self
): return self
.oldest_item_age_
3130 def set_oldest_item_age(self
, x
):
3131 self
.has_oldest_item_age_
= 1
3132 self
.oldest_item_age_
= x
3134 def clear_oldest_item_age(self
):
3135 if self
.has_oldest_item_age_
:
3136 self
.has_oldest_item_age_
= 0
3137 self
.oldest_item_age_
= 0
3139 def has_oldest_item_age(self
): return self
.has_oldest_item_age_
3142 def MergeFrom(self
, x
):
3143 assert x
is not self
3144 if (x
.has_hits()): self
.set_hits(x
.hits())
3145 if (x
.has_misses()): self
.set_misses(x
.misses())
3146 if (x
.has_byte_hits()): self
.set_byte_hits(x
.byte_hits())
3147 if (x
.has_items()): self
.set_items(x
.items())
3148 if (x
.has_bytes()): self
.set_bytes(x
.bytes())
3149 if (x
.has_oldest_item_age()): self
.set_oldest_item_age(x
.oldest_item_age())
3151 def Equals(self
, x
):
3152 if x
is self
: return 1
3153 if self
.has_hits_
!= x
.has_hits_
: return 0
3154 if self
.has_hits_
and self
.hits_
!= x
.hits_
: return 0
3155 if self
.has_misses_
!= x
.has_misses_
: return 0
3156 if self
.has_misses_
and self
.misses_
!= x
.misses_
: return 0
3157 if self
.has_byte_hits_
!= x
.has_byte_hits_
: return 0
3158 if self
.has_byte_hits_
and self
.byte_hits_
!= x
.byte_hits_
: return 0
3159 if self
.has_items_
!= x
.has_items_
: return 0
3160 if self
.has_items_
and self
.items_
!= x
.items_
: return 0
3161 if self
.has_bytes_
!= x
.has_bytes_
: return 0
3162 if self
.has_bytes_
and self
.bytes_
!= x
.bytes_
: return 0
3163 if self
.has_oldest_item_age_
!= x
.has_oldest_item_age_
: return 0
3164 if self
.has_oldest_item_age_
and self
.oldest_item_age_
!= x
.oldest_item_age_
: return 0
3167 def IsInitialized(self
, debug_strs
=None):
3169 if (not self
.has_hits_
):
3171 if debug_strs
is not None:
3172 debug_strs
.append('Required field: hits not set.')
3173 if (not self
.has_misses_
):
3175 if debug_strs
is not None:
3176 debug_strs
.append('Required field: misses not set.')
3177 if (not self
.has_byte_hits_
):
3179 if debug_strs
is not None:
3180 debug_strs
.append('Required field: byte_hits not set.')
3181 if (not self
.has_items_
):
3183 if debug_strs
is not None:
3184 debug_strs
.append('Required field: items not set.')
3185 if (not self
.has_bytes_
):
3187 if debug_strs
is not None:
3188 debug_strs
.append('Required field: bytes not set.')
3189 if (not self
.has_oldest_item_age_
):
3191 if debug_strs
is not None:
3192 debug_strs
.append('Required field: oldest_item_age not set.')
3197 n
+= self
.lengthVarInt64(self
.hits_
)
3198 n
+= self
.lengthVarInt64(self
.misses_
)
3199 n
+= self
.lengthVarInt64(self
.byte_hits_
)
3200 n
+= self
.lengthVarInt64(self
.items_
)
3201 n
+= self
.lengthVarInt64(self
.bytes_
)
3204 def ByteSizePartial(self
):
3206 if (self
.has_hits_
):
3208 n
+= self
.lengthVarInt64(self
.hits_
)
3209 if (self
.has_misses_
):
3211 n
+= self
.lengthVarInt64(self
.misses_
)
3212 if (self
.has_byte_hits_
):
3214 n
+= self
.lengthVarInt64(self
.byte_hits_
)
3215 if (self
.has_items_
):
3217 n
+= self
.lengthVarInt64(self
.items_
)
3218 if (self
.has_bytes_
):
3220 n
+= self
.lengthVarInt64(self
.bytes_
)
3221 if (self
.has_oldest_item_age_
):
3228 self
.clear_byte_hits()
3231 self
.clear_oldest_item_age()
3233 def OutputUnchecked(self
, out
):
3235 out
.putVarUint64(self
.hits_
)
3237 out
.putVarUint64(self
.misses_
)
3239 out
.putVarUint64(self
.byte_hits_
)
3241 out
.putVarUint64(self
.items_
)
3243 out
.putVarUint64(self
.bytes_
)
3245 out
.put32(self
.oldest_item_age_
)
3247 def OutputPartial(self
, out
):
3248 if (self
.has_hits_
):
3250 out
.putVarUint64(self
.hits_
)
3251 if (self
.has_misses_
):
3253 out
.putVarUint64(self
.misses_
)
3254 if (self
.has_byte_hits_
):
3256 out
.putVarUint64(self
.byte_hits_
)
3257 if (self
.has_items_
):
3259 out
.putVarUint64(self
.items_
)
3260 if (self
.has_bytes_
):
3262 out
.putVarUint64(self
.bytes_
)
3263 if (self
.has_oldest_item_age_
):
3265 out
.put32(self
.oldest_item_age_
)
3267 def TryMerge(self
, d
):
3268 while d
.avail() > 0:
3269 tt
= d
.getVarInt32()
3271 self
.set_hits(d
.getVarUint64())
3274 self
.set_misses(d
.getVarUint64())
3277 self
.set_byte_hits(d
.getVarUint64())
3280 self
.set_items(d
.getVarUint64())
3283 self
.set_bytes(d
.getVarUint64())
3286 self
.set_oldest_item_age(d
.get32())
3290 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3294 def __str__(self
, prefix
="", printElemNumber
=0):
3296 if self
.has_hits_
: res
+=prefix
+("hits: %s\n" % self
.DebugFormatInt64(self
.hits_
))
3297 if self
.has_misses_
: res
+=prefix
+("misses: %s\n" % self
.DebugFormatInt64(self
.misses_
))
3298 if self
.has_byte_hits_
: res
+=prefix
+("byte_hits: %s\n" % self
.DebugFormatInt64(self
.byte_hits_
))
3299 if self
.has_items_
: res
+=prefix
+("items: %s\n" % self
.DebugFormatInt64(self
.items_
))
3300 if self
.has_bytes_
: res
+=prefix
+("bytes: %s\n" % self
.DebugFormatInt64(self
.bytes_
))
3301 if self
.has_oldest_item_age_
: res
+=prefix
+("oldest_item_age: %s\n" % self
.DebugFormatFixed32(self
.oldest_item_age_
))
3305 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3306 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3313 koldest_item_age
= 6
3315 _TEXT
= _BuildTagLookupTable({
3322 6: "oldest_item_age",
3325 _TYPES
= _BuildTagLookupTable({
3326 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3327 1: ProtocolBuffer
.Encoder
.NUMERIC
,
3328 2: ProtocolBuffer
.Encoder
.NUMERIC
,
3329 3: ProtocolBuffer
.Encoder
.NUMERIC
,
3330 4: ProtocolBuffer
.Encoder
.NUMERIC
,
3331 5: ProtocolBuffer
.Encoder
.NUMERIC
,
3332 6: ProtocolBuffer
.Encoder
.FLOAT
,
3333 }, 6, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3337 _STYLE_CONTENT_TYPE
= """"""
3338 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MergedNamespaceStats'
3339 class MemcacheStatsResponse(ProtocolBuffer
.ProtocolMessage
):
3343 def __init__(self
, contents
=None):
3344 self
.lazy_init_lock_
= thread
.allocate_lock()
3345 if contents
is not None: self
.MergeFromString(contents
)
3348 if self
.stats_
is None:
3349 self
.lazy_init_lock_
.acquire()
3351 if self
.stats_
is None: self
.stats_
= MergedNamespaceStats()
3353 self
.lazy_init_lock_
.release()
3356 def mutable_stats(self
): self
.has_stats_
= 1; return self
.stats()
3358 def clear_stats(self
):
3361 self
.has_stats_
= 0;
3362 if self
.stats_
is not None: self
.stats_
.Clear()
3364 def has_stats(self
): return self
.has_stats_
3367 def MergeFrom(self
, x
):
3368 assert x
is not self
3369 if (x
.has_stats()): self
.mutable_stats().MergeFrom(x
.stats())
3371 def Equals(self
, x
):
3372 if x
is self
: return 1
3373 if self
.has_stats_
!= x
.has_stats_
: return 0
3374 if self
.has_stats_
and self
.stats_
!= x
.stats_
: return 0
3377 def IsInitialized(self
, debug_strs
=None):
3379 if (self
.has_stats_
and not self
.stats_
.IsInitialized(debug_strs
)): initialized
= 0
3384 if (self
.has_stats_
): n
+= 1 + self
.lengthString(self
.stats_
.ByteSize())
3387 def ByteSizePartial(self
):
3389 if (self
.has_stats_
): n
+= 1 + self
.lengthString(self
.stats_
.ByteSizePartial())
3395 def OutputUnchecked(self
, out
):
3396 if (self
.has_stats_
):
3398 out
.putVarInt32(self
.stats_
.ByteSize())
3399 self
.stats_
.OutputUnchecked(out
)
3401 def OutputPartial(self
, out
):
3402 if (self
.has_stats_
):
3404 out
.putVarInt32(self
.stats_
.ByteSizePartial())
3405 self
.stats_
.OutputPartial(out
)
3407 def TryMerge(self
, d
):
3408 while d
.avail() > 0:
3409 tt
= d
.getVarInt32()
3411 length
= d
.getVarInt32()
3412 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
3414 self
.mutable_stats().TryMerge(tmp
)
3418 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3422 def __str__(self
, prefix
="", printElemNumber
=0):
3425 res
+=prefix
+"stats <\n"
3426 res
+=self
.stats_
.__str
__(prefix
+ " ", printElemNumber
)
3431 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3432 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3436 _TEXT
= _BuildTagLookupTable({
3441 _TYPES
= _BuildTagLookupTable({
3442 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3443 1: ProtocolBuffer
.Encoder
.STRING
,
3444 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3448 _STYLE_CONTENT_TYPE
= """"""
3449 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheStatsResponse'
3450 class MemcacheGrabTailRequest(ProtocolBuffer
.ProtocolMessage
):
3458 def __init__(self
, contents
=None):
3459 self
.lazy_init_lock_
= thread
.allocate_lock()
3460 if contents
is not None: self
.MergeFromString(contents
)
3462 def item_count(self
): return self
.item_count_
3464 def set_item_count(self
, x
):
3465 self
.has_item_count_
= 1
3466 self
.item_count_
= x
3468 def clear_item_count(self
):
3469 if self
.has_item_count_
:
3470 self
.has_item_count_
= 0
3471 self
.item_count_
= 0
3473 def has_item_count(self
): return self
.has_item_count_
3475 def name_space(self
): return self
.name_space_
3477 def set_name_space(self
, x
):
3478 self
.has_name_space_
= 1
3479 self
.name_space_
= x
3481 def clear_name_space(self
):
3482 if self
.has_name_space_
:
3483 self
.has_name_space_
= 0
3484 self
.name_space_
= ""
3486 def has_name_space(self
): return self
.has_name_space_
3489 if self
.override_
is None:
3490 self
.lazy_init_lock_
.acquire()
3492 if self
.override_
is None: self
.override_
= AppOverride()
3494 self
.lazy_init_lock_
.release()
3495 return self
.override_
3497 def mutable_override(self
): self
.has_override_
= 1; return self
.override()
3499 def clear_override(self
):
3501 if self
.has_override_
:
3502 self
.has_override_
= 0;
3503 if self
.override_
is not None: self
.override_
.Clear()
3505 def has_override(self
): return self
.has_override_
3508 def MergeFrom(self
, x
):
3509 assert x
is not self
3510 if (x
.has_item_count()): self
.set_item_count(x
.item_count())
3511 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
3512 if (x
.has_override()): self
.mutable_override().MergeFrom(x
.override())
3514 def Equals(self
, x
):
3515 if x
is self
: return 1
3516 if self
.has_item_count_
!= x
.has_item_count_
: return 0
3517 if self
.has_item_count_
and self
.item_count_
!= x
.item_count_
: return 0
3518 if self
.has_name_space_
!= x
.has_name_space_
: return 0
3519 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
3520 if self
.has_override_
!= x
.has_override_
: return 0
3521 if self
.has_override_
and self
.override_
!= x
.override_
: return 0
3524 def IsInitialized(self
, debug_strs
=None):
3526 if (not self
.has_item_count_
):
3528 if debug_strs
is not None:
3529 debug_strs
.append('Required field: item_count not set.')
3530 if (self
.has_override_
and not self
.override_
.IsInitialized(debug_strs
)): initialized
= 0
3535 n
+= self
.lengthVarInt64(self
.item_count_
)
3536 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
3537 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSize())
3540 def ByteSizePartial(self
):
3542 if (self
.has_item_count_
):
3544 n
+= self
.lengthVarInt64(self
.item_count_
)
3545 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
3546 if (self
.has_override_
): n
+= 1 + self
.lengthString(self
.override_
.ByteSizePartial())
3550 self
.clear_item_count()
3551 self
.clear_name_space()
3552 self
.clear_override()
3554 def OutputUnchecked(self
, out
):
3556 out
.putVarInt32(self
.item_count_
)
3557 if (self
.has_name_space_
):
3559 out
.putPrefixedString(self
.name_space_
)
3560 if (self
.has_override_
):
3562 out
.putVarInt32(self
.override_
.ByteSize())
3563 self
.override_
.OutputUnchecked(out
)
3565 def OutputPartial(self
, out
):
3566 if (self
.has_item_count_
):
3568 out
.putVarInt32(self
.item_count_
)
3569 if (self
.has_name_space_
):
3571 out
.putPrefixedString(self
.name_space_
)
3572 if (self
.has_override_
):
3574 out
.putVarInt32(self
.override_
.ByteSizePartial())
3575 self
.override_
.OutputPartial(out
)
3577 def TryMerge(self
, d
):
3578 while d
.avail() > 0:
3579 tt
= d
.getVarInt32()
3581 self
.set_item_count(d
.getVarInt32())
3584 self
.set_name_space(d
.getPrefixedString())
3587 length
= d
.getVarInt32()
3588 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
3590 self
.mutable_override().TryMerge(tmp
)
3594 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3598 def __str__(self
, prefix
="", printElemNumber
=0):
3600 if self
.has_item_count_
: res
+=prefix
+("item_count: %s\n" % self
.DebugFormatInt32(self
.item_count_
))
3601 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
3602 if self
.has_override_
:
3603 res
+=prefix
+"override <\n"
3604 res
+=self
.override_
.__str
__(prefix
+ " ", printElemNumber
)
3609 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3610 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3616 _TEXT
= _BuildTagLookupTable({
3623 _TYPES
= _BuildTagLookupTable({
3624 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3625 1: ProtocolBuffer
.Encoder
.NUMERIC
,
3626 2: ProtocolBuffer
.Encoder
.STRING
,
3627 3: ProtocolBuffer
.Encoder
.STRING
,
3628 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3632 _STYLE_CONTENT_TYPE
= """"""
3633 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheGrabTailRequest'
3634 class MemcacheGrabTailResponse_Item(ProtocolBuffer
.ProtocolMessage
):
3640 def __init__(self
, contents
=None):
3641 if contents
is not None: self
.MergeFromString(contents
)
3643 def value(self
): return self
.value_
3645 def set_value(self
, x
):
3649 def clear_value(self
):
3654 def has_value(self
): return self
.has_value_
3656 def flags(self
): return self
.flags_
3658 def set_flags(self
, x
):
3662 def clear_flags(self
):
3667 def has_flags(self
): return self
.has_flags_
3670 def MergeFrom(self
, x
):
3671 assert x
is not self
3672 if (x
.has_value()): self
.set_value(x
.value())
3673 if (x
.has_flags()): self
.set_flags(x
.flags())
3675 def Equals(self
, x
):
3676 if x
is self
: return 1
3677 if self
.has_value_
!= x
.has_value_
: return 0
3678 if self
.has_value_
and self
.value_
!= x
.value_
: return 0
3679 if self
.has_flags_
!= x
.has_flags_
: return 0
3680 if self
.has_flags_
and self
.flags_
!= x
.flags_
: return 0
3683 def IsInitialized(self
, debug_strs
=None):
3685 if (not self
.has_value_
):
3687 if debug_strs
is not None:
3688 debug_strs
.append('Required field: value not set.')
3693 n
+= self
.lengthString(len(self
.value_
))
3694 if (self
.has_flags_
): n
+= 5
3697 def ByteSizePartial(self
):
3699 if (self
.has_value_
):
3701 n
+= self
.lengthString(len(self
.value_
))
3702 if (self
.has_flags_
): n
+= 5
3709 def OutputUnchecked(self
, out
):
3711 out
.putPrefixedString(self
.value_
)
3712 if (self
.has_flags_
):
3714 out
.put32(self
.flags_
)
3716 def OutputPartial(self
, out
):
3717 if (self
.has_value_
):
3719 out
.putPrefixedString(self
.value_
)
3720 if (self
.has_flags_
):
3722 out
.put32(self
.flags_
)
3724 def TryMerge(self
, d
):
3726 tt
= d
.getVarInt32()
3729 self
.set_value(d
.getPrefixedString())
3732 self
.set_flags(d
.get32())
3736 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3740 def __str__(self
, prefix
="", printElemNumber
=0):
3742 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
3743 if self
.has_flags_
: res
+=prefix
+("flags: %s\n" % self
.DebugFormatFixed32(self
.flags_
))
3746 class MemcacheGrabTailResponse(ProtocolBuffer
.ProtocolMessage
):
3748 def __init__(self
, contents
=None):
3750 if contents
is not None: self
.MergeFromString(contents
)
3752 def item_size(self
): return len(self
.item_
)
3753 def item_list(self
): return self
.item_
3756 return self
.item_
[i
]
3758 def mutable_item(self
, i
):
3759 return self
.item_
[i
]
3762 x
= MemcacheGrabTailResponse_Item()
3763 self
.item_
.append(x
)
3766 def clear_item(self
):
3769 def MergeFrom(self
, x
):
3770 assert x
is not self
3771 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
3773 def Equals(self
, x
):
3774 if x
is self
: return 1
3775 if len(self
.item_
) != len(x
.item_
): return 0
3776 for e1
, e2
in zip(self
.item_
, x
.item_
):
3777 if e1
!= e2
: return 0
3780 def IsInitialized(self
, debug_strs
=None):
3782 for p
in self
.item_
:
3783 if not p
.IsInitialized(debug_strs
): initialized
=0
3788 n
+= 2 * len(self
.item_
)
3789 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
3792 def ByteSizePartial(self
):
3794 n
+= 2 * len(self
.item_
)
3795 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSizePartial()
3801 def OutputUnchecked(self
, out
):
3802 for i
in xrange(len(self
.item_
)):
3804 self
.item_
[i
].OutputUnchecked(out
)
3807 def OutputPartial(self
, out
):
3808 for i
in xrange(len(self
.item_
)):
3810 self
.item_
[i
].OutputPartial(out
)
3813 def TryMerge(self
, d
):
3814 while d
.avail() > 0:
3815 tt
= d
.getVarInt32()
3817 self
.add_item().TryMerge(d
)
3821 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
3825 def __str__(self
, prefix
="", printElemNumber
=0):
3828 for e
in self
.item_
:
3830 if printElemNumber
: elm
="(%d)" % cnt
3831 res
+=prefix
+("Item%s {\n" % elm
)
3832 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
3838 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
3839 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
3845 _TEXT
= _BuildTagLookupTable({
3852 _TYPES
= _BuildTagLookupTable({
3853 0: ProtocolBuffer
.Encoder
.NUMERIC
,
3854 1: ProtocolBuffer
.Encoder
.STARTGROUP
,
3855 2: ProtocolBuffer
.Encoder
.STRING
,
3856 3: ProtocolBuffer
.Encoder
.FLOAT
,
3857 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
3861 _STYLE_CONTENT_TYPE
= """"""
3862 _PROTO_DESCRIPTOR_NAME
= 'apphosting.MemcacheGrabTailResponse'
3863 if _extension_runtime
:
3866 __all__
= ['MemcacheServiceError','AppOverride','MemcacheGetRequest','MemcacheGetResponse','MemcacheGetResponse_Item','MemcacheSetRequest','MemcacheSetRequest_Item','MemcacheSetResponse','MemcacheDeleteRequest','MemcacheDeleteRequest_Item','MemcacheDeleteResponse','MemcacheIncrementRequest','MemcacheIncrementResponse','MemcacheBatchIncrementRequest','MemcacheBatchIncrementResponse','MemcacheFlushRequest','MemcacheFlushResponse','MemcacheStatsRequest','MergedNamespaceStats','MemcacheStatsResponse','MemcacheGrabTailRequest','MemcacheGrabTailResponse','MemcacheGrabTailResponse_Item']