Class BlockStoreLocation


  • @ThreadSafe
    public final class BlockStoreLocation
    extends java.lang.Object
    Where to store a block within a block store. It describes the block storage location in three dimensions, tierAlias, dir index within the tier and the medium type of the storage location. Currently, there is an assumption that the medium type and the tier alias are not set at the same time.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ANY_TIER
      Special value to indicate any tier.
    • Field Detail

      • ANY_TIER

        public static final java.lang.String ANY_TIER
        Special value to indicate any tier.
        See Also:
        Constant Field Values
    • Constructor Detail

      • BlockStoreLocation

        public BlockStoreLocation​(java.lang.String tierAlias,
                                  int dirIndex)
        Creates a new instance of BlockStoreLocation.
        Parameters:
        tierAlias - the tier alias to use
        dirIndex - the directory index to use
      • BlockStoreLocation

        public BlockStoreLocation​(java.lang.String tierAlias,
                                  int dirIndex,
                                  java.lang.String mediumType)
        Creates a new instance of BlockStoreLocation.
        Parameters:
        tierAlias - the tier alias to use
        dirIndex - the directory index to use
        mediumType - the medium type to use
    • Method Detail

      • anyTier

        public static BlockStoreLocation anyTier()
        Convenience method to return the block store location representing any dir in any tier.
        Returns:
        a BlockStoreLocation of any dir in any tier
      • anyDirInTier

        public static BlockStoreLocation anyDirInTier​(java.lang.String tierAlias)
        Convenience method to return the block store location representing any dir in the tier.
        Parameters:
        tierAlias - The alias of the tier this returned block store location will represent
        Returns:
        a BlockStoreLocation of any dir in the specified tier
      • anyDirInAnyTierWithMedium

        public static BlockStoreLocation anyDirInAnyTierWithMedium​(java.lang.String mediumType)
        Convenience method to return the block store location representing any dir in any tier with specific medium.
        Parameters:
        mediumType - mediumType this returned block store location will represent
        Returns:
        a BlockStoreLocation of any dir in any tier with a specific medium
      • tierAlias

        public java.lang.String tierAlias()
        Gets the storage tier alias of the location.
        Returns:
        the tier alias of the location
      • hasNoRestriction

        public boolean hasNoRestriction()
        Check whether the location has no restriction, i.e., ANY_TIER_LOCATION.
        Returns:
        true if location is equal to ANY_TIER_LOCATION
      • isAnyTier

        public boolean isAnyTier()
        Check whether the location is ANY_TIER.
        Returns:
        true if location is ANY_TIER
      • dir

        public int dir()
        Gets the directory index of the location.
        Returns:
        the directory index of the location, ANY_DIR for any directory
      • isAnyDir

        public boolean isAnyDir()
        Check whether the location is ANY_DIR.
        Returns:
        true if location is ANY_DIR
      • isAnyDirWithTier

        public boolean isAnyDirWithTier()
        Check whether the location is ANY_DIR within the specified tier.
        Returns:
        true if location is ANY_DIR within the specified tier
      • mediumType

        public java.lang.String mediumType()
        Gets the medium type of the location.
        Returns:
        the medium type of the location
      • isAnyMedium

        public boolean isAnyMedium()
        Check whether the location is ANY_MEDIUM.
        Returns:
        true if location is ANY_MEDIUM
      • belongsTo

        public boolean belongsTo​(BlockStoreLocation location)
        Returns whether this location belongs to the specific location. Location A belongs to B when tier and dir of A are all in the range of B respectively.
        Parameters:
        location - the target BlockStoreLocation
        Returns:
        true when this BlockStoreLocation belongs to the target, otherwise false
      • toString

        public java.lang.String toString()
        Converts the location to a human readable form.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a human readable string representing the information of this block store location
      • equals

        public boolean equals​(java.lang.Object o)
        Compares to a specific object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the object to compare
        Returns:
        true if object is also BlockStoreLocation and represents the same tier and dir
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toProto

        public alluxio.grpc.BlockStoreLocationProto toProto()
        Fill BlockStoreLocationproto with location information.
        Returns:
        a proto object