Class DiskBalancerVolume

java.lang.Object
org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerVolume

public class DiskBalancerVolume extends Object
DiskBalancerVolume represents a volume in the DataNode.
  • Constructor Details

    • DiskBalancerVolume

      public DiskBalancerVolume()
      Constructs DiskBalancerVolume.
  • Method Details

    • parseJson

      public static DiskBalancerVolume parseJson(String json) throws IOException
      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

      public boolean equals(Object o)
      Compares two volumes and decides if it is the same volume.
      Overrides:
      equals in class Object
      Parameters:
      o - Volume Object
      Returns:
      boolean
    • hashCode

      public int hashCode()
      Computes hash code for a diskBalancerVolume.
      Overrides:
      hashCode in class Object
      Returns:
      int
    • 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

      public String getPath()
      Returns the path for this volume.
      Returns:
      String
    • setPath

      public void setPath(String volPath)
      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

      public String getStorageType()
      Gets the StorageType.
      Returns:
      String StorageType.
    • setStorageType

      public void setStorageType(String typeOfStorage)
      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

      public String getUuid()
      Gets the uuid for this volume.
      Returns:
      String - uuid of th volume
    • setUuid

      public void setUuid(String id)
      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

      public String toJson() throws IOException
      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