@Test public void removeBlock() throws Exception { TieredBlockStoreTestUtils.cache2(SESSION_ID1, BLOCK_ID1, BLOCK_SIZE, mTestDir1, mMetaManager, mBlockIterator); mBlockStore.removeBlock(SESSION_ID1, BLOCK_ID1); assertFalse(mTestDir1.hasBlockMeta(BLOCK_ID1)); assertFalse(mBlockStore.hasBlockMeta(BLOCK_ID1)); assertFalse(FileUtils.exists(BlockMeta.commitPath(mTestDir1, BLOCK_ID1))); TieredBlockStoreTestUtils.cache2(SESSION_ID2, BLOCK_ID2, BLOCK_SIZE, mTestDir1, mMetaManager, mBlockIterator); mThrown.expect(BlockDoesNotExistException.class); mThrown.expectMessage(ExceptionMessage.BLOCK_NOT_FOUND_AT_LOCATION.getMessage(BLOCK_ID2, mTestDir2.toBlockStoreLocation())); mBlockStore.removeBlock(SESSION_ID2, BLOCK_ID2, mTestDir2.toBlockStoreLocation()); mBlockStore.removeBlock(SESSION_ID2, BLOCK_ID2, mTestDir1.toBlockStoreLocation()); assertFalse(mTestDir1.hasBlockMeta(BLOCK_ID2)); assertFalse(mBlockStore.hasBlockMeta(BLOCK_ID2)); assertFalse(FileUtils.exists(BlockMeta.commitPath(mTestDir1, BLOCK_ID2))); TieredBlockStoreTestUtils.cache2(SESSION_ID2, BLOCK_ID2, BLOCK_SIZE, mTestDir1, mMetaManager, mBlockIterator); mBlockStore.removeBlock(SESSION_ID2, BLOCK_ID2, BlockStoreLocation.anyDirInTier(mTestDir1.getParentTier().getTierAlias())); assertFalse(mTestDir1.hasBlockMeta(BLOCK_ID2)); assertFalse(mBlockStore.hasBlockMeta(BLOCK_ID2)); assertFalse(FileUtils.exists(BlockMeta.commitPath(mTestDir1, BLOCK_ID2))); }
@Override public void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { removeBlock(sessionId, blockId, BlockStoreLocation.anyTier()); }
TieredBlockStore implements BlockStore { @Override public void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { removeBlock(sessionId, blockId, BlockStoreLocation.anyTier()); } }
TieredBlockStore implements BlockStore { @Override public void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { removeBlock(sessionId, blockId, BlockStoreLocation.anyTier()); } TieredBlockStore(); }
TieredBlockStore implements BlockStore { @Override public void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { removeBlock(sessionId, blockId, BlockStoreLocation.anyTier()); } TieredBlockStore(); @Override long lockBlock(long sessionId, long blockId); @Override long lockBlockNoException(long sessionId, long blockId); @Override void unlockBlock(long lockId); @Override boolean unlockBlock(long sessionId, long blockId); @Override BlockWriter getBlockWriter(long sessionId, long blockId); @Override BlockReader getBlockReader(long sessionId, long blockId, long lockId); @Override TempBlockMeta createBlock(long sessionId, long blockId, AllocateOptions options); @Override BlockMeta getVolatileBlockMeta(long blockId); @Override BlockMeta getBlockMeta(long sessionId, long blockId, long lockId); @Override TempBlockMeta getTempBlockMeta(long sessionId, long blockId); @Override void commitBlock(long sessionId, long blockId, boolean pinOnCreate); @Override long commitBlockLocked(long sessionId, long blockId, boolean pinOnCreate); @Override void abortBlock(long sessionId, long blockId); @Override void requestSpace(long sessionId, long blockId, long additionalBytes); @Override void moveBlock(long sessionId, long blockId, AllocateOptions moveOptions); @Override void moveBlock(long sessionId, long blockId, BlockStoreLocation oldLocation,
      AllocateOptions moveOptions); @Override void removeBlock(long sessionId, long blockId); @Override void removeBlock(long sessionId, long blockId, BlockStoreLocation location); @Override void accessBlock(long sessionId, long blockId); @Override synchronized void freeSpace(long sessionId, long minContiguousBytes,
      long minAvailableBytes, BlockStoreLocation location); @Override void cleanupSession(long sessionId); @Override boolean hasBlockMeta(long blockId); @Override BlockStoreMeta getBlockStoreMeta(); @Override BlockStoreMeta getBlockStoreMetaFull(); @Override void registerBlockStoreEventListener(BlockStoreEventListener listener); @Override void updatePinnedInodes(Set<Long> inodes); @Override boolean checkStorage(); void removeDir(StorageDir dir); @Override void close(); }
TieredBlockStore implements BlockStore { @Override public void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { removeBlock(sessionId, blockId, BlockStoreLocation.anyTier()); } TieredBlockStore(); @Override long lockBlock(long sessionId, long blockId); @Override long lockBlockNoException(long sessionId, long blockId); @Override void unlockBlock(long lockId); @Override boolean unlockBlock(long sessionId, long blockId); @Override BlockWriter getBlockWriter(long sessionId, long blockId); @Override BlockReader getBlockReader(long sessionId, long blockId, long lockId); @Override TempBlockMeta createBlock(long sessionId, long blockId, AllocateOptions options); @Override BlockMeta getVolatileBlockMeta(long blockId); @Override BlockMeta getBlockMeta(long sessionId, long blockId, long lockId); @Override TempBlockMeta getTempBlockMeta(long sessionId, long blockId); @Override void commitBlock(long sessionId, long blockId, boolean pinOnCreate); @Override long commitBlockLocked(long sessionId, long blockId, boolean pinOnCreate); @Override void abortBlock(long sessionId, long blockId); @Override void requestSpace(long sessionId, long blockId, long additionalBytes); @Override void moveBlock(long sessionId, long blockId, AllocateOptions moveOptions); @Override void moveBlock(long sessionId, long blockId, BlockStoreLocation oldLocation,
      AllocateOptions moveOptions); @Override void removeBlock(long sessionId, long blockId); @Override void removeBlock(long sessionId, long blockId, BlockStoreLocation location); @Override void accessBlock(long sessionId, long blockId); @Override synchronized void freeSpace(long sessionId, long minContiguousBytes,
      long minAvailableBytes, BlockStoreLocation location); @Override void cleanupSession(long sessionId); @Override boolean hasBlockMeta(long blockId); @Override BlockStoreMeta getBlockStoreMeta(); @Override BlockStoreMeta getBlockStoreMetaFull(); @Override void registerBlockStoreEventListener(BlockStoreEventListener listener); @Override void updatePinnedInodes(Set<Long> inodes); @Override boolean checkStorage(); void removeDir(StorageDir dir); @Override void close();  }