Interface BlockCollection

All Known Implementing Classes:
INodeFile

@Private public interface BlockCollection
This interface is used by the block manager to expose a few characteristics of a collection of Block/BlockUnderConstruction.
  • Method Details

    • getLastBlock

      BlockInfo getLastBlock()
      Get the last block of the collection.
    • computeContentSummary

      org.apache.hadoop.fs.ContentSummary computeContentSummary(BlockStoragePolicySuite bsps) throws org.apache.hadoop.security.AccessControlException
      Get content summary.
      Throws:
      org.apache.hadoop.security.AccessControlException
    • numBlocks

      int numBlocks()
      Returns:
      the number of blocks or block groups
    • getBlocks

      BlockInfo[] getBlocks()
      Get the blocks (striped or contiguous).
    • getPreferredBlockSize

      long getPreferredBlockSize()
      Get preferred block size for the collection
      Returns:
      preferred block size in bytes
    • getPreferredBlockReplication

      short getPreferredBlockReplication()
      Get block replication for the collection.
      Returns:
      block replication value. Return 0 if the file is erasure coded.
    • getStoragePolicyID

      byte getStoragePolicyID()
      Returns:
      the storage policy ID.
    • getName

      String getName()
      Get the name of the collection.
    • setBlock

      void setBlock(int index, BlockInfo blk)
      Set the block (contiguous or striped) at the given index.
    • convertLastBlockToUC

      void convertLastBlockToUC(BlockInfo lastBlock, DatanodeStorageInfo[] targets) throws IOException
      Convert the last block of the collection to an under-construction block and set the locations.
      Throws:
      IOException
    • isUnderConstruction

      boolean isUnderConstruction()
      Returns:
      whether the block collection is under construction.
    • isStriped

      boolean isStriped()
      Returns:
      whether the block collection is in striping format
    • getId

      long getId()
      Returns:
      the id for the block collection