NamespacePrintVisitor (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.namenode.visitor, class: NamespacePrintVisitor

Package org.apache.hadoop.hdfs.server.namenode.visitor

# Class NamespacePrintVisitor

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.visitor.NamespacePrintVisitor

All Implemented Interfaces:
  `NamespaceVisitor`

public final class NamespacePrintVisitor extends Object implements NamespaceVisitor
To print the namespace tree recursively for testing. \- foo (INodeDirectory@33dd2717) \- sub1 (INodeDirectory@442172) +- file1 (INodeFile@78392d4) +- file2 (INodeFile@78392d5) +- sub11 (INodeDirectory@8400cff) \- file3 (INodeFile@78392d6) \- z_file4 (INodeFile@45848712)

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.apache.hadoop.hdfs.server.namenode.visitor.NamespaceVisitor

  `NamespaceVisitor.Element, NamespaceVisitor.INodeVisitor`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `postVisitReferred(INode referred)`
  Right after visiting the given referred `INode`.
  `void`
  `postVisitSub(NamespaceVisitor.Element sub, int index, boolean isLast)`
  Right after visiting the given sub `NamespaceVisitor.Element`.
  `void`
  `preVisitReferred(INode referred)`
  Right before visiting the given referred `INode`.
  `void`
  `preVisitSub(NamespaceVisitor.Element sub, int index, boolean isLast)`
  Right before visiting the given sub `NamespaceVisitor.Element`.
  `static String`
  `print2Sting(FSNamesystem ns)`
  `static String`
  `print2Sting(INode root)`
  `void`
  `visitDirectory(INodeDirectory dir, int snapshot)`
  Visiting the given `INodeDirectory` (non-recursively).
  `void`
  `visitFile(INodeFile file, int snapshot)`
  Visiting the given `INodeFile`.
  `void`
  `visitReference(INodeReference ref, int snapshot)`
  Visiting the given `INodeReference` (non-recursively).
  `void`
  `visitSnapshottable(INodeDirectory dir, DirectorySnapshottableFeature snapshottable)`
  Visiting a `DirectorySnapshottableFeature`.
  `void`
  `visitSymlink(INodeSymlink symlink, int snapshot)`
  Visiting the given `INodeSymlink`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.hadoop.hdfs.server.namenode.visitor.NamespaceVisitor

  `getDefaultVisitor, visitDirectoryRecursively, visitReferenceRecursively, visitSubs`

- ## Method Details

  - ### print2Sting

    public static String print2Sting(FSNamesystem ns)
    Returns:
      string of the tree in the given `FSNamesystem`.

  - ### print2Sting

    public static String print2Sting(INode root)
    Returns:
      string of the tree from the given root.

  - ### visitFile

    public void visitFile(INodeFile file, int snapshot)
    Description copied from interface: `NamespaceVisitor`
    Visiting the given `INodeFile`.
    Specified by:
      `visitFile` in interface `NamespaceVisitor`

  - ### visitSymlink

    public void visitSymlink(INodeSymlink symlink, int snapshot)
    Description copied from interface: `NamespaceVisitor`
    Visiting the given `INodeSymlink`.
    Specified by:
      `visitSymlink` in interface `NamespaceVisitor`

  - ### visitReference

    public void visitReference(INodeReference ref, int snapshot)
    Description copied from interface: `NamespaceVisitor`
    Visiting the given `INodeReference` (non-recursively).
    Specified by:
      `visitReference` in interface `NamespaceVisitor`

  - ### preVisitReferred

    public void preVisitReferred(INode referred)
    Description copied from interface: `NamespaceVisitor`
    Right before visiting the given referred `INode`.
    Specified by:
      `preVisitReferred` in interface `NamespaceVisitor`

  - ### postVisitReferred

    public void postVisitReferred(INode referred)
    Description copied from interface: `NamespaceVisitor`
    Right after visiting the given referred `INode`.
    Specified by:
      `postVisitReferred` in interface `NamespaceVisitor`

  - ### visitDirectory

    public void visitDirectory(INodeDirectory dir, int snapshot)
    Description copied from interface: `NamespaceVisitor`
    Visiting the given `INodeDirectory` (non-recursively).
    Specified by:
      `visitDirectory` in interface `NamespaceVisitor`

  - ### visitSnapshottable

    public void visitSnapshottable(INodeDirectory dir, DirectorySnapshottableFeature snapshottable)
    Description copied from interface: `NamespaceVisitor`
    Visiting a `DirectorySnapshottableFeature`.
    Specified by:
      `visitSnapshottable` in interface `NamespaceVisitor`

  - ### preVisitSub

    public void preVisitSub(NamespaceVisitor.Element sub, int index, boolean isLast)
    Description copied from interface: `NamespaceVisitor`
    Right before visiting the given sub `NamespaceVisitor.Element`. The sub element may be a child of an `INodeDirectory` or a snapshot in `DirectorySnapshottableFeature`.
    Specified by:
      `preVisitSub` in interface `NamespaceVisitor`
    Parameters:
      `sub` - the element to be visited.
      `index` - the index of the sub element.
      `isLast` - is the sub element the last element?

  - ### postVisitSub

    public void postVisitSub(NamespaceVisitor.Element sub, int index, boolean isLast)
    Description copied from interface: `NamespaceVisitor`
    Right after visiting the given sub `NamespaceVisitor.Element`. The sub element may be a child of an `INodeDirectory` or a snapshot in `DirectorySnapshottableFeature`.
    Specified by:
      `postVisitSub` in interface `NamespaceVisitor`
    Parameters:
      `sub` - the element just visited.
      `index` - the index of the sub element.
      `isLast` - is the sub element the last element?