org.apache.hadoop.hdfs.server.datanode
Class ReplicaBeingWritten

java.lang.Object
  extended by org.apache.hadoop.hdfs.protocol.Block
      extended by org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
          extended by org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline
              extended by org.apache.hadoop.hdfs.server.datanode.ReplicaBeingWritten
All Implemented Interfaces:
Comparable<org.apache.hadoop.hdfs.protocol.Block>, org.apache.hadoop.hdfs.server.datanode.Replica, ReplicaInPipelineInterface, org.apache.hadoop.io.Writable

public class ReplicaBeingWritten
extends ReplicaInPipeline

This class represents replicas being written. Those are the replicas that are created in a pipeline initiated by a dfs client.


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
ReplicaBeingWritten(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, Thread writer)
          Constructor
ReplicaBeingWritten(long blockId, long genStamp, FsVolumeSpi vol, File dir)
          Constructor for a zero length replica
ReplicaBeingWritten(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, Thread writer)
          Constructor
ReplicaBeingWritten(ReplicaBeingWritten from)
          Copy constructor.
 
Method Summary
 boolean equals(Object o)
           
 HdfsServerConstants.ReplicaState getState()
          Get the replica state
 long getVisibleLength()
          Get the number of bytes that are visible to readers
 int hashCode()
           
 
Methods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline
createStreams, getBytesAcked, getBytesOnDisk, getLastChecksumAndDataLen, setBytesAcked, setLastChecksumAndDataLen, setWriter, stopWriter, 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

ReplicaBeingWritten

public ReplicaBeingWritten(long blockId,
                           long genStamp,
                           FsVolumeSpi vol,
                           File dir)
Constructor for a zero length replica

Parameters:
blockId - block id
genStamp - replica generation stamp
vol - volume where replica is located
dir - directory path where block and meta files are located

ReplicaBeingWritten

public ReplicaBeingWritten(org.apache.hadoop.hdfs.protocol.Block block,
                           FsVolumeSpi vol,
                           File dir,
                           Thread writer)
Constructor

Parameters:
block - a block
vol - volume where replica is located
dir - directory path where block and meta files are located
writer - a thread that is writing to this replica

ReplicaBeingWritten

public ReplicaBeingWritten(long blockId,
                           long len,
                           long genStamp,
                           FsVolumeSpi vol,
                           File dir,
                           Thread writer)
Constructor

Parameters:
blockId - block id
len - replica length
genStamp - replica generation stamp
vol - volume where replica is located
dir - directory path where block and meta files are located
writer - a thread that is writing to this replica

ReplicaBeingWritten

public ReplicaBeingWritten(ReplicaBeingWritten from)
Copy constructor.

Parameters:
from -
Method Detail

getVisibleLength

public long getVisibleLength()
Description copied from interface: org.apache.hadoop.hdfs.server.datanode.Replica
Get the number of bytes that are visible to readers

Specified by:
getVisibleLength in interface org.apache.hadoop.hdfs.server.datanode.Replica
Overrides:
getVisibleLength in class ReplicaInPipeline
Returns:
the number of bytes that are visible to readers

getState

public HdfsServerConstants.ReplicaState getState()
Description copied from interface: org.apache.hadoop.hdfs.server.datanode.Replica
Get the replica state

Specified by:
getState in interface org.apache.hadoop.hdfs.server.datanode.Replica
Overrides:
getState in class ReplicaInPipeline
Returns:
the replica state

equals

public boolean equals(Object o)
Overrides:
equals in class ReplicaInPipeline

hashCode

public int hashCode()
Overrides:
hashCode in class ReplicaInPipeline


Copyright © 2013 Apache Software Foundation. All Rights Reserved.