|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hdfs.protocol.Block
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline
public class ReplicaInPipeline
This class defines a replica in a pipeline, which includes a persistent replica being written to by a dfs client or a temporary replica being replicated by a source datanode or being copied for the balancing purpose. The base class implements a temporary replica
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo |
---|
ReplicaInfo.ReplicaDirInfo |
Field Summary |
---|
Fields inherited from class org.apache.hadoop.hdfs.protocol.Block |
---|
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern |
Constructor Summary | |
---|---|
ReplicaInPipeline(long blockId,
long genStamp,
FsVolumeSpi vol,
File dir)
Constructor for a zero length replica |
|
ReplicaInPipeline(ReplicaInPipeline from)
Copy constructor. |
Method Summary | |
---|---|
ReplicaOutputStreams |
createStreams(boolean isCreate,
org.apache.hadoop.util.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()
|
Methods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo |
---|
getBlockFile, getMetaFile, getVolume, isUnlinked, parseSubDirs, setDir, setUnlinked, unlinkBlock |
Methods inherited from class org.apache.hadoop.hdfs.protocol.Block |
---|
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, write, writeId |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.hdfs.server.datanode.ReplicaInPipelineInterface |
---|
setNumBytes |
Methods inherited from interface org.apache.hadoop.hdfs.server.datanode.Replica |
---|
getBlockId, getGenerationStamp, getNumBytes |
Constructor Detail |
---|
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
- Method Detail |
---|
public long getVisibleLength()
org.apache.hadoop.hdfs.server.datanode.Replica
getVisibleLength
in interface org.apache.hadoop.hdfs.server.datanode.Replica
public HdfsServerConstants.ReplicaState getState()
org.apache.hadoop.hdfs.server.datanode.Replica
getState
in interface org.apache.hadoop.hdfs.server.datanode.Replica
public long getBytesAcked()
ReplicaInPipelineInterface
getBytesAcked
in interface ReplicaInPipelineInterface
public void setBytesAcked(long bytesAcked)
ReplicaInPipelineInterface
setBytesAcked
in interface ReplicaInPipelineInterface
public long getBytesOnDisk()
org.apache.hadoop.hdfs.server.datanode.Replica
getBytesOnDisk
in interface org.apache.hadoop.hdfs.server.datanode.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 boolean equals(Object o)
equals
in class org.apache.hadoop.hdfs.protocol.Block
public void stopWriter(long xceiverStopTimeout) throws IOException
IOException
- the waiting is interruptedpublic int hashCode()
hashCode
in class org.apache.hadoop.hdfs.protocol.Block
public ReplicaOutputStreams createStreams(boolean isCreate, org.apache.hadoop.util.DataChecksum requestedChecksum) throws IOException
ReplicaInPipelineInterface
createStreams
in interface ReplicaInPipelineInterface
isCreate
- if it is for creationrequestedChecksum
- the checksum the writer would prefer to use
IOException
- if any error occurspublic String toString()
toString
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |