ReplicaBeingWritten (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.datanode, class: ReplicaBeingWritten

Package 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.LocalReplica
org.apache.hadoop.hdfs.server.datanode.LocalReplicaInPipeline
org.apache.hadoop.hdfs.server.datanode.ReplicaBeingWritten

All Implemented Interfaces:
  `Comparable<org.apache.hadoop.hdfs.protocol.Block>`, `Replica`, `ReplicaInPipeline`, `org.apache.hadoop.io.Writable`, `org.apache.hadoop.util.LightWeightGSet.LinkedElement`

public class ReplicaBeingWritten extends LocalReplicaInPipeline
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.LocalReplica

  `LocalReplica.ReplicaDirInfo`

- ## Field Summary

  ### Fields inherited from class org.apache.hadoop.hdfs.protocol.Block

  `BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern, metaOrBlockFilePattern`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ReplicaBeingWritten(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, Thread writer, long bytesToReserve)`
  Constructor.
  `ReplicaBeingWritten(long blockId, long genStamp, FsVolumeSpi vol, File dir, long bytesToReserve)`
  Constructor for a zero length replica.
  `ReplicaBeingWritten(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, Thread writer)`
  Constructor.
  `ReplicaBeingWritten(ReplicaBeingWritten from)`
  Copy constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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.LocalReplicaInPipeline

  `attemptToSetWriter, createInfo, createRestartMetaStream, createStreams, getBytesAcked, getBytesOnDisk, getBytesReserved, getLastChecksumAndDataLen, getOriginalBytesReserved, getOriginalReplica, getRecoveryID, getReplicaInfo, interruptThread, moveReplicaFrom, releaseAllBytesReserved, releaseReplicaInfoBytesReserved, setBytesAcked, setLastChecksumAndDataLen, setRecoveryID, setWriter, stopWriter, toString, waitForMinLength`

  ### Methods inherited from class org.apache.hadoop.hdfs.server.datanode.LocalReplica

  `blockDataExists, breakHardLinksIfNeeded, bumpReplicaGS, compareWith, copyBlockdata, copyMetadata, deleteBlockData, deleteMetadata, fsyncDirectory, getBlockDataLength, getBlockFile, getBlockURI, getDataInputStream, getDataOutputStream, getDir, getMetadataInputStream, getMetadataLength, getMetadataOutputStream, getMetadataURI, getMetaFile, getPinning, getPinning, metadataExists, parseBaseDir, renameData, renameMeta, setPinning, setPinning, truncateBlock, truncateBlock, updateWithReplica`

  ### Methods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo

  `getFileIoProvider, getNext, getStorageUuid, getVolume, isOnTransientStorage, setNext`

  ### 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, toString, 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.Replica

  `getBlockId, getGenerationStamp, getNumBytes, getStorageUuid, getVolume, isOnTransientStorage`

  ### Methods inherited from interface org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline

  `setNumBytes`

- ## Constructor Details

  - ### ReplicaBeingWritten

    public ReplicaBeingWritten(long blockId, long genStamp, FsVolumeSpi vol, File dir, long bytesToReserve)
    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
      `bytesToReserve` - 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 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, long bytesToReserve)
    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
      `bytesToReserve` - 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

- ## Method Details

  - ### getVisibleLength

    public long getVisibleLength()
    Description copied from interface: `Replica`
    Get the number of bytes that are visible to readers
    Specified by:
      `getVisibleLength` in interface `Replica`
    Overrides:
      `getVisibleLength` in class `LocalReplicaInPipeline`
    Returns:
      the number of bytes that are visible to readers

  - ### getState

    public HdfsServerConstants.ReplicaState getState()
    Description copied from interface: `Replica`
    Get the replica state
    Specified by:
      `getState` in interface `Replica`
    Overrides:
      `getState` in class `LocalReplicaInPipeline`
    Returns:
      the replica state

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `LocalReplicaInPipeline`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `LocalReplicaInPipeline`