Class DiskBalancerVolume
java.lang.Object
org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerVolume
DiskBalancerVolume represents a volume in the DataNode.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns effective capacity of a volume.floatReturns the usedPercentage of a disk.booleanCompares two volumes and decides if it is the same volume.longCapacity of this volume.doubleGet ratio between free space and capacity.longGet free space of the volume.getPath()Returns the path for this volume.longGets the reserved size for this volume.Gets the StorageType.longgetUsed()Gets the dfsUsed Size.doubleGet ratio between used space and capacity.getUuid()Gets the uuid for this volume.doubleGet this volume Data Density Please see DiskBalancerVolumeSet#computeVolumeDataDensity to see how this is computed.inthashCode()Computes hash code for a diskBalancerVolume.booleanisFailed()Indicates if this is a failed volume.booleanTells us if this volume is read-only.booleanisSkip()returns if we should skip this volume.booleanIndicates if the volume is Transient in nature.static DiskBalancerVolumeParses a Json string and converts to DiskBalancerVolume.voidsetCapacity(long totalCapacity) Sets the capacity of this volume.voidsetFailed(boolean fail) Sets the failed flag for this volume.voidsetIsTransient(boolean transientValue) Tells us if a volume is transient.voidSets the path for this volume.voidsetReadOnly(boolean readOnly) Sets this volume as read only.voidsetReserved(long reservedSize) Sets the reserved size.voidsetSkip(boolean skipValue) Sets the Skip value for this volume.voidsetStorageType(String typeOfStorage) Sets the StorageType.voidsetTransient(boolean aTransient) Sets volumes transient nature.voidsetUsed(long dfsUsedSpace) Sets the used Space for Long.voidSets the uuid for this volume.voidsetVolumeDataDensity(double volDataDensity) Sets this volume's data density.toJson()returns a Json String.
-
Constructor Details
-
DiskBalancerVolume
public DiskBalancerVolume()Constructs DiskBalancerVolume.
-
-
Method Details
-
parseJson
Parses a Json string and converts to DiskBalancerVolume.- Parameters:
json- - Json String- Returns:
- DiskBalancerCluster
- Throws:
IOException
-
getVolumeDataDensity
public double getVolumeDataDensity()Get this volume Data Density Please see DiskBalancerVolumeSet#computeVolumeDataDensity to see how this is computed.- Returns:
- float.
-
setVolumeDataDensity
public void setVolumeDataDensity(double volDataDensity) Sets this volume's data density.- Parameters:
volDataDensity- - density
-
isTransient
public boolean isTransient()Indicates if the volume is Transient in nature.- Returns:
- true or false.
-
setTransient
public void setTransient(boolean aTransient) Sets volumes transient nature.- Parameters:
aTransient- - bool
-
equals
Compares two volumes and decides if it is the same volume. -
hashCode
public int hashCode()Computes hash code for a diskBalancerVolume. -
getCapacity
public long getCapacity()Capacity of this volume.- Returns:
- long
-
getFreeSpace
public long getFreeSpace()Get free space of the volume.- Returns:
- long
-
getUsedRatio
public double getUsedRatio()Get ratio between used space and capacity.- Returns:
- double
-
getFreeRatio
public double getFreeRatio()Get ratio between free space and capacity.- Returns:
- double
-
setCapacity
public void setCapacity(long totalCapacity) Sets the capacity of this volume.- Parameters:
totalCapacity- long
-
isFailed
public boolean isFailed()Indicates if this is a failed volume.- Returns:
- boolean
-
setFailed
public void setFailed(boolean fail) Sets the failed flag for this volume.- Parameters:
fail- boolean
-
getPath
Returns the path for this volume.- Returns:
- String
-
setPath
Sets the path for this volume.- Parameters:
volPath- Path
-
getReserved
public long getReserved()Gets the reserved size for this volume.- Returns:
- Long - Reserved size.
-
setReserved
public void setReserved(long reservedSize) Sets the reserved size.- Parameters:
reservedSize- -- Sets the reserved.
-
getStorageType
Gets the StorageType.- Returns:
- String StorageType.
-
setStorageType
Sets the StorageType.- Parameters:
typeOfStorage- - Storage Type String.
-
getUsed
public long getUsed()Gets the dfsUsed Size.- Returns:
- - long - used space
-
setUsed
public void setUsed(long dfsUsedSpace) Sets the used Space for Long.- Parameters:
dfsUsedSpace- - dfsUsedSpace for this volume.
-
getUuid
Gets the uuid for this volume.- Returns:
- String - uuid of th volume
-
setUuid
Sets the uuid for this volume.- Parameters:
id- - String
-
computeEffectiveCapacity
public long computeEffectiveCapacity()Returns effective capacity of a volume.- Returns:
- float - fraction that represents used capacity.
-
toJson
returns a Json String.- Returns:
- String
- Throws:
IOException
-
isSkip
public boolean isSkip()returns if we should skip this volume.- Returns:
- true / false
-
setSkip
public void setSkip(boolean skipValue) Sets the Skip value for this volume.- Parameters:
skipValue- bool
-
computeUsedPercentage
public float computeUsedPercentage()Returns the usedPercentage of a disk. This is useful in debugging disk usage- Returns:
- float
-
setIsTransient
public void setIsTransient(boolean transientValue) Tells us if a volume is transient.- Parameters:
transientValue-
-
isReadOnly
public boolean isReadOnly()Tells us if this volume is read-only.- Returns:
- true / false
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets this volume as read only.- Parameters:
readOnly- - boolean
-