Class StorageLocation
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.StorageLocation
- All Implemented Interfaces:
Comparable<StorageLocation>,Checkable<StorageLocation.CheckContext,VolumeCheckResult>
@Private
public class StorageLocation
extends Object
implements Checkable<StorageLocation.CheckContext,VolumeCheckResult>, Comparable<StorageLocation>
Encapsulates the URI and storage medium that together describe a
storage directory.
The default storage medium is assumed to be DISK, if none is specified.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classClass to hold the parameters for running acheck(org.apache.hadoop.hdfs.server.datanode.StorageLocation.CheckContext). -
Method Summary
Modifier and TypeMethodDescriptioncheck(StorageLocation.CheckContext context) Query the health of this object.intcompareTo(StorageLocation obj) booleanorg.apache.hadoop.fs.StorageTypegetUri()inthashCode()voidmakeBlockPoolDir(String blockPoolID, org.apache.hadoop.conf.Configuration conf) Create physical directory for block pools on the data node.booleanbooleanstatic URInormalizeFileURI(URI uri) static StorageLocationAttempt to parse a storage uri with storage class and URI.parseCapacityRatio(String capacityRatioConf) Attempt to parse the storage capacity ratio and related volume directory out of the capacity ratio config string.toString()
-
Method Details
-
normalizeFileURI
-
getStorageType
public org.apache.hadoop.fs.StorageType getStorageType() -
getUri
-
getNormalizedUri
-
matchesStorageDirectory
- Throws:
IOException
-
matchesStorageDirectory
- Throws:
IOException
-
parse
Attempt to parse a storage uri with storage class and URI. The storage class component of the uri is case-insensitive.- Parameters:
rawLocation- Location string of the format [type]uri, where [type] is optional.- Returns:
- A StorageLocation object if successfully parsed, null otherwise. Does not throw any exceptions.
- Throws:
IOExceptionSecurityException
-
parseCapacityRatio
Attempt to parse the storage capacity ratio and related volume directory out of the capacity ratio config string.- Parameters:
capacityRatioConf- Config string of the capacity ratio- Returns:
- Map of URI of the volume and capacity ratio.
- Throws:
SecurityException- when format is incorrect or ratio is not between 0 - 1.
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<StorageLocation>
-
getBpURI
-
makeBlockPoolDir
public void makeBlockPoolDir(String blockPoolID, org.apache.hadoop.conf.Configuration conf) throws IOException Create physical directory for block pools on the data node.- Parameters:
blockPoolID- the block pool idconf- Configuration instance to use.- Throws:
IOException- on errors
-
check
Description copied from interface:CheckableQuery the health of this object. This method may hang indefinitely depending on the status of the target resource.- Specified by:
checkin interfaceCheckable<StorageLocation.CheckContext,VolumeCheckResult> - Parameters:
context- for the probe operation. May be null depending on the implementation.- Returns:
- result of the check operation.
- Throws:
IOException
-