@InterfaceAudience.Private public class BlockInfo extends Block implements LightWeightGSet.LinkedElement
INodeFile
it is part of and datanodes where the replicas of
the block are stored.
BlockInfo class maintains for a given block
the BlockCollection
it is part of and datanodes where the replicas of
the block are stored.Modifier and Type | Field and Description |
---|---|
static BlockInfo[] |
EMPTY_ARRAY |
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern
Modifier | Constructor and Description |
---|---|
protected |
BlockInfo(BlockInfo from)
Copy construction.
|
|
BlockInfo(Block blk,
int replication) |
|
BlockInfo(int replication)
Construct an entry for blocksmap
|
Modifier and Type | Method and Description |
---|---|
boolean |
addNode(DatanodeDescriptor node)
Add data-node this block belongs to.
|
BlockInfoUnderConstruction |
convertToBlockUnderConstruction(HdfsServerConstants.BlockUCState s,
DatanodeDescriptor[] targets)
Convert a complete block to an under construction block.
|
boolean |
equals(Object obj) |
BlockCollection |
getBlockCollection() |
HdfsServerConstants.BlockUCState |
getBlockUCState()
BlockInfo represents a block that is not being constructed.
|
LightWeightGSet.LinkedElement |
getNext()
Get the next element.
|
int |
hashCode() |
boolean |
isComplete()
Is this block complete?
|
BlockInfo |
listInsert(BlockInfo head,
DatanodeDescriptor dn)
Insert this block into the head of the list of blocks
related to the specified DatanodeDescriptor.
|
BlockInfo |
listRemove(BlockInfo head,
DatanodeDescriptor dn)
Remove this block from the list of blocks
related to the specified DatanodeDescriptor.
|
BlockInfo |
moveBlockToHead(BlockInfo head,
DatanodeDescriptor dn,
int curIndex,
int headIndex)
Remove this block from the list of blocks related to the specified
DatanodeDescriptor.
|
int |
numNodes()
Count the number of data-nodes the block belongs to.
|
boolean |
removeNode(DatanodeDescriptor node)
Remove data-node from the block.
|
void |
setBlockCollection(BlockCollection bc) |
void |
setNext(LightWeightGSet.LinkedElement next)
Set the next element.
|
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, toString, write, writeId
public static final BlockInfo[] EMPTY_ARRAY
public BlockInfo(int replication)
replication
- the block's replication factorpublic BlockInfo(Block blk, int replication)
protected BlockInfo(BlockInfo from)
from
- BlockInfo to copy from.public BlockCollection getBlockCollection()
public void setBlockCollection(BlockCollection bc)
public int numNodes()
public boolean addNode(DatanodeDescriptor node)
public boolean removeNode(DatanodeDescriptor node)
public BlockInfo listInsert(BlockInfo head, DatanodeDescriptor dn)
public BlockInfo listRemove(BlockInfo head, DatanodeDescriptor dn)
public BlockInfo moveBlockToHead(BlockInfo head, DatanodeDescriptor dn, int curIndex, int headIndex)
public HdfsServerConstants.BlockUCState getBlockUCState()
BlockInfoUnderConstruction
.public boolean isComplete()
HdfsServerConstants.BlockUCState.COMPLETE
public BlockInfoUnderConstruction convertToBlockUnderConstruction(HdfsServerConstants.BlockUCState s, DatanodeDescriptor[] targets)
public LightWeightGSet.LinkedElement getNext()
LightWeightGSet.LinkedElement
getNext
in interface LightWeightGSet.LinkedElement
public void setNext(LightWeightGSet.LinkedElement next)
LightWeightGSet.LinkedElement
setNext
in interface LightWeightGSet.LinkedElement
Copyright © 2013 Apache Software Foundation. All rights reserved.