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
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
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
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
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
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