Beispiel #1
0
    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
Beispiel #2
0
    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
Beispiel #3
0
    def deserialize(cls, bytes, offset):
        count = int_struct.unpack_from(bytes, offset)[0]
        offset += int_struct.size
        if count == -1:  # pragma: nocover
            return []

        acls = []
        for c in range(count):
            acl, offset = read_acl(bytes, offset)
            acls.append(acl)
        stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
        return acls, stat
Beispiel #4
0
    def deserialize(cls, bytes, offset):
        count = int_struct.unpack_from(bytes, offset)[0]
        offset += int_struct.size
        if count == -1:  # pragma: nocover
            return []

        acls = []
        for c in range(count):
            acl, offset = read_acl(bytes, offset)
            acls.append(acl)
        stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
        return acls, stat
Beispiel #5
0
 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
Beispiel #6
0
 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
Beispiel #7
0
 def deserialize(cls, bytes, offset):
     return ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
Beispiel #8
0
 def deserialize(cls, bytes, offset):
     data, offset = read_buffer(bytes, offset)
     stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
     return data, stat
Beispiel #9
0
 def deserialize(cls, bytes, offset):
     stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
     return stat if stat.czxid != -1 else None
Beispiel #10
0
 def deserialize(cls, bytes, offset):
     data, offset = read_buffer(bytes, offset)
     stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
     return data, stat
Beispiel #11
0
 def deserialize(cls, bytes, offset):
     return ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
Beispiel #12
0
 def deserialize(cls, bytes, offset):
     stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
     return stat if stat.czxid != -1 else None
Beispiel #13
0
 def deserialize(cls, bytes, offset):
     path, offset = read_string(bytes, offset)
     stat = ZnodeStat._make(stat_struct.unpack_from(bytes, offset))
     return path, stat