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 Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.fs.ContentSummaryGet content summary.voidconvertLastBlockToUC(BlockInfo lastBlock, DatanodeStorageInfo[] targets) Convert the last block of the collection to an under-construction block and set the locations.Get the blocks (striped or contiguous).longgetId()Get the last block of the collection.getName()Get the name of the collection.shortGet block replication for the collection.longGet preferred block size for the collectionbytebooleanbooleanintvoidSet the block (contiguous or striped) at the given index.
-
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
Set the block (contiguous or striped) at the given index. -
convertLastBlockToUC
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
-