org.apache.hadoop.hdfs.server.datanode
Class ReplicaBeingWritten
java.lang.Object
org.apache.hadoop.hdfs.protocol.Block
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline
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.
| Fields inherited from class org.apache.hadoop.hdfs.protocol.Block |
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern, metaOrBlockFilePattern |
|
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,
long bytesToReserve)
Constructor for a zero length replica |
ReplicaBeingWritten(long blockId,
long len,
long genStamp,
FsVolumeSpi vol,
File dir,
Thread writer,
long bytesToReserve)
Constructor |
ReplicaBeingWritten(ReplicaBeingWritten from)
Copy constructor. |
| Methods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo |
getBlockFile, getMetaFile, getStorageUuid, getVolume, isOnTransientStorage, isUnlinked, parseBaseDir, 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, metaToBlockFile, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, write, writeId |
| Methods inherited from interface org.apache.hadoop.hdfs.server.datanode.Replica |
getBlockId, getGenerationStamp, getNumBytes, getStorageUuid, isOnTransientStorage |
ReplicaBeingWritten
public ReplicaBeingWritten(long blockId,
long genStamp,
FsVolumeSpi vol,
File dir,
long bytesToReserve)
- Constructor for a zero length replica
- Parameters:
blockId - block idgenStamp - replica generation stampvol - volume where replica is locateddir - directory path where block and meta files are locatedbytesToReserve - disk space to reserve for this replica, based on
the estimated maximum block length.
ReplicaBeingWritten
public ReplicaBeingWritten(org.apache.hadoop.hdfs.protocol.Block block,
FsVolumeSpi vol,
File dir,
Thread writer)
- Constructor
- Parameters:
block - a blockvol - volume where replica is locateddir - directory path where block and meta files are locatedwriter - a thread that is writing to this replica
ReplicaBeingWritten
public ReplicaBeingWritten(long blockId,
long len,
long genStamp,
FsVolumeSpi vol,
File dir,
Thread writer,
long bytesToReserve)
- Constructor
- Parameters:
blockId - block idlen - replica lengthgenStamp - replica generation stampvol - volume where replica is locateddir - directory path where block and meta files are locatedwriter - a thread that is writing to this replicabytesToReserve - disk space to reserve for this replica, based on
the estimated maximum block length.
ReplicaBeingWritten
public ReplicaBeingWritten(ReplicaBeingWritten from)
- Copy constructor.
- Parameters:
from - where to copy from
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 © 2014 Apache Software Foundation. All Rights Reserved.