@Test public void computeBlockIdTest() { Assert.assertEquals(1073741824, BlockInfo.computeBlockId(1, 0)); Assert.assertEquals(1073741825, BlockInfo.computeBlockId(1, 1)); Assert.assertEquals(2147483646, BlockInfo.computeBlockId(1, 1073741822)); Assert.assertEquals(2147483647, BlockInfo.computeBlockId(1, 1073741823)); Assert.assertEquals(3221225472L, BlockInfo.computeBlockId(3, 0)); Assert.assertEquals(3221225473L, BlockInfo.computeBlockId(3, 1)); Assert.assertEquals(4294967294L, BlockInfo.computeBlockId(3, 1073741822)); Assert.assertEquals(4294967295L, BlockInfo.computeBlockId(3, 1073741823)); }
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; }