java.lang.Object
org.apache.hadoop.hdfs.server.federation.resolver.PathLocation

public class PathLocation extends Object
A map of the properties and target destinations (name space + path) for a path in the global/federated name space. This data is generated from the @see MountTable records.
  • Constructor Details

    • PathLocation

      public PathLocation(String source, List<RemoteLocation> dest, DestinationOrder order)
      Create a new PathLocation.
      Parameters:
      source - Source path in the global name space.
      dest - Destinations of the mount table entry.
      order - Order of the locations.
    • PathLocation

      public PathLocation(String source, List<RemoteLocation> dest)
      Create a new PathLocation with default HASH order.
      Parameters:
      source - Source path in the global name space.
      dest - Destinations of the mount table entry.
    • PathLocation

      public PathLocation(PathLocation other)
      Create a path location from another path.
      Parameters:
      other - Other path location to copy from.
    • PathLocation

      @Deprecated public PathLocation(PathLocation other, String firstNsId)
      Deprecated.
      Create a path location from another path with the destinations sorted.
      Parameters:
      other - Other path location to copy from.
      firstNsId - Identifier of the namespace to place first.
  • Method Details

    • prioritizeDestination

      public static PathLocation prioritizeDestination(PathLocation base, String firstNsId)
      Return a path location with the prioritized destinations based on the current path location.
      Parameters:
      base - The base path location we'd like to prioritize on.
      firstNsId - Identifier of the namespace to place first.
      Returns:
      path location with the prioritized destinations.
    • getSourcePath

      public String getSourcePath()
      Get the source path in the global namespace for this path location.
      Returns:
      The path in the global namespace.
    • getNamespaces

      public Set<String> getNamespaces()
      Get the subclusters defined for the destinations.
      Returns:
      Set containing the subclusters.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hasMultipleDestinations

      public boolean hasMultipleDestinations()
      Check if this location supports multiple clusters/paths.
      Returns:
      If it has multiple destinations.
    • getDestinations

      public List<RemoteLocation> getDestinations()
      Get the list of locations found in the mount table. The first result is the highest priority path.
      Returns:
      List of remote locations.
    • getDestinationOrder

      public DestinationOrder getDestinationOrder()
      Get the order for the destinations.
      Returns:
      Order for the destinations.
    • getDefaultLocation

      public RemoteLocation getDefaultLocation()
      Get the default or highest priority location.
      Returns:
      The default location.