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.
18 from google
.net
.proto
import ProtocolBuffer
20 import dummy_thread
as thread
22 __pychecker__
= """maxreturns=0 maxbranches=0 no-callinit
23 unusednames=printElemNumber,debug_strs no-special"""
25 from google
.appengine
.api
.api_base_pb
import *
26 class MemcacheServiceError(ProtocolBuffer
.ProtocolMessage
):
33 1: "UNSPECIFIED_ERROR",
36 def ErrorCode_Name(cls
, x
): return cls
._ErrorCode
_NAMES
.get(x
, "")
37 ErrorCode_Name
= classmethod(ErrorCode_Name
)
40 def __init__(self
, contents
=None):
42 if contents
is not None: self
.MergeFromString(contents
)
45 def MergeFrom(self
, x
):
49 if x
is self
: return 1
52 def IsInitialized(self
, debug_strs
=None):
63 def OutputUnchecked(self
, out
):
66 def TryMerge(self
, d
):
69 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
73 def __str__(self
, prefix
="", printElemNumber
=0):
83 ProtocolBuffer
.Encoder
.NUMERIC
,
87 _STYLE_CONTENT_TYPE
= """"""
88 class MemcacheGetRequest(ProtocolBuffer
.ProtocolMessage
):
92 def __init__(self
, contents
=None):
94 if contents
is not None: self
.MergeFromString(contents
)
96 def key_size(self
): return len(self
.key_
)
97 def key_list(self
): return self
.key_
102 def set_key(self
, i
, x
):
105 def add_key(self
, x
):
111 def name_space(self
): return self
.name_space_
113 def set_name_space(self
, x
):
114 self
.has_name_space_
= 1
117 def clear_name_space(self
):
118 if self
.has_name_space_
:
119 self
.has_name_space_
= 0
120 self
.name_space_
= ""
122 def has_name_space(self
): return self
.has_name_space_
125 def MergeFrom(self
, x
):
127 for i
in xrange(x
.key_size()): self
.add_key(x
.key(i
))
128 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
131 if x
is self
: return 1
132 if len(self
.key_
) != len(x
.key_
): return 0
133 for e1
, e2
in zip(self
.key_
, x
.key_
):
134 if e1
!= e2
: return 0
135 if self
.has_name_space_
!= x
.has_name_space_
: return 0
136 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
139 def IsInitialized(self
, debug_strs
=None):
145 n
+= 1 * len(self
.key_
)
146 for i
in xrange(len(self
.key_
)): n
+= self
.lengthString(len(self
.key_
[i
]))
147 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
152 self
.clear_name_space()
154 def OutputUnchecked(self
, out
):
155 for i
in xrange(len(self
.key_
)):
157 out
.putPrefixedString(self
.key_
[i
])
158 if (self
.has_name_space_
):
160 out
.putPrefixedString(self
.name_space_
)
162 def TryMerge(self
, d
):
166 self
.add_key(d
.getPrefixedString())
169 self
.set_name_space(d
.getPrefixedString())
171 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
175 def __str__(self
, prefix
="", printElemNumber
=0):
180 if printElemNumber
: elm
="(%d)" % cnt
181 res
+=prefix
+("key%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
183 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
196 ProtocolBuffer
.Encoder
.NUMERIC
,
197 ProtocolBuffer
.Encoder
.STRING
,
199 ProtocolBuffer
.Encoder
.STRING
,
204 _STYLE_CONTENT_TYPE
= """"""
205 class MemcacheGetResponse_Item(ProtocolBuffer
.ProtocolMessage
):
213 def __init__(self
, contents
=None):
214 if contents
is not None: self
.MergeFromString(contents
)
216 def key(self
): return self
.key_
218 def set_key(self
, x
):
227 def has_key(self
): return self
.has_key_
229 def value(self
): return self
.value_
231 def set_value(self
, x
):
235 def clear_value(self
):
240 def has_value(self
): return self
.has_value_
242 def flags(self
): return self
.flags_
244 def set_flags(self
, x
):
248 def clear_flags(self
):
253 def has_flags(self
): return self
.has_flags_
256 def MergeFrom(self
, x
):
258 if (x
.has_key()): self
.set_key(x
.key())
259 if (x
.has_value()): self
.set_value(x
.value())
260 if (x
.has_flags()): self
.set_flags(x
.flags())
263 if x
is self
: return 1
264 if self
.has_key_
!= x
.has_key_
: return 0
265 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
266 if self
.has_value_
!= x
.has_value_
: return 0
267 if self
.has_value_
and self
.value_
!= x
.value_
: return 0
268 if self
.has_flags_
!= x
.has_flags_
: return 0
269 if self
.has_flags_
and self
.flags_
!= x
.flags_
: return 0
272 def IsInitialized(self
, debug_strs
=None):
274 if (not self
.has_key_
):
276 if debug_strs
is not None:
277 debug_strs
.append('Required field: key not set.')
278 if (not self
.has_value_
):
280 if debug_strs
is not None:
281 debug_strs
.append('Required field: value not set.')
286 n
+= self
.lengthString(len(self
.key_
))
287 n
+= self
.lengthString(len(self
.value_
))
288 if (self
.has_flags_
): n
+= 5
296 def OutputUnchecked(self
, out
):
298 out
.putPrefixedString(self
.key_
)
300 out
.putPrefixedString(self
.value_
)
301 if (self
.has_flags_
):
303 out
.put32(self
.flags_
)
305 def TryMerge(self
, d
):
310 self
.set_key(d
.getPrefixedString())
313 self
.set_value(d
.getPrefixedString())
316 self
.set_flags(d
.get32())
318 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
322 def __str__(self
, prefix
="", printElemNumber
=0):
324 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
325 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
326 if self
.has_flags_
: res
+=prefix
+("flags: %s\n" % self
.DebugFormatFixed32(self
.flags_
))
329 class MemcacheGetResponse(ProtocolBuffer
.ProtocolMessage
):
331 def __init__(self
, contents
=None):
333 if contents
is not None: self
.MergeFromString(contents
)
335 def item_size(self
): return len(self
.item_
)
336 def item_list(self
): return self
.item_
341 def mutable_item(self
, i
):
345 x
= MemcacheGetResponse_Item()
349 def clear_item(self
):
352 def MergeFrom(self
, x
):
354 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
357 if x
is self
: return 1
358 if len(self
.item_
) != len(x
.item_
): return 0
359 for e1
, e2
in zip(self
.item_
, x
.item_
):
360 if e1
!= e2
: return 0
363 def IsInitialized(self
, debug_strs
=None):
366 if not p
.IsInitialized(debug_strs
): initialized
=0
371 n
+= 2 * len(self
.item_
)
372 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
378 def OutputUnchecked(self
, out
):
379 for i
in xrange(len(self
.item_
)):
381 self
.item_
[i
].OutputUnchecked(out
)
384 def TryMerge(self
, d
):
388 self
.add_item().TryMerge(d
)
390 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
394 def __str__(self
, prefix
="", printElemNumber
=0):
399 if printElemNumber
: elm
="(%d)" % cnt
400 res
+=prefix
+("Item%s {\n" % elm
)
401 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
420 ProtocolBuffer
.Encoder
.NUMERIC
,
421 ProtocolBuffer
.Encoder
.STARTGROUP
,
423 ProtocolBuffer
.Encoder
.STRING
,
425 ProtocolBuffer
.Encoder
.STRING
,
427 ProtocolBuffer
.Encoder
.FLOAT
,
432 _STYLE_CONTENT_TYPE
= """"""
433 class MemcacheSetRequest_Item(ProtocolBuffer
.ProtocolMessage
):
442 has_expiration_time_
= 0
445 def __init__(self
, contents
=None):
446 if contents
is not None: self
.MergeFromString(contents
)
448 def key(self
): return self
.key_
450 def set_key(self
, x
):
459 def has_key(self
): return self
.has_key_
461 def value(self
): return self
.value_
463 def set_value(self
, x
):
467 def clear_value(self
):
472 def has_value(self
): return self
.has_value_
474 def flags(self
): return self
.flags_
476 def set_flags(self
, x
):
480 def clear_flags(self
):
485 def has_flags(self
): return self
.has_flags_
487 def set_policy(self
): return self
.set_policy_
489 def set_set_policy(self
, x
):
490 self
.has_set_policy_
= 1
493 def clear_set_policy(self
):
494 if self
.has_set_policy_
:
495 self
.has_set_policy_
= 0
498 def has_set_policy(self
): return self
.has_set_policy_
500 def expiration_time(self
): return self
.expiration_time_
502 def set_expiration_time(self
, x
):
503 self
.has_expiration_time_
= 1
504 self
.expiration_time_
= x
506 def clear_expiration_time(self
):
507 if self
.has_expiration_time_
:
508 self
.has_expiration_time_
= 0
509 self
.expiration_time_
= 0
511 def has_expiration_time(self
): return self
.has_expiration_time_
514 def MergeFrom(self
, x
):
516 if (x
.has_key()): self
.set_key(x
.key())
517 if (x
.has_value()): self
.set_value(x
.value())
518 if (x
.has_flags()): self
.set_flags(x
.flags())
519 if (x
.has_set_policy()): self
.set_set_policy(x
.set_policy())
520 if (x
.has_expiration_time()): self
.set_expiration_time(x
.expiration_time())
523 if x
is self
: return 1
524 if self
.has_key_
!= x
.has_key_
: return 0
525 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
526 if self
.has_value_
!= x
.has_value_
: return 0
527 if self
.has_value_
and self
.value_
!= x
.value_
: return 0
528 if self
.has_flags_
!= x
.has_flags_
: return 0
529 if self
.has_flags_
and self
.flags_
!= x
.flags_
: return 0
530 if self
.has_set_policy_
!= x
.has_set_policy_
: return 0
531 if self
.has_set_policy_
and self
.set_policy_
!= x
.set_policy_
: return 0
532 if self
.has_expiration_time_
!= x
.has_expiration_time_
: return 0
533 if self
.has_expiration_time_
and self
.expiration_time_
!= x
.expiration_time_
: return 0
536 def IsInitialized(self
, debug_strs
=None):
538 if (not self
.has_key_
):
540 if debug_strs
is not None:
541 debug_strs
.append('Required field: key not set.')
542 if (not self
.has_value_
):
544 if debug_strs
is not None:
545 debug_strs
.append('Required field: value not set.')
550 n
+= self
.lengthString(len(self
.key_
))
551 n
+= self
.lengthString(len(self
.value_
))
552 if (self
.has_flags_
): n
+= 5
553 if (self
.has_set_policy_
): n
+= 1 + self
.lengthVarInt64(self
.set_policy_
)
554 if (self
.has_expiration_time_
): n
+= 5
561 self
.clear_set_policy()
562 self
.clear_expiration_time()
564 def OutputUnchecked(self
, out
):
566 out
.putPrefixedString(self
.key_
)
568 out
.putPrefixedString(self
.value_
)
569 if (self
.has_flags_
):
571 out
.put32(self
.flags_
)
572 if (self
.has_set_policy_
):
574 out
.putVarInt32(self
.set_policy_
)
575 if (self
.has_expiration_time_
):
577 out
.put32(self
.expiration_time_
)
579 def TryMerge(self
, d
):
584 self
.set_key(d
.getPrefixedString())
587 self
.set_value(d
.getPrefixedString())
590 self
.set_flags(d
.get32())
593 self
.set_set_policy(d
.getVarInt32())
596 self
.set_expiration_time(d
.get32())
598 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
602 def __str__(self
, prefix
="", printElemNumber
=0):
604 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
605 if self
.has_value_
: res
+=prefix
+("value: %s\n" % self
.DebugFormatString(self
.value_
))
606 if self
.has_flags_
: res
+=prefix
+("flags: %s\n" % self
.DebugFormatFixed32(self
.flags_
))
607 if self
.has_set_policy_
: res
+=prefix
+("set_policy: %s\n" % self
.DebugFormatInt32(self
.set_policy_
))
608 if self
.has_expiration_time_
: res
+=prefix
+("expiration_time: %s\n" % self
.DebugFormatFixed32(self
.expiration_time_
))
611 class MemcacheSetRequest(ProtocolBuffer
.ProtocolMessage
):
623 def SetPolicy_Name(cls
, x
): return cls
._SetPolicy
_NAMES
.get(x
, "")
624 SetPolicy_Name
= classmethod(SetPolicy_Name
)
629 def __init__(self
, contents
=None):
631 if contents
is not None: self
.MergeFromString(contents
)
633 def item_size(self
): return len(self
.item_
)
634 def item_list(self
): return self
.item_
639 def mutable_item(self
, i
):
643 x
= MemcacheSetRequest_Item()
647 def clear_item(self
):
649 def name_space(self
): return self
.name_space_
651 def set_name_space(self
, x
):
652 self
.has_name_space_
= 1
655 def clear_name_space(self
):
656 if self
.has_name_space_
:
657 self
.has_name_space_
= 0
658 self
.name_space_
= ""
660 def has_name_space(self
): return self
.has_name_space_
663 def MergeFrom(self
, x
):
665 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
666 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
669 if x
is self
: return 1
670 if len(self
.item_
) != len(x
.item_
): return 0
671 for e1
, e2
in zip(self
.item_
, x
.item_
):
672 if e1
!= e2
: return 0
673 if self
.has_name_space_
!= x
.has_name_space_
: return 0
674 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
677 def IsInitialized(self
, debug_strs
=None):
680 if not p
.IsInitialized(debug_strs
): initialized
=0
685 n
+= 2 * len(self
.item_
)
686 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
687 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
692 self
.clear_name_space()
694 def OutputUnchecked(self
, out
):
695 for i
in xrange(len(self
.item_
)):
697 self
.item_
[i
].OutputUnchecked(out
)
699 if (self
.has_name_space_
):
701 out
.putPrefixedString(self
.name_space_
)
703 def TryMerge(self
, d
):
707 self
.add_item().TryMerge(d
)
710 self
.set_name_space(d
.getPrefixedString())
712 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
716 def __str__(self
, prefix
="", printElemNumber
=0):
721 if printElemNumber
: elm
="(%d)" % cnt
722 res
+=prefix
+("Item%s {\n" % elm
)
723 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
726 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
734 kItemexpiration_time
= 6
749 ProtocolBuffer
.Encoder
.NUMERIC
,
750 ProtocolBuffer
.Encoder
.STARTGROUP
,
752 ProtocolBuffer
.Encoder
.STRING
,
754 ProtocolBuffer
.Encoder
.STRING
,
756 ProtocolBuffer
.Encoder
.FLOAT
,
758 ProtocolBuffer
.Encoder
.NUMERIC
,
760 ProtocolBuffer
.Encoder
.FLOAT
,
762 ProtocolBuffer
.Encoder
.STRING
,
767 _STYLE_CONTENT_TYPE
= """"""
768 class MemcacheSetResponse(ProtocolBuffer
.ProtocolMessage
):
774 _SetStatusCode_NAMES
= {
780 def SetStatusCode_Name(cls
, x
): return cls
._SetStatusCode
_NAMES
.get(x
, "")
781 SetStatusCode_Name
= classmethod(SetStatusCode_Name
)
784 def __init__(self
, contents
=None):
785 self
.set_status_
= []
786 if contents
is not None: self
.MergeFromString(contents
)
788 def set_status_size(self
): return len(self
.set_status_
)
789 def set_status_list(self
): return self
.set_status_
791 def set_status(self
, i
):
792 return self
.set_status_
[i
]
794 def set_set_status(self
, i
, x
):
795 self
.set_status_
[i
] = x
797 def add_set_status(self
, x
):
798 self
.set_status_
.append(x
)
800 def clear_set_status(self
):
801 self
.set_status_
= []
804 def MergeFrom(self
, x
):
806 for i
in xrange(x
.set_status_size()): self
.add_set_status(x
.set_status(i
))
809 if x
is self
: return 1
810 if len(self
.set_status_
) != len(x
.set_status_
): return 0
811 for e1
, e2
in zip(self
.set_status_
, x
.set_status_
):
812 if e1
!= e2
: return 0
815 def IsInitialized(self
, debug_strs
=None):
821 n
+= 1 * len(self
.set_status_
)
822 for i
in xrange(len(self
.set_status_
)): n
+= self
.lengthVarInt64(self
.set_status_
[i
])
826 self
.clear_set_status()
828 def OutputUnchecked(self
, out
):
829 for i
in xrange(len(self
.set_status_
)):
831 out
.putVarInt32(self
.set_status_
[i
])
833 def TryMerge(self
, d
):
837 self
.add_set_status(d
.getVarInt32())
839 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
843 def __str__(self
, prefix
="", printElemNumber
=0):
846 for e
in self
.set_status_
:
848 if printElemNumber
: elm
="(%d)" % cnt
849 res
+=prefix
+("set_status%s: %s\n" % (elm
, self
.DebugFormatInt32(e
)))
861 ProtocolBuffer
.Encoder
.NUMERIC
,
862 ProtocolBuffer
.Encoder
.NUMERIC
,
867 _STYLE_CONTENT_TYPE
= """"""
868 class MemcacheDeleteRequest_Item(ProtocolBuffer
.ProtocolMessage
):
874 def __init__(self
, contents
=None):
875 if contents
is not None: self
.MergeFromString(contents
)
877 def key(self
): return self
.key_
879 def set_key(self
, x
):
888 def has_key(self
): return self
.has_key_
890 def delete_time(self
): return self
.delete_time_
892 def set_delete_time(self
, x
):
893 self
.has_delete_time_
= 1
894 self
.delete_time_
= x
896 def clear_delete_time(self
):
897 if self
.has_delete_time_
:
898 self
.has_delete_time_
= 0
899 self
.delete_time_
= 0
901 def has_delete_time(self
): return self
.has_delete_time_
904 def MergeFrom(self
, x
):
906 if (x
.has_key()): self
.set_key(x
.key())
907 if (x
.has_delete_time()): self
.set_delete_time(x
.delete_time())
910 if x
is self
: return 1
911 if self
.has_key_
!= x
.has_key_
: return 0
912 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
913 if self
.has_delete_time_
!= x
.has_delete_time_
: return 0
914 if self
.has_delete_time_
and self
.delete_time_
!= x
.delete_time_
: return 0
917 def IsInitialized(self
, debug_strs
=None):
919 if (not self
.has_key_
):
921 if debug_strs
is not None:
922 debug_strs
.append('Required field: key not set.')
927 n
+= self
.lengthString(len(self
.key_
))
928 if (self
.has_delete_time_
): n
+= 5
933 self
.clear_delete_time()
935 def OutputUnchecked(self
, out
):
937 out
.putPrefixedString(self
.key_
)
938 if (self
.has_delete_time_
):
940 out
.put32(self
.delete_time_
)
942 def TryMerge(self
, d
):
947 self
.set_key(d
.getPrefixedString())
950 self
.set_delete_time(d
.get32())
952 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
956 def __str__(self
, prefix
="", printElemNumber
=0):
958 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
959 if self
.has_delete_time_
: res
+=prefix
+("delete_time: %s\n" % self
.DebugFormatFixed32(self
.delete_time_
))
962 class MemcacheDeleteRequest(ProtocolBuffer
.ProtocolMessage
):
966 def __init__(self
, contents
=None):
968 if contents
is not None: self
.MergeFromString(contents
)
970 def item_size(self
): return len(self
.item_
)
971 def item_list(self
): return self
.item_
976 def mutable_item(self
, i
):
980 x
= MemcacheDeleteRequest_Item()
984 def clear_item(self
):
986 def name_space(self
): return self
.name_space_
988 def set_name_space(self
, x
):
989 self
.has_name_space_
= 1
992 def clear_name_space(self
):
993 if self
.has_name_space_
:
994 self
.has_name_space_
= 0
995 self
.name_space_
= ""
997 def has_name_space(self
): return self
.has_name_space_
1000 def MergeFrom(self
, x
):
1001 assert x
is not self
1002 for i
in xrange(x
.item_size()): self
.add_item().CopyFrom(x
.item(i
))
1003 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
1005 def Equals(self
, x
):
1006 if x
is self
: return 1
1007 if len(self
.item_
) != len(x
.item_
): return 0
1008 for e1
, e2
in zip(self
.item_
, x
.item_
):
1009 if e1
!= e2
: return 0
1010 if self
.has_name_space_
!= x
.has_name_space_
: return 0
1011 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
1014 def IsInitialized(self
, debug_strs
=None):
1016 for p
in self
.item_
:
1017 if not p
.IsInitialized(debug_strs
): initialized
=0
1022 n
+= 2 * len(self
.item_
)
1023 for i
in xrange(len(self
.item_
)): n
+= self
.item_
[i
].ByteSize()
1024 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
1029 self
.clear_name_space()
1031 def OutputUnchecked(self
, out
):
1032 for i
in xrange(len(self
.item_
)):
1034 self
.item_
[i
].OutputUnchecked(out
)
1036 if (self
.has_name_space_
):
1038 out
.putPrefixedString(self
.name_space_
)
1040 def TryMerge(self
, d
):
1041 while d
.avail() > 0:
1042 tt
= d
.getVarInt32()
1044 self
.add_item().TryMerge(d
)
1047 self
.set_name_space(d
.getPrefixedString())
1049 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1053 def __str__(self
, prefix
="", printElemNumber
=0):
1056 for e
in self
.item_
:
1058 if printElemNumber
: elm
="(%d)" % cnt
1059 res
+=prefix
+("Item%s {\n" % elm
)
1060 res
+=e
.__str
__(prefix
+ " ", printElemNumber
)
1063 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
1068 kItemdelete_time
= 3
1080 ProtocolBuffer
.Encoder
.NUMERIC
,
1081 ProtocolBuffer
.Encoder
.STARTGROUP
,
1083 ProtocolBuffer
.Encoder
.STRING
,
1085 ProtocolBuffer
.Encoder
.FLOAT
,
1087 ProtocolBuffer
.Encoder
.STRING
,
1092 _STYLE_CONTENT_TYPE
= """"""
1093 class MemcacheDeleteResponse(ProtocolBuffer
.ProtocolMessage
):
1098 _DeleteStatusCode_NAMES
= {
1103 def DeleteStatusCode_Name(cls
, x
): return cls
._DeleteStatusCode
_NAMES
.get(x
, "")
1104 DeleteStatusCode_Name
= classmethod(DeleteStatusCode_Name
)
1107 def __init__(self
, contents
=None):
1108 self
.delete_status_
= []
1109 if contents
is not None: self
.MergeFromString(contents
)
1111 def delete_status_size(self
): return len(self
.delete_status_
)
1112 def delete_status_list(self
): return self
.delete_status_
1114 def delete_status(self
, i
):
1115 return self
.delete_status_
[i
]
1117 def set_delete_status(self
, i
, x
):
1118 self
.delete_status_
[i
] = x
1120 def add_delete_status(self
, x
):
1121 self
.delete_status_
.append(x
)
1123 def clear_delete_status(self
):
1124 self
.delete_status_
= []
1127 def MergeFrom(self
, x
):
1128 assert x
is not self
1129 for i
in xrange(x
.delete_status_size()): self
.add_delete_status(x
.delete_status(i
))
1131 def Equals(self
, x
):
1132 if x
is self
: return 1
1133 if len(self
.delete_status_
) != len(x
.delete_status_
): return 0
1134 for e1
, e2
in zip(self
.delete_status_
, x
.delete_status_
):
1135 if e1
!= e2
: return 0
1138 def IsInitialized(self
, debug_strs
=None):
1144 n
+= 1 * len(self
.delete_status_
)
1145 for i
in xrange(len(self
.delete_status_
)): n
+= self
.lengthVarInt64(self
.delete_status_
[i
])
1149 self
.clear_delete_status()
1151 def OutputUnchecked(self
, out
):
1152 for i
in xrange(len(self
.delete_status_
)):
1154 out
.putVarInt32(self
.delete_status_
[i
])
1156 def TryMerge(self
, d
):
1157 while d
.avail() > 0:
1158 tt
= d
.getVarInt32()
1160 self
.add_delete_status(d
.getVarInt32())
1162 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1166 def __str__(self
, prefix
="", printElemNumber
=0):
1169 for e
in self
.delete_status_
:
1171 if printElemNumber
: elm
="(%d)" % cnt
1172 res
+=prefix
+("delete_status%s: %s\n" % (elm
, self
.DebugFormatInt32(e
)))
1184 ProtocolBuffer
.Encoder
.NUMERIC
,
1185 ProtocolBuffer
.Encoder
.NUMERIC
,
1190 _STYLE_CONTENT_TYPE
= """"""
1191 class MemcacheIncrementRequest(ProtocolBuffer
.ProtocolMessage
):
1196 _Direction_NAMES
= {
1201 def Direction_Name(cls
, x
): return cls
._Direction
_NAMES
.get(x
, "")
1202 Direction_Name
= classmethod(Direction_Name
)
1213 def __init__(self
, contents
=None):
1214 if contents
is not None: self
.MergeFromString(contents
)
1216 def key(self
): return self
.key_
1218 def set_key(self
, x
):
1222 def clear_key(self
):
1227 def has_key(self
): return self
.has_key_
1229 def name_space(self
): return self
.name_space_
1231 def set_name_space(self
, x
):
1232 self
.has_name_space_
= 1
1233 self
.name_space_
= x
1235 def clear_name_space(self
):
1236 if self
.has_name_space_
:
1237 self
.has_name_space_
= 0
1238 self
.name_space_
= ""
1240 def has_name_space(self
): return self
.has_name_space_
1242 def delta(self
): return self
.delta_
1244 def set_delta(self
, x
):
1248 def clear_delta(self
):
1253 def has_delta(self
): return self
.has_delta_
1255 def direction(self
): return self
.direction_
1257 def set_direction(self
, x
):
1258 self
.has_direction_
= 1
1261 def clear_direction(self
):
1262 if self
.has_direction_
:
1263 self
.has_direction_
= 0
1266 def has_direction(self
): return self
.has_direction_
1269 def MergeFrom(self
, x
):
1270 assert x
is not self
1271 if (x
.has_key()): self
.set_key(x
.key())
1272 if (x
.has_name_space()): self
.set_name_space(x
.name_space())
1273 if (x
.has_delta()): self
.set_delta(x
.delta())
1274 if (x
.has_direction()): self
.set_direction(x
.direction())
1276 def Equals(self
, x
):
1277 if x
is self
: return 1
1278 if self
.has_key_
!= x
.has_key_
: return 0
1279 if self
.has_key_
and self
.key_
!= x
.key_
: return 0
1280 if self
.has_name_space_
!= x
.has_name_space_
: return 0
1281 if self
.has_name_space_
and self
.name_space_
!= x
.name_space_
: return 0
1282 if self
.has_delta_
!= x
.has_delta_
: return 0
1283 if self
.has_delta_
and self
.delta_
!= x
.delta_
: return 0
1284 if self
.has_direction_
!= x
.has_direction_
: return 0
1285 if self
.has_direction_
and self
.direction_
!= x
.direction_
: return 0
1288 def IsInitialized(self
, debug_strs
=None):
1290 if (not self
.has_key_
):
1292 if debug_strs
is not None:
1293 debug_strs
.append('Required field: key not set.')
1298 n
+= self
.lengthString(len(self
.key_
))
1299 if (self
.has_name_space_
): n
+= 1 + self
.lengthString(len(self
.name_space_
))
1300 if (self
.has_delta_
): n
+= 1 + self
.lengthVarInt64(self
.delta_
)
1301 if (self
.has_direction_
): n
+= 1 + self
.lengthVarInt64(self
.direction_
)
1306 self
.clear_name_space()
1308 self
.clear_direction()
1310 def OutputUnchecked(self
, out
):
1312 out
.putPrefixedString(self
.key_
)
1313 if (self
.has_delta_
):
1315 out
.putVarUint64(self
.delta_
)
1316 if (self
.has_direction_
):
1318 out
.putVarInt32(self
.direction_
)
1319 if (self
.has_name_space_
):
1321 out
.putPrefixedString(self
.name_space_
)
1323 def TryMerge(self
, d
):
1324 while d
.avail() > 0:
1325 tt
= d
.getVarInt32()
1327 self
.set_key(d
.getPrefixedString())
1330 self
.set_delta(d
.getVarUint64())
1333 self
.set_direction(d
.getVarInt32())
1336 self
.set_name_space(d
.getPrefixedString())
1338 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1342 def __str__(self
, prefix
="", printElemNumber
=0):
1344 if self
.has_key_
: res
+=prefix
+("key: %s\n" % self
.DebugFormatString(self
.key_
))
1345 if self
.has_name_space_
: res
+=prefix
+("name_space: %s\n" % self
.DebugFormatString(self
.name_space_
))
1346 if self
.has_delta_
: res
+=prefix
+("delta: %s\n" % self
.DebugFormatInt64(self
.delta_
))
1347 if self
.has_direction_
: res
+=prefix
+("direction: %s\n" % self
.DebugFormatInt32(self
.direction_
))
1364 ProtocolBuffer
.Encoder
.NUMERIC
,
1365 ProtocolBuffer
.Encoder
.STRING
,
1367 ProtocolBuffer
.Encoder
.NUMERIC
,
1369 ProtocolBuffer
.Encoder
.NUMERIC
,
1371 ProtocolBuffer
.Encoder
.STRING
,
1376 _STYLE_CONTENT_TYPE
= """"""
1377 class MemcacheIncrementResponse(ProtocolBuffer
.ProtocolMessage
):
1381 def __init__(self
, contents
=None):
1382 if contents
is not None: self
.MergeFromString(contents
)
1384 def new_value(self
): return self
.new_value_
1386 def set_new_value(self
, x
):
1387 self
.has_new_value_
= 1
1390 def clear_new_value(self
):
1391 if self
.has_new_value_
:
1392 self
.has_new_value_
= 0
1395 def has_new_value(self
): return self
.has_new_value_
1398 def MergeFrom(self
, x
):
1399 assert x
is not self
1400 if (x
.has_new_value()): self
.set_new_value(x
.new_value())
1402 def Equals(self
, x
):
1403 if x
is self
: return 1
1404 if self
.has_new_value_
!= x
.has_new_value_
: return 0
1405 if self
.has_new_value_
and self
.new_value_
!= x
.new_value_
: return 0
1408 def IsInitialized(self
, debug_strs
=None):
1414 if (self
.has_new_value_
): n
+= 1 + self
.lengthVarInt64(self
.new_value_
)
1418 self
.clear_new_value()
1420 def OutputUnchecked(self
, out
):
1421 if (self
.has_new_value_
):
1423 out
.putVarUint64(self
.new_value_
)
1425 def TryMerge(self
, d
):
1426 while d
.avail() > 0:
1427 tt
= d
.getVarInt32()
1429 self
.set_new_value(d
.getVarUint64())
1431 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1435 def __str__(self
, prefix
="", printElemNumber
=0):
1437 if self
.has_new_value_
: res
+=prefix
+("new_value: %s\n" % self
.DebugFormatInt64(self
.new_value_
))
1448 ProtocolBuffer
.Encoder
.NUMERIC
,
1449 ProtocolBuffer
.Encoder
.NUMERIC
,
1454 _STYLE_CONTENT_TYPE
= """"""
1455 class MemcacheFlushRequest(ProtocolBuffer
.ProtocolMessage
):
1457 def __init__(self
, contents
=None):
1459 if contents
is not None: self
.MergeFromString(contents
)
1462 def MergeFrom(self
, x
):
1463 assert x
is not self
1465 def Equals(self
, x
):
1466 if x
is self
: return 1
1469 def IsInitialized(self
, debug_strs
=None):
1480 def OutputUnchecked(self
, out
):
1483 def TryMerge(self
, d
):
1484 while d
.avail() > 0:
1485 tt
= d
.getVarInt32()
1486 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1490 def __str__(self
, prefix
="", printElemNumber
=0):
1500 ProtocolBuffer
.Encoder
.NUMERIC
,
1504 _STYLE_CONTENT_TYPE
= """"""
1505 class MemcacheFlushResponse(ProtocolBuffer
.ProtocolMessage
):
1507 def __init__(self
, contents
=None):
1509 if contents
is not None: self
.MergeFromString(contents
)
1512 def MergeFrom(self
, x
):
1513 assert x
is not self
1515 def Equals(self
, x
):
1516 if x
is self
: return 1
1519 def IsInitialized(self
, debug_strs
=None):
1530 def OutputUnchecked(self
, out
):
1533 def TryMerge(self
, d
):
1534 while d
.avail() > 0:
1535 tt
= d
.getVarInt32()
1536 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1540 def __str__(self
, prefix
="", printElemNumber
=0):
1550 ProtocolBuffer
.Encoder
.NUMERIC
,
1554 _STYLE_CONTENT_TYPE
= """"""
1555 class MemcacheStatsRequest(ProtocolBuffer
.ProtocolMessage
):
1557 def __init__(self
, contents
=None):
1559 if contents
is not None: self
.MergeFromString(contents
)
1562 def MergeFrom(self
, x
):
1563 assert x
is not self
1565 def Equals(self
, x
):
1566 if x
is self
: return 1
1569 def IsInitialized(self
, debug_strs
=None):
1580 def OutputUnchecked(self
, out
):
1583 def TryMerge(self
, d
):
1584 while d
.avail() > 0:
1585 tt
= d
.getVarInt32()
1586 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1590 def __str__(self
, prefix
="", printElemNumber
=0):
1600 ProtocolBuffer
.Encoder
.NUMERIC
,
1604 _STYLE_CONTENT_TYPE
= """"""
1605 class MergedNamespaceStats(ProtocolBuffer
.ProtocolMessage
):
1616 has_oldest_item_age_
= 0
1617 oldest_item_age_
= 0
1619 def __init__(self
, contents
=None):
1620 if contents
is not None: self
.MergeFromString(contents
)
1622 def hits(self
): return self
.hits_
1624 def set_hits(self
, x
):
1628 def clear_hits(self
):
1633 def has_hits(self
): return self
.has_hits_
1635 def misses(self
): return self
.misses_
1637 def set_misses(self
, x
):
1638 self
.has_misses_
= 1
1641 def clear_misses(self
):
1642 if self
.has_misses_
:
1643 self
.has_misses_
= 0
1646 def has_misses(self
): return self
.has_misses_
1648 def byte_hits(self
): return self
.byte_hits_
1650 def set_byte_hits(self
, x
):
1651 self
.has_byte_hits_
= 1
1654 def clear_byte_hits(self
):
1655 if self
.has_byte_hits_
:
1656 self
.has_byte_hits_
= 0
1659 def has_byte_hits(self
): return self
.has_byte_hits_
1661 def items(self
): return self
.items_
1663 def set_items(self
, x
):
1667 def clear_items(self
):
1672 def has_items(self
): return self
.has_items_
1674 def bytes(self
): return self
.bytes_
1676 def set_bytes(self
, x
):
1680 def clear_bytes(self
):
1685 def has_bytes(self
): return self
.has_bytes_
1687 def oldest_item_age(self
): return self
.oldest_item_age_
1689 def set_oldest_item_age(self
, x
):
1690 self
.has_oldest_item_age_
= 1
1691 self
.oldest_item_age_
= x
1693 def clear_oldest_item_age(self
):
1694 if self
.has_oldest_item_age_
:
1695 self
.has_oldest_item_age_
= 0
1696 self
.oldest_item_age_
= 0
1698 def has_oldest_item_age(self
): return self
.has_oldest_item_age_
1701 def MergeFrom(self
, x
):
1702 assert x
is not self
1703 if (x
.has_hits()): self
.set_hits(x
.hits())
1704 if (x
.has_misses()): self
.set_misses(x
.misses())
1705 if (x
.has_byte_hits()): self
.set_byte_hits(x
.byte_hits())
1706 if (x
.has_items()): self
.set_items(x
.items())
1707 if (x
.has_bytes()): self
.set_bytes(x
.bytes())
1708 if (x
.has_oldest_item_age()): self
.set_oldest_item_age(x
.oldest_item_age())
1710 def Equals(self
, x
):
1711 if x
is self
: return 1
1712 if self
.has_hits_
!= x
.has_hits_
: return 0
1713 if self
.has_hits_
and self
.hits_
!= x
.hits_
: return 0
1714 if self
.has_misses_
!= x
.has_misses_
: return 0
1715 if self
.has_misses_
and self
.misses_
!= x
.misses_
: return 0
1716 if self
.has_byte_hits_
!= x
.has_byte_hits_
: return 0
1717 if self
.has_byte_hits_
and self
.byte_hits_
!= x
.byte_hits_
: return 0
1718 if self
.has_items_
!= x
.has_items_
: return 0
1719 if self
.has_items_
and self
.items_
!= x
.items_
: return 0
1720 if self
.has_bytes_
!= x
.has_bytes_
: return 0
1721 if self
.has_bytes_
and self
.bytes_
!= x
.bytes_
: return 0
1722 if self
.has_oldest_item_age_
!= x
.has_oldest_item_age_
: return 0
1723 if self
.has_oldest_item_age_
and self
.oldest_item_age_
!= x
.oldest_item_age_
: return 0
1726 def IsInitialized(self
, debug_strs
=None):
1728 if (not self
.has_hits_
):
1730 if debug_strs
is not None:
1731 debug_strs
.append('Required field: hits not set.')
1732 if (not self
.has_misses_
):
1734 if debug_strs
is not None:
1735 debug_strs
.append('Required field: misses not set.')
1736 if (not self
.has_byte_hits_
):
1738 if debug_strs
is not None:
1739 debug_strs
.append('Required field: byte_hits not set.')
1740 if (not self
.has_items_
):
1742 if debug_strs
is not None:
1743 debug_strs
.append('Required field: items not set.')
1744 if (not self
.has_bytes_
):
1746 if debug_strs
is not None:
1747 debug_strs
.append('Required field: bytes not set.')
1748 if (not self
.has_oldest_item_age_
):
1750 if debug_strs
is not None:
1751 debug_strs
.append('Required field: oldest_item_age not set.')
1756 n
+= self
.lengthVarInt64(self
.hits_
)
1757 n
+= self
.lengthVarInt64(self
.misses_
)
1758 n
+= self
.lengthVarInt64(self
.byte_hits_
)
1759 n
+= self
.lengthVarInt64(self
.items_
)
1760 n
+= self
.lengthVarInt64(self
.bytes_
)
1766 self
.clear_byte_hits()
1769 self
.clear_oldest_item_age()
1771 def OutputUnchecked(self
, out
):
1773 out
.putVarUint64(self
.hits_
)
1775 out
.putVarUint64(self
.misses_
)
1777 out
.putVarUint64(self
.byte_hits_
)
1779 out
.putVarUint64(self
.items_
)
1781 out
.putVarUint64(self
.bytes_
)
1783 out
.put32(self
.oldest_item_age_
)
1785 def TryMerge(self
, d
):
1786 while d
.avail() > 0:
1787 tt
= d
.getVarInt32()
1789 self
.set_hits(d
.getVarUint64())
1792 self
.set_misses(d
.getVarUint64())
1795 self
.set_byte_hits(d
.getVarUint64())
1798 self
.set_items(d
.getVarUint64())
1801 self
.set_bytes(d
.getVarUint64())
1804 self
.set_oldest_item_age(d
.get32())
1806 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1810 def __str__(self
, prefix
="", printElemNumber
=0):
1812 if self
.has_hits_
: res
+=prefix
+("hits: %s\n" % self
.DebugFormatInt64(self
.hits_
))
1813 if self
.has_misses_
: res
+=prefix
+("misses: %s\n" % self
.DebugFormatInt64(self
.misses_
))
1814 if self
.has_byte_hits_
: res
+=prefix
+("byte_hits: %s\n" % self
.DebugFormatInt64(self
.byte_hits_
))
1815 if self
.has_items_
: res
+=prefix
+("items: %s\n" % self
.DebugFormatInt64(self
.items_
))
1816 if self
.has_bytes_
: res
+=prefix
+("bytes: %s\n" % self
.DebugFormatInt64(self
.bytes_
))
1817 if self
.has_oldest_item_age_
: res
+=prefix
+("oldest_item_age: %s\n" % self
.DebugFormatFixed32(self
.oldest_item_age_
))
1825 koldest_item_age
= 6
1838 ProtocolBuffer
.Encoder
.NUMERIC
,
1839 ProtocolBuffer
.Encoder
.NUMERIC
,
1841 ProtocolBuffer
.Encoder
.NUMERIC
,
1843 ProtocolBuffer
.Encoder
.NUMERIC
,
1845 ProtocolBuffer
.Encoder
.NUMERIC
,
1847 ProtocolBuffer
.Encoder
.NUMERIC
,
1849 ProtocolBuffer
.Encoder
.FLOAT
,
1854 _STYLE_CONTENT_TYPE
= """"""
1855 class MemcacheStatsResponse(ProtocolBuffer
.ProtocolMessage
):
1859 def __init__(self
, contents
=None):
1860 self
.lazy_init_lock_
= thread
.allocate_lock()
1861 if contents
is not None: self
.MergeFromString(contents
)
1864 if self
.stats_
is None:
1865 self
.lazy_init_lock_
.acquire()
1867 if self
.stats_
is None: self
.stats_
= MergedNamespaceStats()
1869 self
.lazy_init_lock_
.release()
1872 def mutable_stats(self
): self
.has_stats_
= 1; return self
.stats()
1874 def clear_stats(self
):
1876 self
.has_stats_
= 0;
1877 if self
.stats_
is not None: self
.stats_
.Clear()
1879 def has_stats(self
): return self
.has_stats_
1882 def MergeFrom(self
, x
):
1883 assert x
is not self
1884 if (x
.has_stats()): self
.mutable_stats().MergeFrom(x
.stats())
1886 def Equals(self
, x
):
1887 if x
is self
: return 1
1888 if self
.has_stats_
!= x
.has_stats_
: return 0
1889 if self
.has_stats_
and self
.stats_
!= x
.stats_
: return 0
1892 def IsInitialized(self
, debug_strs
=None):
1894 if (self
.has_stats_
and not self
.stats_
.IsInitialized(debug_strs
)): initialized
= 0
1899 if (self
.has_stats_
): n
+= 1 + self
.lengthString(self
.stats_
.ByteSize())
1905 def OutputUnchecked(self
, out
):
1906 if (self
.has_stats_
):
1908 out
.putVarInt32(self
.stats_
.ByteSize())
1909 self
.stats_
.OutputUnchecked(out
)
1911 def TryMerge(self
, d
):
1912 while d
.avail() > 0:
1913 tt
= d
.getVarInt32()
1915 length
= d
.getVarInt32()
1916 tmp
= ProtocolBuffer
.Decoder(d
.buffer(), d
.pos(), d
.pos() + length
)
1918 self
.mutable_stats().TryMerge(tmp
)
1920 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1924 def __str__(self
, prefix
="", printElemNumber
=0):
1927 res
+=prefix
+"stats <\n"
1928 res
+=self
.stats_
.__str
__(prefix
+ " ", printElemNumber
)
1940 ProtocolBuffer
.Encoder
.NUMERIC
,
1941 ProtocolBuffer
.Encoder
.STRING
,
1946 _STYLE_CONTENT_TYPE
= """"""
1948 __all__
= ['MemcacheServiceError','MemcacheGetRequest','MemcacheGetResponse','MemcacheGetResponse_Item','MemcacheSetRequest','MemcacheSetRequest_Item','MemcacheSetResponse','MemcacheDeleteRequest','MemcacheDeleteRequest_Item','MemcacheDeleteResponse','MemcacheIncrementRequest','MemcacheIncrementResponse','MemcacheFlushRequest','MemcacheFlushResponse','MemcacheStatsRequest','MergedNamespaceStats','MemcacheStatsResponse']