/** 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); }
/** 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); }
node.addBlock(newblockinfo);
boolean added = this.addBlock(delimiter); assert added : "Delimiting block cannot be present in the node"; if(newReport == null)
descriptors[i].addBlock(newblockinfo);
public void testBlocksCounter() throws Exception { DatanodeDescriptor dd = new DatanodeDescriptor(); assertEquals(0, dd.numBlocks()); BlockInfo blk = new BlockInfo(new Block(1L), 1); BlockInfo blk1 = new BlockInfo(new Block(2L), 2); // add first block assertTrue(dd.addBlock(blk)); assertEquals(1, dd.numBlocks()); // remove a non-existent block assertFalse(dd.removeBlock(blk1)); assertEquals(1, dd.numBlocks()); // add an existent block assertFalse(dd.addBlock(blk)); assertEquals(1, dd.numBlocks()); // add second block assertTrue(dd.addBlock(blk1)); assertEquals(2, dd.numBlocks()); // remove first block assertTrue(dd.removeBlock(blk)); assertEquals(1, dd.numBlocks()); // remove second block assertTrue(dd.removeBlock(blk1)); assertEquals(0, dd.numBlocks()); } }
boolean added = node.addBlock(storedBlock);
boolean added = this.addBlock(delimiter); assert added : "Delimiting block cannot be present in the node";
boolean added = node.addBlock(storedBlock);