@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
DataTransferProtocol
readBlock
in interface DataTransferProtocol
blk
- 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.IOException
public 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
DataTransferProtocol
writeBlock
in interface DataTransferProtocol
blk
- 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.IOException
public void transferBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, String clientName, DatanodeInfo[] targets) throws IOException
DataTransferProtocol
BlockConstructionStage.TRANSFER_RBW
or BlockConstructionStage.TRANSFER_FINALIZED
.transferBlock
in interface DataTransferProtocol
blk
- the block being transferred.blockToken
- security token for accessing the block.clientName
- client's name.targets
- target datanodes.IOException
public void requestShortCircuitFds(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, int maxVersion) throws IOException
DataTransferProtocol
requestShortCircuitFds
in interface DataTransferProtocol
blk
- 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.IOException
public void replaceBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken, String delHint, DatanodeInfo source) throws IOException
DataTransferProtocol
replaceBlock
in interface DataTransferProtocol
blk
- 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.IOException
public void copyBlock(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken) throws IOException
DataTransferProtocol
copyBlock
in interface DataTransferProtocol
blk
- the block being copied.blockToken
- security token for accessing the block.IOException
public void blockChecksum(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken) throws IOException
DataTransferProtocol
blockChecksum
in interface DataTransferProtocol
blk
- a block.blockToken
- security token for accessing the block.IOException
Copyright © 2013 Apache Software Foundation. All rights reserved.