Package org.apache.hadoop.hdfs.protocol
Class LocatedBlock
java.lang.Object
org.apache.hadoop.hdfs.protocol.LocatedBlock
- Direct Known Subclasses:
LocatedStripedBlock
Associates a block with the Datanodes that contain its replicas
and other block metadata (E.g. the file offset associated with this
block, whether it is corrupt, a location is cached in memory,
security token, etc).
-
Constructor Summary
ConstructorsConstructorDescriptionLocatedBlock(ExtendedBlock b, DatanodeInfo[] locs) LocatedBlock(ExtendedBlock b, DatanodeInfo[] locs, String[] storageIDs, org.apache.hadoop.fs.StorageType[] storageTypes) LocatedBlock(ExtendedBlock b, DatanodeInfo[] locs, String[] storageIDs, org.apache.hadoop.fs.StorageType[] storageTypes, long startOffset, boolean corrupt, DatanodeInfo[] cachedLocs) LocatedBlock(ExtendedBlock b, DatanodeInfoWithStorage[] locs, String[] storageIDs, org.apache.hadoop.fs.StorageType[] storageTypes, long startOffset, boolean corrupt, DatanodeInfo[] cachedLocs) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCachedLoc(DatanodeInfo loc) Add a the location of a cached replica of the block.getBlock()longorg.apache.hadoop.security.token.Token<BlockTokenIdentifier>Returns the locations associated with this block.longString[]org.apache.hadoop.fs.StorageType[]booleanbooleanvoidmoveProvidedToEnd(int activeLen) Moves all locations that haveStorageTypePROVIDEDto the end of the locations array without changing the relative ordering of the remaining locations Only the firstactiveLenlocations are considered.voidsetBlockToken(org.apache.hadoop.security.token.Token<BlockTokenIdentifier> token) voidsetCorrupt(boolean corrupt) voidsetStartOffset(long value) toString()voidUpdates the cached StorageID and StorageType information.
-
Constructor Details
-
LocatedBlock
-
LocatedBlock
public LocatedBlock(ExtendedBlock b, DatanodeInfo[] locs, String[] storageIDs, org.apache.hadoop.fs.StorageType[] storageTypes) -
LocatedBlock
public LocatedBlock(ExtendedBlock b, DatanodeInfo[] locs, String[] storageIDs, org.apache.hadoop.fs.StorageType[] storageTypes, long startOffset, boolean corrupt, DatanodeInfo[] cachedLocs) -
LocatedBlock
public LocatedBlock(ExtendedBlock b, DatanodeInfoWithStorage[] locs, String[] storageIDs, org.apache.hadoop.fs.StorageType[] storageTypes, long startOffset, boolean corrupt, DatanodeInfo[] cachedLocs)
-
-
Method Details
-
getBlockToken
-
setBlockToken
-
getBlock
-
getLocations
Returns the locations associated with this block. The returned array is not expected to be modified. If it is, caller must immediately invokeupdateCachedStorageInfo()to update the cached Storage ID/Type arrays. -
getStorageTypes
public org.apache.hadoop.fs.StorageType[] getStorageTypes() -
getStorageIDs
-
updateCachedStorageInfo
public void updateCachedStorageInfo()Updates the cached StorageID and StorageType information. Must be called when the locations array is modified. -
moveProvidedToEnd
public void moveProvidedToEnd(int activeLen) Moves all locations that haveStorageTypePROVIDEDto the end of the locations array without changing the relative ordering of the remaining locations Only the firstactiveLenlocations are considered. The caller must immediately invokeupdateCachedStorageInfo()to update the cached Storage ID/Type arrays.- Parameters:
activeLen-
-
getStartOffset
public long getStartOffset() -
getBlockSize
public long getBlockSize() -
setStartOffset
public void setStartOffset(long value) -
setCorrupt
public void setCorrupt(boolean corrupt) -
isCorrupt
public boolean isCorrupt() -
addCachedLoc
Add a the location of a cached replica of the block.- Parameters:
loc- of datanode with the cached replica
-
getCachedLocations
- Returns:
- Datanodes with a cached block replica
-
toString
-
isStriped
public boolean isStriped() -
getBlockType
-