Class ReplicaAccessorBuilder

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

@Public @Stable public abstract class ReplicaAccessorBuilder extends Object
The public API for creating a new ReplicaAccessor.
  • Constructor Details

    • ReplicaAccessorBuilder

      public ReplicaAccessorBuilder()
  • Method Details

    • 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(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.