public class ReplicaInPipeline extends ReplicaInfo implements ReplicaInPipelineInterface
ReplicaInfo.ReplicaDirInfo
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern
Constructor and Description |
---|
ReplicaInPipeline(long blockId,
long genStamp,
FsVolumeSpi vol,
File dir)
Constructor for a zero length replica
|
ReplicaInPipeline(ReplicaInPipeline from)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
ReplicaOutputStreams |
createStreams(boolean isCreate,
DataChecksum requestedChecksum)
Create output streams for writing to this replica,
one for block file and one for CRC file
|
boolean |
equals(Object o) |
long |
getBytesAcked()
Get the number of bytes acked
|
long |
getBytesOnDisk()
Get the number of bytes that have written to disk
|
org.apache.hadoop.hdfs.server.datanode.ChunkChecksum |
getLastChecksumAndDataLen()
gets the last chunk checksum and the length of the block corresponding
to that checksum
|
HdfsServerConstants.ReplicaState |
getState()
Get the replica state
|
long |
getVisibleLength()
Get the number of bytes that are visible to readers
|
int |
hashCode() |
void |
setBytesAcked(long bytesAcked)
Set the number bytes that have acked
|
void |
setLastChecksumAndDataLen(long dataLength,
byte[] lastChecksum)
store the checksum for the last chunk along with the data length
|
void |
setWriter(Thread writer)
Set the thread that is writing to this replica
|
void |
stopWriter(long xceiverStopTimeout)
Interrupt the writing thread and wait until it dies
|
String |
toString() |
getBlockFile, getMetaFile, getVolume, isUnlinked, parseSubDirs, setDir, setUnlinked, unlinkBlock
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, write, writeId
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
setNumBytes
getBlockId, getGenerationStamp, getNumBytes
public ReplicaInPipeline(long blockId, long genStamp, FsVolumeSpi vol, File dir)
blockId
- block idgenStamp
- replica generation stampvol
- volume where replica is locateddir
- directory path where block and meta files are locatedpublic ReplicaInPipeline(ReplicaInPipeline from)
from
- public long getVisibleLength()
Replica
getVisibleLength
in interface Replica
public HdfsServerConstants.ReplicaState getState()
Replica
public long getBytesAcked()
ReplicaInPipelineInterface
getBytesAcked
in interface ReplicaInPipelineInterface
public void setBytesAcked(long bytesAcked)
ReplicaInPipelineInterface
setBytesAcked
in interface ReplicaInPipelineInterface
public long getBytesOnDisk()
Replica
getBytesOnDisk
in interface Replica
public void setLastChecksumAndDataLen(long dataLength, byte[] lastChecksum)
ReplicaInPipelineInterface
setLastChecksumAndDataLen
in interface ReplicaInPipelineInterface
dataLength
- number of bytes on disklastChecksum
- - checksum bytes for the last chunkpublic org.apache.hadoop.hdfs.server.datanode.ChunkChecksum getLastChecksumAndDataLen()
ReplicaInPipelineInterface
getLastChecksumAndDataLen
in interface ReplicaInPipelineInterface
public void setWriter(Thread writer)
writer
- a thread writing to this replicapublic void stopWriter(long xceiverStopTimeout) throws IOException
IOException
- the waiting is interruptedpublic ReplicaOutputStreams createStreams(boolean isCreate, DataChecksum requestedChecksum) throws IOException
ReplicaInPipelineInterface
createStreams
in interface ReplicaInPipelineInterface
isCreate
- if it is for creationrequestedChecksum
- the checksum the writer would prefer to useIOException
- if any error occurspublic String toString()
toString
in class ReplicaInfo
Copyright © 2013 Apache Software Foundation. All rights reserved.