Class StatisticsEditsVisitor

java.lang.Object
org.apache.hadoop.hdfs.tools.offlineEditsViewer.StatisticsEditsVisitor
All Implemented Interfaces:
OfflineEditsVisitor

@Private @Unstable public class StatisticsEditsVisitor extends Object implements OfflineEditsVisitor
StatisticsEditsVisitor implements text version of EditsVisitor that aggregates counts of op codes processed
  • Constructor Details

    • StatisticsEditsVisitor

      public StatisticsEditsVisitor(OutputStream out) throws IOException
      Create a processor that writes to the file named and may or may not also output to the screen, as specified.
      Parameters:
      out - Name of file to write output to
      Throws:
      IOException
  • Method Details

    • start

      public void start(int version) throws IOException
      Start the visitor
      Specified by:
      start in interface OfflineEditsVisitor
      Parameters:
      version - Edit log version
      Throws:
      IOException
    • close

      public void close(Throwable error) throws IOException
      Close the visitor
      Specified by:
      close in interface OfflineEditsVisitor
      Parameters:
      error - If the visitor was closed because of an unrecoverable error in the input stream, this is the exception.
      Throws:
      IOException
    • visitOp

      public void visitOp(FSEditLogOp op) throws IOException
      Description copied from interface: OfflineEditsVisitor
      Begin visiting an element that encloses another element, such as the beginning of the list of blocks that comprise a file.
      Specified by:
      visitOp in interface OfflineEditsVisitor
      Parameters:
      op - Token being visited
      Throws:
      IOException
    • getStatistics

      public Map<FSEditLogOpCodes,Long> getStatistics()
      Get statistics
      Returns:
      statistics, map of counts per opCode
    • getStatisticsString

      public String getStatisticsString()
      Get the statistics in string format, suitable for printing
      Returns:
      statistics in in string format, suitable for printing