Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * Creates a block. This method is only called from a data server.
  *
  * <p>Call {@link #getTempBlockWriterRemote(long, long)} to get a writer for writing to the block.
  *
  * @param sessionId The id of the client
  * @param blockId The id of the block to be created
  * @param tierAlias The alias of the tier to place the new block in
  * @param initialBytes The initial amount of bytes to be allocated
  * @throws IllegalArgumentException if location does not belong to tiered storage
  * @throws BlockAlreadyExistsException if blockId already exists, either temporary or committed,
  *     or block in eviction plan already exists
  * @throws WorkerOutOfSpaceException if this Store has no more space than the initialBlockSize
  * @throws IOException if blocks in eviction plan fail to be moved or deleted
  */
 public void createBlockRemote(long sessionId, long blockId, String tierAlias, long initialBytes)
     throws BlockAlreadyExistsException, WorkerOutOfSpaceException, IOException {
   BlockStoreLocation loc = BlockStoreLocation.anyDirInTier(tierAlias);
   TempBlockMeta createdBlock = mBlockStore.createBlockMeta(sessionId, blockId, loc, initialBytes);
   FileUtils.createBlockPath(createdBlock.getPath());
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  * 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);
 }
Exemplo n.º 5
0
 /**
  * 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);
 }