@Test public void computeInodeIdTest() { Assert.assertEquals(1, BlockInfo.computeInodeId(1073741824)); Assert.assertEquals(1, BlockInfo.computeInodeId(1073741825)); Assert.assertEquals(1, BlockInfo.computeInodeId(2147483646)); Assert.assertEquals(1, BlockInfo.computeInodeId(2147483647)); Assert.assertEquals(3, BlockInfo.computeInodeId(3221225472L)); Assert.assertEquals(3, BlockInfo.computeInodeId(3221225473L)); Assert.assertEquals(3, BlockInfo.computeInodeId(4294967294L)); Assert.assertEquals(3, BlockInfo.computeInodeId(4294967295L)); }
public static int computeInodeId(long blockId) { return (int) (blockId >> 30); }
BlockInfo { public static int computeInodeId(long blockId) { return (int) (blockId >> 30); } }
BlockInfo { public static int computeInodeId(long blockId) { return (int) (blockId >> 30); } BlockInfo(InodeFile inodeFile, int blockIndex, long length); }
BlockInfo { public static int computeInodeId(long blockId) { return (int) (blockId >> 30); } 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 int computeInodeId(long blockId) { return (int) (blockId >> 30); } 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; }