Package org.apache.hadoop.hdfs
Class ReplicaAccessorBuilder
java.lang.Object
org.apache.hadoop.hdfs.ReplicaAccessorBuilder
The public API for creating a new ReplicaAccessor.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ReplicaAccessorbuild()Build a new ReplicaAccessor.abstract ReplicaAccessorBuildersetAllowShortCircuitReads(boolean allowShortCircuit) Set whether short-circuit is enabled.abstract ReplicaAccessorBuilderSet the block ID and block pool ID which are being opened.abstract ReplicaAccessorBuildersetBlockAccessToken(byte[] token) Set the block access token to use.abstract ReplicaAccessorBuildersetClientName(String clientName) Set the name of the HDFS client.abstract ReplicaAccessorBuilderSet the configuration to use.abstract ReplicaAccessorBuildersetFileName(String fileName) Set the file name which is being opened.abstract ReplicaAccessorBuildersetGenerationStamp(long genstamp) Set the genstamp of the block which is being opened.abstract ReplicaAccessorBuildersetVerifyChecksum(boolean verifyChecksum) Set whether checksums must be verified.abstract ReplicaAccessorBuildersetVisibleLength(long visibleLength) Set the length of the replica which is visible to this client.
-
Constructor Details
-
ReplicaAccessorBuilder
public ReplicaAccessorBuilder()
-
-
Method Details
-
setFileName
Set the file name which is being opened. Provided for debugging purposes. -
setBlock
Set the block ID and block pool ID which are being opened. -
setGenerationStamp
Set the genstamp of the block which is being opened. -
setVerifyChecksum
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
Set the name of the HDFS client. Provided for debugging purposes. -
setAllowShortCircuitReads
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
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
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
Set the block access token to use. -
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.
-