Java Code Examples for org.apache.hadoop.hdfs.server.datanode.DataNode#PKT_HEADER_LEN

The following examples show how to use org.apache.hadoop.hdfs.server.datanode.DataNode#PKT_HEADER_LEN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DFSOutputStream.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 *  create a heartbeat packet
 */
Packet() {
  this.lastPacketInBlock = false;
  this.numChunks = 0;
  this.offsetInBlock = 0;
  this.seqno = HEART_BEAT_SEQNO;

  buffer = null;
  int packetSize = DataNode.PKT_HEADER_LEN + DFSClient.SIZE_OF_INTEGER;
  buf = new byte[packetSize];

  checksumStart = dataStart = packetSize;
  checksumPos = checksumStart;
  dataPos = dataStart;
  maxChunks = 0;
}
 
Example 2
Source File: DFSOutputStream.java    From RDFS with Apache License 2.0 6 votes vote down vote up
Packet(int pktSize, int chunksPerPkt, long offsetInBlock)
throws IOException {
  this.lastPacketInBlock = false;
  this.numChunks = 0;
  this.offsetInBlock = offsetInBlock;
  this.seqno = currentSeqno;
  currentSeqno++;

  buffer = null;
  buf = new byte[pktSize];

  checksumStart = DataNode.PKT_HEADER_LEN + DFSClient.SIZE_OF_INTEGER;
  checksumPos = checksumStart;
  dataStart = checksumStart + chunksPerPkt * checksum.getChecksumSize();
  dataPos = dataStart;
  maxChunks = chunksPerPkt;
}
 
Example 3
Source File: DFSClient.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
Packet(int pktSize, int chunksPerPkt, long offsetInBlock) {
  this.lastPacketInBlock = false;
  this.numChunks = 0;
  this.offsetInBlock = offsetInBlock;
  this.seqno = currentSeqno;
  currentSeqno++;
  
  buffer = null;
  buf = new byte[pktSize];
  
  checksumStart = DataNode.PKT_HEADER_LEN + SIZE_OF_INTEGER;
  checksumPos = checksumStart;
  dataStart = checksumStart + chunksPerPkt * checksum.getChecksumSize();
  dataPos = dataStart;
  maxChunks = chunksPerPkt;
}
 
Example 4
Source File: DFSOutputStream.java    From RDFS with Apache License 2.0 5 votes vote down vote up
private void computePacketChunkSize(int psize, int csize) {
  int chunkSize = csize + checksum.getChecksumSize();
  int n = DataNode.PKT_HEADER_LEN + DFSClient.SIZE_OF_INTEGER;
  chunksPerPacket = Math.max((psize - n + chunkSize-1)/chunkSize, 1);
  packetSize = n + chunkSize*chunksPerPacket;
  if (DFSClient.LOG.isDebugEnabled()) {
    DFSClient.LOG.debug("computePacketChunkSize: src=" + src +
              ", chunkSize=" + chunkSize +
              ", chunksPerPacket=" + chunksPerPacket +
              ", packetSize=" + packetSize);
  }
}
 
Example 5
Source File: DFSClient.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
private void computePacketChunkSize(int psize, int csize) {
  int chunkSize = csize + checksum.getChecksumSize();
  int n = DataNode.PKT_HEADER_LEN + SIZE_OF_INTEGER;
  chunksPerPacket = Math.max((psize - n + chunkSize-1)/chunkSize, 1);
  packetSize = n + chunkSize*chunksPerPacket;
  if (LOG.isDebugEnabled()) {
    LOG.debug("computePacketChunkSize: src=" + src +
              ", chunkSize=" + chunkSize +
              ", chunksPerPacket=" + chunksPerPacket +
              ", packetSize=" + packetSize);
  }
}
 
Example 6
Source File: DFSOutputStream.java    From RDFS with Apache License 2.0 4 votes vote down vote up
synchronized void setChunksPerPacket(int value) {
  chunksPerPacket = Math.min(chunksPerPacket, value);
  packetSize = DataNode.PKT_HEADER_LEN + DFSClient.SIZE_OF_INTEGER +
				 (checksum.getBytesPerChecksum() +
					checksum.getChecksumSize()) * chunksPerPacket;
}
 
Example 7
Source File: DFSClient.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
synchronized void setChunksPerPacket(int value) {
  chunksPerPacket = Math.min(chunksPerPacket, value);
  packetSize = DataNode.PKT_HEADER_LEN + SIZE_OF_INTEGER +
               (checksum.getBytesPerChecksum() + 
                checksum.getChecksumSize()) * chunksPerPacket;
}