本文整理汇总了Python中kazoo.protocol.states.ZnodeStat类的典型用法代码示例。如果您正苦于以下问题:Python ZnodeStat类的具体用法?Python ZnodeStat怎么用?Python ZnodeStat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZnodeStat类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deserialize
def deserialize(cls, bytes, offset):
count = int_struct.unpack_from(bytes, offset)[0]
offset += int_struct.size
if count == -1: # pragma: nocover
return []
children = []
for c in range(count):
child, offset = read_string(bytes, offset)
children.append(child)
stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
return children, stat
示例2: deserialize
def deserialize(cls, bytes, offset):
header = MultiHeader(None, False, None)
results = []
response = None
while not header.done:
if header.type == Create.type:
response, offset = read_string(bytes, offset)
elif header.type == Delete.type:
response = True
elif header.type == SetData.type:
response = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
offset += stat_struct.size
elif header.type == CheckVersion.type:
response = True
elif header.type == -1:
err = int_struct.unpack_from(bytes, offset)[0]
offset += int_struct.size
response = EXCEPTIONS[err]()
if response:
results.append(response)
header, offset = MultiHeader.deserialize(bytes, offset)
return results