/**
  * Commits a temp block.
  *
  * @param tempBlockMeta the meta data of the temp block to commit
  * @throws OutOfSpaceException when no more space left to hold the block
  * @throws AlreadyExistsException when the block already exists in committed blocks
  * @throws NotFoundException when temp block can not be found
  */
 public synchronized void commitTempBlockMeta(TempBlockMeta tempBlockMeta)
     throws OutOfSpaceException, AlreadyExistsException, NotFoundException {
   BlockMeta block = new BlockMeta(Preconditions.checkNotNull(tempBlockMeta));
   StorageDir dir = tempBlockMeta.getParentDir();
   dir.removeTempBlockMeta(tempBlockMeta);
   dir.addBlockMeta(block);
 }
 /**
  * Aborts a temp block.
  *
  * @param tempBlockMeta the meta data of the temp block to add
  * @throws NotFoundException when block can not be found
  */
 public synchronized void abortTempBlockMeta(TempBlockMeta tempBlockMeta)
     throws NotFoundException {
   StorageDir dir = tempBlockMeta.getParentDir();
   dir.removeTempBlockMeta(tempBlockMeta);
 }
 /**
  * Modifies the size of a temp block
  *
  * @param tempBlockMeta the temp block to modify
  * @param newSize new size in bytes
  * @throws InvalidStateException when newSize is smaller than current size
  */
 public synchronized void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long newSize)
     throws InvalidStateException {
   StorageDir dir = tempBlockMeta.getParentDir();
   dir.resizeTempBlockMeta(tempBlockMeta, newSize);
 }
 /**
  * Adds a temp block.
  *
  * @param tempBlockMeta the meta data of the temp block to add
  * @throws OutOfSpaceException when no more space left to hold the block
  * @throws AlreadyExistsException when the block already exists
  */
 public synchronized void addTempBlockMeta(TempBlockMeta tempBlockMeta)
     throws OutOfSpaceException, AlreadyExistsException {
   StorageDir dir = tempBlockMeta.getParentDir();
   dir.addTempBlockMeta(tempBlockMeta);
 }