org.apache.hadoop.hdfs

## Class ReplicaAccessorBuilder

- java.lang.Object
- - org.apache.hadoop.hdfs.ReplicaAccessorBuilder

-     @InterfaceAudience.Public
       @InterfaceStability.Stable
      public abstract class ReplicaAccessorBuilder
      extends Object

  The public API for creating a new ReplicaAccessor.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReplicaAccessorBuilder()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract ReplicaAccessor` | `build()` Build a new ReplicaAccessor.
    `abstract ReplicaAccessorBuilder` | `setAllowShortCircuitReads(boolean allowShortCircuit)` Set whether short-circuit is enabled.
    `abstract ReplicaAccessorBuilder` | `setBlock(long blockId, String blockPoolId)` Set the block ID and block pool ID which are being opened.
    `abstract ReplicaAccessorBuilder` | `setBlockAccessToken(byte[] token)` Set the block access token to use.
    `abstract ReplicaAccessorBuilder` | `setClientName(String clientName)` Set the name of the HDFS client.
    `abstract ReplicaAccessorBuilder` | `setConfiguration(org.apache.hadoop.conf.Configuration conf)` Set the configuration to use.
    `abstract ReplicaAccessorBuilder` | `setFileName(String fileName)` Set the file name which is being opened.
    `abstract ReplicaAccessorBuilder` | `setGenerationStamp(long genstamp)` Set the genstamp of the block which is being opened.
    `abstract ReplicaAccessorBuilder` | `setVerifyChecksum(boolean verifyChecksum)` Set whether checksums must be verified.
    `abstract ReplicaAccessorBuilder` | `setVisibleLength(long visibleLength)` Set the length of the replica which is visible to this client.

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

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

- - ### Constructor Detail

    - #### ReplicaAccessorBuilder

          public ReplicaAccessorBuilder()

  - ### Method Detail

    - #### setFileName

          public abstract ReplicaAccessorBuilder setFileName(String fileName)

      Set the file name which is being opened. Provided for debugging purposes.

    - #### setBlock

          public abstract ReplicaAccessorBuilder setBlock(long blockId,
                                                          String blockPoolId)

      Set the block ID and block pool ID which are being opened.

    - #### setGenerationStamp

          public abstract ReplicaAccessorBuilder setGenerationStamp(long genstamp)

      Set the genstamp of the block which is being opened.

    - #### setVerifyChecksum

          public abstract ReplicaAccessorBuilder setVerifyChecksum(boolean verifyChecksum)

      Set whether checksums must be verified. Checksums should be skipped if the user has disabled checksum verification in the configuration. Users may wish to do this if their software does checksum verification at a higher level than HDFS.

    - #### setClientName

          public abstract ReplicaAccessorBuilder setClientName(String clientName)

      Set the name of the HDFS client. Provided for debugging purposes.

    - #### setAllowShortCircuitReads

          public abstract ReplicaAccessorBuilder setAllowShortCircuitReads(boolean allowShortCircuit)

      Set whether short-circuit is enabled. Short-circuit may be disabled if the user has set dfs.client.read.shortcircuit to false, or if the block being read is under construction. The fact that this bit is enabled does not mean that the user has permission to do short-circuit reads or to access the replica-- that must be checked separately by the ReplicaAccessorBuilder implementation.

    - #### setVisibleLength

          public abstract ReplicaAccessorBuilder setVisibleLength(long visibleLength)

      Set the length of the replica which is visible to this client. If bytes are added later, they will not be visible to the ReplicaAccessor we are building. In order to see more of the replica, the client must re-open this HDFS file. The visible length provides an upper bound, but not a lower one. If the replica is deleted or truncated, fewer bytes may be visible than specified here.

    - #### setConfiguration

          public abstract ReplicaAccessorBuilder setConfiguration(org.apache.hadoop.conf.Configuration conf)

      Set the configuration to use. ReplicaAccessorBuilder subclasses should define their own configuration prefix. For example, the foobar plugin could look for configuration keys like foo.bar.parameter1, foo.bar.parameter2.

    - #### setBlockAccessToken

          public abstract ReplicaAccessorBuilder setBlockAccessToken(byte[] token)

      Set the block access token to use.

    - #### build

          public abstract ReplicaAccessor build()

      Build a new ReplicaAccessor. The implementation must perform any necessary access checks before constructing the ReplicaAccessor. If there is a hardware-level or network-level setup operation that could fail, it should be done here. If the implementation returns a ReplicaAccessor, we will assume that it works and not attempt to construct a normal BlockReader. If the ReplicaAccessor could not be built, implementations may wish to log a message at TRACE level indicating why.
      Returns:
        null if the ReplicaAccessor could not be built; the ReplicaAccessor otherwise.

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