/** returns true if the node does not already exists and is added. * false if the node already exists.*/ boolean addNode(Block b, DatanodeDescriptor node, int replication) { // insert into the map if not there yet BlockInfo info = checkBlockInfo(b, replication); // add block to the data-node list and the node to the block info return node.addBlock(info); }
/** * Add block b belonging to the specified file inode to the map. */ BlockInfo addINode(Block b, INodeFile iNode) { BlockInfo info = checkBlockInfo(b, iNode.getReplication()); info.inode = iNode; return info; }
/** returns true if the node does not already exists and is added. * false if the node already exists.*/ boolean addNode(Block b, DatanodeDescriptor node, int replication) { // insert into the map if not there yet BlockInfo info = checkBlockInfo(b, replication); // add block to the data-node list and the node to the block info return node.addBlock(info); }
/** * Add block b belonging to the specified file inode to the map. */ BlockInfo addINode(Block b, INodeFile iNode) { BlockInfo info = checkBlockInfo(b, iNode.getReplication()); info.inode = iNode; return info; }
/** * Add block b belonging to the specified file inode to the map, this * overwrites the map with the new block information. */ BlockInfo updateINode(BlockInfo oldBlock, Block newBlock, INodeFile iNode) throws IOException { // If the old block is not same as the new block, probably the GS was // bumped up, hence remove the old block and replace it with the new one. if (oldBlock != null && !oldBlock.equals(newBlock)) { if (oldBlock.getBlockId() != newBlock.getBlockId()) { throw new IOException("block ids don't match : " + oldBlock + ", " + newBlock); } removeBlock(oldBlock); } BlockInfo info = checkBlockInfo(newBlock, iNode.getReplication()); info.set(newBlock.getBlockId(), newBlock.getNumBytes(), newBlock.getGenerationStamp()); info.inode = iNode; return info; }