@InterfaceAudience.Private @InterfaceStability.Evolving public class Sender extends Object implements DataTransferProtocol
DATA_TRANSFER_VERSION, LOG| Constructor and Description |
|---|
Sender(DataOutputStream out)
Create a sender for DataTransferProtocol with a output stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
blockChecksum(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken)
Get block checksum (MD5 of CRC32).
|
void |
copyBlock(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken)
Copy a block.
|
void |
readBlock(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken,
String clientName,
long blockOffset,
long length,
boolean sendChecksum,
CachingStrategy cachingStrategy)
Read a block.
|
void |
replaceBlock(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken,
String delHint,
DatanodeInfo source)
Receive a block from a source datanode
and then notifies the namenode
to remove the copy from the original datanode.
|
void |
requestShortCircuitFds(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken,
int maxVersion)
Request short circuit access file descriptors from a DataNode.
|
void |
transferBlock(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken,
String clientName,
DatanodeInfo[] targets)
Transfer a block to another datanode.
|
void |
writeBlock(ExtendedBlock blk,
Token<BlockTokenIdentifier> blockToken,
String clientName,
DatanodeInfo[] targets,
DatanodeInfo source,
BlockConstructionStage stage,
int pipelineSize,
long minBytesRcvd,
long maxBytesRcvd,
long latestGenerationStamp,
DataChecksum requestedChecksum,
CachingStrategy cachingStrategy)
Write a block to a datanode pipeline.
|
public Sender(DataOutputStream out)
public void readBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, String clientName, long blockOffset, long length, boolean sendChecksum, CachingStrategy cachingStrategy) throws IOException
DataTransferProtocolreadBlock in interface DataTransferProtocolblk - the block being read.blockToken - security token for accessing the block.clientName - client's name.blockOffset - offset of the block.length - maximum number of bytes for this read.sendChecksum - if false, the DN should skip reading and sending
checksumscachingStrategy - The caching strategy to use.IOExceptionpublic void writeBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, String clientName, DatanodeInfo[] targets, DatanodeInfo source, BlockConstructionStage stage, int pipelineSize, long minBytesRcvd, long maxBytesRcvd, long latestGenerationStamp, DataChecksum requestedChecksum, CachingStrategy cachingStrategy) throws IOException
DataTransferProtocolwriteBlock in interface DataTransferProtocolblk - the block being written.blockToken - security token for accessing the block.clientName - client's name.targets - target datanodes in the pipeline.source - source datanode.stage - pipeline stage.pipelineSize - the size of the pipeline.minBytesRcvd - minimum number of bytes received.maxBytesRcvd - maximum number of bytes received.latestGenerationStamp - the latest generation stamp of the block.IOExceptionpublic void transferBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, String clientName, DatanodeInfo[] targets) throws IOException
DataTransferProtocolBlockConstructionStage.TRANSFER_RBW
or BlockConstructionStage.TRANSFER_FINALIZED.transferBlock in interface DataTransferProtocolblk - the block being transferred.blockToken - security token for accessing the block.clientName - client's name.targets - target datanodes.IOExceptionpublic void requestShortCircuitFds(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, int maxVersion) throws IOException
DataTransferProtocolrequestShortCircuitFds in interface DataTransferProtocolblk - The block to get file descriptors for.blockToken - Security token for accessing the block.maxVersion - Maximum version of the block data the client
can understand.IOExceptionpublic void replaceBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, String delHint, DatanodeInfo source) throws IOException
DataTransferProtocolreplaceBlock in interface DataTransferProtocolblk - the block being replaced.blockToken - security token for accessing the block.delHint - the hint for deleting the block in the original datanode.source - the source datanode for receiving the block.IOExceptionpublic void copyBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken) throws IOException
DataTransferProtocolcopyBlock in interface DataTransferProtocolblk - the block being copied.blockToken - security token for accessing the block.IOExceptionpublic void blockChecksum(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken) throws IOException
DataTransferProtocolblockChecksum in interface DataTransferProtocolblk - a block.blockToken - security token for accessing the block.IOExceptionCopyright © 2013 Apache Software Foundation. All rights reserved.