@Test public void constructorTest() { BlockInfo tInfo = new BlockInfo(new InodeFile("t", 100, 0, Constants.DEFAULT_BLOCK_SIZE_BYTE, System.currentTimeMillis()), 300, 800); Assert.assertEquals(tInfo.BLOCK_INDEX, 300); Assert.assertEquals(tInfo.BLOCK_ID, BlockInfo.computeBlockId(100, 300)); Assert.assertEquals(tInfo.OFFSET, (long) Constants.DEFAULT_BLOCK_SIZE_BYTE * 300); Assert.assertEquals(tInfo.LENGTH, 800); }
public static long computeBlockId(int inodeId, int blockIndex) { return ((long) inodeId << 30) + blockIndex; }
BlockInfo { public static long computeBlockId(int inodeId, int blockIndex) { return ((long) inodeId << 30) + blockIndex; } }
BlockInfo { public static long computeBlockId(int inodeId, int blockIndex) { return ((long) inodeId << 30) + blockIndex; } BlockInfo(InodeFile inodeFile, int blockIndex, long length); }
BlockInfo { public static long computeBlockId(int inodeId, int blockIndex) { return ((long) inodeId << 30) + blockIndex; } BlockInfo(InodeFile inodeFile, int blockIndex, long length); static long computeBlockId(int inodeId, int blockIndex); static int computeBlockIndex(long blockId); static int computeInodeId(long blockId); synchronized void addLocation(long workerId, NetAddress workerAddress); synchronized ClientBlockInfo generateClientBlockInfo(); synchronized List<Pair<Long, Long>> getBlockIdWorkerIdPairs(); synchronized InodeFile getInodeFile(); synchronized List<NetAddress> getLocations(); synchronized boolean isInMemory(); synchronized void removeLocation(long workerId); @Override synchronized String toString(); }
BlockInfo { public static long computeBlockId(int inodeId, int blockIndex) { return ((long) inodeId << 30) + blockIndex; } BlockInfo(InodeFile inodeFile, int blockIndex, long length); static long computeBlockId(int inodeId, int blockIndex); static int computeBlockIndex(long blockId); static int computeInodeId(long blockId); synchronized void addLocation(long workerId, NetAddress workerAddress); synchronized ClientBlockInfo generateClientBlockInfo(); synchronized List<Pair<Long, Long>> getBlockIdWorkerIdPairs(); synchronized InodeFile getInodeFile(); synchronized List<NetAddress> getLocations(); synchronized boolean isInMemory(); synchronized void removeLocation(long workerId); @Override synchronized String toString(); final int BLOCK_INDEX; final long BLOCK_ID; final long OFFSET; final long LENGTH; }