Class DFSTopologyNodeImpl

java.lang.Object
org.apache.hadoop.net.NodeBase
org.apache.hadoop.net.InnerNodeImpl
org.apache.hadoop.hdfs.net.DFSTopologyNodeImpl
All Implemented Interfaces:
org.apache.hadoop.net.InnerNode, org.apache.hadoop.net.Node

public class DFSTopologyNodeImpl extends org.apache.hadoop.net.InnerNodeImpl
The HDFS-specific representation of a network topology inner node. The difference is this class includes the information about the storage type info of this subtree. This info will be used when selecting subtrees in block placement.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     

    Fields inherited from class org.apache.hadoop.net.InnerNodeImpl

    children, childrenMap, numOfLeaves

    Fields inherited from class org.apache.hadoop.net.NodeBase

    level, location, name, parent, PATH_SEPARATOR, PATH_SEPARATOR_STR, ROOT
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(org.apache.hadoop.net.Node n)
     
    void
    childAddStorage(String childName, org.apache.hadoop.fs.StorageType type)
    Called by a child node of the current node to increment a storage count.
    void
    childRemoveStorage(String childName, org.apache.hadoop.fs.StorageType type)
    Called by a child node of the current node to decrement a storage count.
    boolean
     
    int
    getSubtreeStorageCount(org.apache.hadoop.fs.StorageType type)
     
    int
     
    boolean
    remove(org.apache.hadoop.net.Node n)
     

    Methods inherited from class org.apache.hadoop.net.InnerNodeImpl

    getChildren, getLeaf, getLoc, getNextAncestorName, getNumOfChildren, getNumOfLeaves, isAncestor, isParent, isRack

    Methods inherited from class org.apache.hadoop.net.NodeBase

    getLevel, getName, getNetworkLocation, getParent, getPath, getPathComponents, locationToDepth, normalize, setLevel, setNetworkLocation, setParent, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.hadoop.net.Node

    getLevel, getName, getNetworkLocation, getParent, setLevel, setNetworkLocation, setParent
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Method Details

    • getSubtreeStorageCount

      public int getSubtreeStorageCount(org.apache.hadoop.fs.StorageType type)
    • add

      public boolean add(org.apache.hadoop.net.Node n)
      Specified by:
      add in interface org.apache.hadoop.net.InnerNode
      Overrides:
      add in class org.apache.hadoop.net.InnerNodeImpl
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class org.apache.hadoop.net.InnerNodeImpl
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.apache.hadoop.net.InnerNodeImpl
    • remove

      public boolean remove(org.apache.hadoop.net.Node n)
      Specified by:
      remove in interface org.apache.hadoop.net.InnerNode
      Overrides:
      remove in class org.apache.hadoop.net.InnerNodeImpl
    • childAddStorage

      public void childAddStorage(String childName, org.apache.hadoop.fs.StorageType type)
      Called by a child node of the current node to increment a storage count. lock is needed as different datanodes may call recursively to modify the same parent. TODO : this may not happen at all, depending on how heartheat is processed
      Parameters:
      childName - the name of the child that tries to add the storage type
      type - the type being incremented.
    • childRemoveStorage

      public void childRemoveStorage(String childName, org.apache.hadoop.fs.StorageType type)
      Called by a child node of the current node to decrement a storage count.
      Parameters:
      childName - the name of the child removing a storage type.
      type - the type being removed.