HashResolver (Apache Hadoop HDFS-RBF 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.federation.resolver.order, class: HashResolver

Package org.apache.hadoop.hdfs.server.federation.resolver.order

# Class HashResolver

java.lang.Object
org.apache.hadoop.hdfs.server.federation.resolver.order.HashResolver

All Implemented Interfaces:
  `OrderedResolver`

Direct Known Subclasses:
  `HashFirstResolver`

public class HashResolver extends Object implements OrderedResolver
Order the destinations based on consistent hashing.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final org.slf4j.Logger`
  `LOG`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HashResolver()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `extractTempFileName(String input)`
  Some files use a temporary naming pattern.
  `String`
  `getFirstNamespace(String path, PathLocation loc)`
  Use the result from consistent hashing locator to prioritize the locations for a path.

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

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

- ## Field Details

  - ### LOG

    protected static final org.slf4j.Logger LOG

- ## Constructor Details

  - ### HashResolver

    public HashResolver()

- ## Method Details

  - ### getFirstNamespace

    public String getFirstNamespace(String path, PathLocation loc)
    Use the result from consistent hashing locator to prioritize the locations for a path.
    Specified by:
      `getFirstNamespace` in interface `OrderedResolver`
    Parameters:
      `path` - Path to check.
      `loc` - Federated location with multiple destinations.
    Returns:
      First namespace based on hash.

  - ### extractTempFileName

    @VisibleForTesting public static String extractTempFileName(String input)
    Some files use a temporary naming pattern. Extract the final name from the temporary name. For example, files *._COPYING_ will be renamed, so we remove that chunk.
    Parameters:
      `input` - Input string.
    Returns:
      Final file name.