Package alluxio.worker.block
Class BlockStoreLocation
- java.lang.Object
-
- alluxio.worker.block.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.
-
Constructor Summary
Constructors Constructor Description BlockStoreLocation(java.lang.String tierAlias, int dirIndex)
Creates a new instance ofBlockStoreLocation
.BlockStoreLocation(java.lang.String tierAlias, int dirIndex, java.lang.String mediumType)
Creates a new instance ofBlockStoreLocation
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BlockStoreLocation
anyDirInAnyTierWithMedium(java.lang.String mediumType)
Convenience method to return the block store location representing any dir in any tier with specific medium.static BlockStoreLocation
anyDirInTier(java.lang.String tierAlias)
Convenience method to return the block store location representing any dir in the tier.static BlockStoreLocation
anyTier()
Convenience method to return the block store location representing any dir in any tier.boolean
belongsTo(BlockStoreLocation location)
Returns whether this location belongs to the specific location.int
dir()
Gets the directory index of the location.boolean
equals(java.lang.Object o)
Compares to a specific object.int
hashCode()
boolean
hasNoRestriction()
Check whether the location has no restriction, i.e.,ANY_TIER_LOCATION
.boolean
isAnyDir()
Check whether the location isANY_DIR
.boolean
isAnyDirWithTier()
Check whether the location isANY_DIR
within the specified tier.boolean
isAnyMedium()
Check whether the location isANY_MEDIUM
.boolean
isAnyTier()
Check whether the location isANY_TIER
.java.lang.String
mediumType()
Gets the medium type of the location.java.lang.String
tierAlias()
Gets the storage tier alias of the location.alluxio.grpc.BlockStoreLocationProto
toProto()
Fill BlockStoreLocationproto with location information.java.lang.String
toString()
Converts the location to a human readable form.
-
-
-
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 ofBlockStoreLocation
.- Parameters:
tierAlias
- the tier alias to usedirIndex
- the directory index to use
-
BlockStoreLocation
public BlockStoreLocation(java.lang.String tierAlias, int dirIndex, java.lang.String mediumType)
Creates a new instance ofBlockStoreLocation
.- Parameters:
tierAlias
- the tier alias to usedirIndex
- the directory index to usemediumType
- 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 isANY_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 isANY_DIR
.- Returns:
- true if location is
ANY_DIR
-
isAnyDirWithTier
public boolean isAnyDirWithTier()
Check whether the location isANY_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 isANY_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 classjava.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 classjava.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 classjava.lang.Object
-
toProto
public alluxio.grpc.BlockStoreLocationProto toProto()
Fill BlockStoreLocationproto with location information.- Returns:
- a proto object
-
-