예제 #1
0
 def unpack(self, reader):
     data = Data()
     (oid,block_id) = struct.unpack(self.format_str, reader.read(struct.calcsize(self.format_str)))
     data.oid = oid
     data.block_id = block_id
     data.type = packet_types.FS_GET_BLOCK_REPLICAS
     return data
예제 #2
0
 def unpack(self,reader):
     (oid,block_id) = struct.unpack(self.format_str, reader.read(struct.calcsize(self.format_str)))
     data = Data()        
     data.oid = oid
     data.block_id = block_id
     data.type = packet_types.FS_BLOCK_DELETED
     
     return data
예제 #3
0
 def unpack(self, reader):
     data = Data()
     (oid, block_id) = struct.unpack(
         self.format_str, reader.read(struct.calcsize(self.format_str)))
     data.oid = oid
     data.block_id = block_id
     data.type = packet_types.FS_GET_BLOCK_REPLICAS
     return data
예제 #4
0
    def unpack(self, reader):
        (oid, block_id) = struct.unpack(
            self.format_str, reader.read(struct.calcsize(self.format_str)))
        data = Data()
        data.oid = oid
        data.block_id = block_id
        data.type = packet_types.FS_BLOCK_DELETED

        return data
예제 #5
0
 def unpack(self, reader):
     (oid,block_id,length) = struct.unpack(self.format_str, reader.read(struct.calcsize(self.format_str)))
     data = Data()
     data.oid = oid
     data.block_id = block_id
     
     data.replicas = {}
     
     for i in range(length):
         (key,val) = struct.unpack(self.child_format_str, reader.read(struct.calcsize(self.child_format_str)))
         data.replicas[key] = val
     
     data.type = packet_types.FS_BLOCK_REPLICAS
     return data
예제 #6
0
    def unpack(self, reader):
        (oid, block_id,
         length) = struct.unpack(self.format_str,
                                 reader.read(struct.calcsize(self.format_str)))
        data = Data()
        data.oid = oid
        data.block_id = block_id

        data.replicas = {}

        for i in range(length):
            (key, val) = struct.unpack(
                self.child_format_str,
                reader.read(struct.calcsize(self.child_format_str)))
            data.replicas[key] = val

        data.type = packet_types.FS_BLOCK_REPLICAS
        return data