Package alluxio.util

Class TieredIdentityUtils


  • @ThreadSafe
    public final class TieredIdentityUtils
    extends java.lang.Object
    Utility functions for working with tiered identity.
    • Method Detail

      • matches

        public static boolean matches​(TieredIdentity.LocalityTier tier,
                                      TieredIdentity.LocalityTier otherTier,
                                      boolean resolveIpAddress)
        Locality comparison for wire type locality tiers, two locality tiers matches if both name and values are equal, or for the "node" tier, if the node names resolve to the same IP address.
        Parameters:
        tier - a wire type locality tier
        otherTier - a wire type locality tier to compare to
        resolveIpAddress - whether or not to resolve hostnames to IP addresses for node locality
        Returns:
        true if the wire type locality tier matches the given tier
      • nearest

        public static java.util.Optional<TieredIdentity> nearest​(TieredIdentity tieredIdentity,
                                                                 java.util.List<TieredIdentity> identities,
                                                                 AlluxioConfiguration conf)
        Parameters:
        tieredIdentity - the tiered identity
        identities - the tiered identities to compare to
        conf - Alluxio configuration
        Returns:
        the identity closest to this one. If none of the identities match, the first identity is returned