org.apache.hadoop.hdfs.server.datanode

## Class ReplicaBuilder

- java.lang.Object
- - org.apache.hadoop.hdfs.server.datanode.ReplicaBuilder

-     public class ReplicaBuilder
      extends Object

  This class is to be used as a builder for `ReplicaInfo` objects. The state of the replica is used to determine which object is instantiated.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReplicaBuilder(HdfsServerConstants.ReplicaState state)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.hadoop.hdfs.server.datanode.ReplicaInfo` | `build()`
    `LocalReplicaInPipeline` | `buildLocalReplicaInPipeline()`
    `ReplicaBuilder` | `from(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo fromReplica)`
    `ReplicaBuilder` | `setBlock(org.apache.hadoop.hdfs.protocol.Block block)`
    `ReplicaBuilder` | `setBlockId(long blockId)`
    `ReplicaBuilder` | `setBytesToReserve(long bytesToReserve)`
    `ReplicaBuilder` | `setConf(org.apache.hadoop.conf.Configuration conf)`
    `ReplicaBuilder` | `setDirectoryToUse(File dir)`
    `ReplicaBuilder` | `setFileRegion(FileRegion fileRegion)`
    `ReplicaBuilder` | `setFsVolume(FsVolumeSpi volume)`
    `ReplicaBuilder` | `setGenerationStamp(long genStamp)`
    `ReplicaBuilder` | `setLastPartialChunkChecksum(byte[] checksum)`
    `ReplicaBuilder` | `setLength(long length)`
    `ReplicaBuilder` | `setOffset(long offset)`
    `ReplicaBuilder` | `setPathHandle(org.apache.hadoop.fs.PathHandle pathHandle)`
    `ReplicaBuilder` | `setPathPrefix(org.apache.hadoop.fs.Path prefix)` Set the prefix of the `Path` associated with the replica.
    `ReplicaBuilder` | `setPathSuffix(String suffix)` Set the suffix of the `Path` associated with the replica.
    `ReplicaBuilder` | `setRecoveryId(long recoveryId)`
    `ReplicaBuilder` | `setRemoteFS(org.apache.hadoop.fs.FileSystem remoteFS)`
    `ReplicaBuilder` | `setState(HdfsServerConstants.ReplicaState state)`
    `ReplicaBuilder` | `setURI(URI uri)`
    `ReplicaBuilder` | `setWriterThread(Thread writer)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReplicaBuilder

          public ReplicaBuilder(HdfsServerConstants.ReplicaState state)

  - ### Method Detail

    - #### setState

          public ReplicaBuilder setState(HdfsServerConstants.ReplicaState state)

    - #### setBlockId

          public ReplicaBuilder setBlockId(long blockId)

    - #### setGenerationStamp

          public ReplicaBuilder setGenerationStamp(long genStamp)

    - #### setLength

          public ReplicaBuilder setLength(long length)

    - #### setFsVolume

          public ReplicaBuilder setFsVolume(FsVolumeSpi volume)

    - #### setDirectoryToUse

          public ReplicaBuilder setDirectoryToUse(File dir)

    - #### setBytesToReserve

          public ReplicaBuilder setBytesToReserve(long bytesToReserve)

    - #### setWriterThread

          public ReplicaBuilder setWriterThread(Thread writer)

    - #### from

          public ReplicaBuilder from(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo fromReplica)

    - #### setRecoveryId

          public ReplicaBuilder setRecoveryId(long recoveryId)

    - #### setBlock

          public ReplicaBuilder setBlock(org.apache.hadoop.hdfs.protocol.Block block)

    - #### setURI

          public ReplicaBuilder setURI(URI uri)

    - #### setConf

          public ReplicaBuilder setConf(org.apache.hadoop.conf.Configuration conf)

    - #### setOffset

          public ReplicaBuilder setOffset(long offset)

    - #### setFileRegion

          public ReplicaBuilder setFileRegion(FileRegion fileRegion)

    - #### setRemoteFS

          public ReplicaBuilder setRemoteFS(org.apache.hadoop.fs.FileSystem remoteFS)

    - #### setPathSuffix

          public ReplicaBuilder setPathSuffix(String suffix)

      Set the suffix of the `Path` associated with the replica. Intended to be use only for `ProvidedReplica`s.
      Parameters:
        `suffix` - the path suffix.
      Returns:
        the builder with the path suffix set.

    - #### setPathPrefix

          public ReplicaBuilder setPathPrefix(org.apache.hadoop.fs.Path prefix)

      Set the prefix of the `Path` associated with the replica. Intended to be use only for `ProvidedReplica`s.
      Parameters:
        `prefix` - the path prefix.
      Returns:
        the builder with the path prefix set.

    - #### setPathHandle

          public ReplicaBuilder setPathHandle(org.apache.hadoop.fs.PathHandle pathHandle)

    - #### setLastPartialChunkChecksum

          public ReplicaBuilder setLastPartialChunkChecksum(byte[] checksum)

    - #### buildLocalReplicaInPipeline

          public LocalReplicaInPipeline buildLocalReplicaInPipeline()
                                                             throws IllegalArgumentException

      Throws:
        `IllegalArgumentException`

    - #### build

          public org.apache.hadoop.hdfs.server.datanode.ReplicaInfo build()
                                                                   throws IllegalArgumentException

      Throws:
        `IllegalArgumentException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.