/** * Creates a file ID from a block ID. * * @param blockId the block ID * @return the file ID */ public static long fileIdFromBlockId(long blockId) { return createFileId(BlockId.getContainerId(blockId)); }
@Override public List<Long> getLostFiles() { Set<Long> lostFiles = new HashSet<>(); for (long blockId : mBlockMaster.getLostBlocks()) { // the file id is the container id of the block id long containerId = BlockId.getContainerId(blockId); long fileId = IdUtils.createFileId(containerId); lostFiles.add(fileId); } return new ArrayList<>(lostFiles); }
/** * Tests if output of {@link IdUtils#createFileId(long)} is valid. */ @Test public void createFileId() throws Exception { long containerId = 1; long fileId = IdUtils.createFileId(containerId); Assert.assertNotEquals(-1, fileId); }
/** * Creates a file ID from a block ID. * * @param blockId the block ID * @return the file ID */ public static long fileIdFromBlockId(long blockId) { return createFileId(BlockId.getContainerId(blockId)); }
@Override public List<Long> getLostFiles() { Set<Long> lostFiles = new HashSet<>(); for (long blockId : mBlockMaster.getLostBlocks()) { // the file id is the container id of the block id long containerId = BlockId.getContainerId(blockId); long fileId = IdUtils.createFileId(containerId); lostFiles.add(fileId); } return new ArrayList<>(lostFiles); }