Class FinalizedReplica

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

public class FinalizedReplica extends LocalReplica
This class describes a replica that has been finalized.
  • Constructor Details

    • FinalizedReplica

      public FinalizedReplica(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir)
      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
    • FinalizedReplica

      public FinalizedReplica(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, byte[] checksum)
      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
      checksum - the last partial chunk checksum
    • FinalizedReplica

      public FinalizedReplica(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir)
      Constructor
      Parameters:
      block - a block
      vol - volume where replica is located
      dir - directory path where block and meta files are located
    • FinalizedReplica

      public FinalizedReplica(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, byte[] checksum)
      Constructor
      Parameters:
      block - a block
      vol - volume where replica is located
      dir - directory path where block and meta files are located
      checksum - the last partial chunk checksum
    • FinalizedReplica

      public FinalizedReplica(FinalizedReplica from)
      Copy constructor.
      Parameters:
      from - where to copy construct from
  • Method Details

    • getState

      Description copied from interface: Replica
      Get the replica state
      Returns:
      the replica state
    • getVisibleLength

      public long getVisibleLength()
      Description copied from interface: Replica
      Get the number of bytes that are visible to readers
      Returns:
      the number of bytes that are visible to readers
    • getBytesOnDisk

      public long getBytesOnDisk()
      Description copied from interface: Replica
      Get the number of bytes that have written to disk
      Returns:
      the number of bytes that have written to disk
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class org.apache.hadoop.hdfs.protocol.Block
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.apache.hadoop.hdfs.protocol.Block
    • toString

      public String toString()
      Overrides:
      toString in class ReplicaInfo
    • getOriginalReplica

      public ReplicaInfo getOriginalReplica()
      Specified by:
      getOriginalReplica in class ReplicaInfo
    • getRecoveryID

      public long getRecoveryID()
      Description copied from class: ReplicaInfo
      Get the recovery id.
      Specified by:
      getRecoveryID in class ReplicaInfo
      Returns:
      the generation stamp that the replica will be bumped to
    • setRecoveryID

      public void setRecoveryID(long recoveryId)
      Description copied from class: ReplicaInfo
      Set the recovery id.
      Specified by:
      setRecoveryID in class ReplicaInfo
      Parameters:
      recoveryId - the new recoveryId
    • createInfo

      public ReplicaRecoveryInfo createInfo()
      Specified by:
      createInfo in class ReplicaInfo
    • getMetadataLength

      public long getMetadataLength()
      Overrides:
      getMetadataLength in class LocalReplica
      Returns:
      the length of the metadata on storage.
    • getLastPartialChunkChecksum

      public byte[] getLastPartialChunkChecksum()
    • setLastPartialChunkChecksum

      public void setLastPartialChunkChecksum(byte[] checksum)
    • loadLastPartialChunkChecksum

      public void loadLastPartialChunkChecksum() throws IOException
      Throws:
      IOException