@Test public void resizeTempBlockMeta() throws Exception { mDir.addTempBlockMeta(mTempBlockMeta); assertEquals(TEST_DIR_CAPACITY - TEST_TEMP_BLOCK_SIZE, mDir.getAvailableBytes()); final long newSize = TEST_TEMP_BLOCK_SIZE + 10; mDir.resizeTempBlockMeta(mTempBlockMeta, newSize); assertEquals(TEST_DIR_CAPACITY - newSize, mDir.getAvailableBytes()); }
public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } }
StorageDir { public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } } }
StorageDir { public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } } private  StorageDir(StorageTier tier, int dirIndex, long capacityBytes, long reservedBytes,
      String dirPath, String dirMedium); }
StorageDir { public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } } private  StorageDir(StorageTier tier, int dirIndex, long capacityBytes, long reservedBytes,
      String dirPath, String dirMedium); static StorageDir newStorageDir(StorageTier tier, int dirIndex, long capacityBytes,
      long reservedBytes, String dirPath, String dirMedium); long getCapacityBytes(); long getAvailableBytes(); long getCommittedBytes(); String getDirPath(); String getDirMedium(); StorageTier getParentTier(); int getDirIndex(); List<Long> getBlockIds(); List<BlockMeta> getBlocks(); boolean hasBlockMeta(long blockId); boolean hasTempBlockMeta(long blockId); BlockMeta getBlockMeta(long blockId); TempBlockMeta getTempBlockMeta(long blockId); void addBlockMeta(BlockMeta blockMeta); void addTempBlockMeta(TempBlockMeta tempBlockMeta); void removeBlockMeta(BlockMeta blockMeta); void removeTempBlockMeta(TempBlockMeta tempBlockMeta); void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize); void cleanupSessionTempBlocks(long sessionId, List<Long> tempBlockIds); List<TempBlockMeta> getSessionTempBlocks(long sessionId); BlockStoreLocation toBlockStoreLocation(); long getReservedBytes(); }
StorageDir { public void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize) throws InvalidWorkerStateException { long oldSize = tempBlockMeta.getBlockSize(); if (newSize > oldSize) { reserveSpace(newSize - oldSize, false); tempBlockMeta.setBlockSize(newSize); } else if (newSize < oldSize) { throw new InvalidWorkerStateException("Shrinking block, not supported!"); } } private  StorageDir(StorageTier tier, int dirIndex, long capacityBytes, long reservedBytes,
      String dirPath, String dirMedium); static StorageDir newStorageDir(StorageTier tier, int dirIndex, long capacityBytes,
      long reservedBytes, String dirPath, String dirMedium); long getCapacityBytes(); long getAvailableBytes(); long getCommittedBytes(); String getDirPath(); String getDirMedium(); StorageTier getParentTier(); int getDirIndex(); List<Long> getBlockIds(); List<BlockMeta> getBlocks(); boolean hasBlockMeta(long blockId); boolean hasTempBlockMeta(long blockId); BlockMeta getBlockMeta(long blockId); TempBlockMeta getTempBlockMeta(long blockId); void addBlockMeta(BlockMeta blockMeta); void addTempBlockMeta(TempBlockMeta tempBlockMeta); void removeBlockMeta(BlockMeta blockMeta); void removeTempBlockMeta(TempBlockMeta tempBlockMeta); void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize); void cleanupSessionTempBlocks(long sessionId, List<Long> tempBlockIds); List<TempBlockMeta> getSessionTempBlocks(long sessionId); BlockStoreLocation toBlockStoreLocation(); long getReservedBytes();  }