org.apache.hadoop.hdfs.server.namenode

## Class FSEditLogOp.Reader

- java.lang.Object
- - org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.Reader

- Enclosing class:
    org.apache.hadoop.hdfs.server.namenode.FSEditLogOp

      public abstract static class FSEditLogOp.Reader
      extends Object

  Class for reading editlog ops from a stream

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static FSEditLogOp.Reader` | `create(DataInputStream in, org.apache.hadoop.hdfs.server.namenode.StreamLimiter limiter, int logVersion)`
    `abstract org.apache.hadoop.hdfs.server.namenode.FSEditLogOp` | `decodeOp()` Read an opcode from the input stream.
    `org.apache.hadoop.hdfs.server.namenode.FSEditLogOp` | `readOp(boolean skipBrokenEdits)` Read an operation from the input stream.
    `abstract long` | `scanOp()` Similar to decodeOp(), but we only retrieve the transaction ID of the Op rather than reading it.
    `void` | `setMaxOpSize(int maxOpSize)`

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

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

- - ### Method Detail

    - #### create

          public static FSEditLogOp.Reader create(DataInputStream in,
                                                  org.apache.hadoop.hdfs.server.namenode.StreamLimiter limiter,
                                                  int logVersion)

    - #### setMaxOpSize

          public void setMaxOpSize(int maxOpSize)

    - #### readOp

          public org.apache.hadoop.hdfs.server.namenode.FSEditLogOp readOp(boolean skipBrokenEdits)
                                                                    throws IOException

      Read an operation from the input stream. Note that the objects returned from this method may be re-used by future calls to the same method.
      Parameters:
        `skipBrokenEdits` - If true, attempt to skip over damaged parts of the input stream, rather than throwing an IOException
      Returns:
        the operation read from the stream, or null at the end of the file
      Throws:
        `IOException` - on error. This function should only throw an exception when skipBrokenEdits is false.

    - #### decodeOp

          public abstract org.apache.hadoop.hdfs.server.namenode.FSEditLogOp decodeOp()
                                                                               throws IOException

      Read an opcode from the input stream.
      Returns:
        the opcode, or null on EOF. If an exception is thrown, the stream's mark will be set to the first problematic byte. This usually means the beginning of the opcode.
      Throws:
        `IOException`

    - #### scanOp

          public abstract long scanOp()
                               throws IOException

      Similar to decodeOp(), but we only retrieve the transaction ID of the Op rather than reading it. If the edit log format supports length prefixing, this can be much faster than full decoding.
      Returns:
        the last txid of the segment, or INVALID_TXID on EOF.
      Throws:
        `IOException`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.