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

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

# Class FSEditLogOp.Reader

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

Enclosing class:
  FSEditLogOp

public abstract static class FSEditLogOp.Reader extends Object
Class for reading editlog ops from a stream

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static FSEditLogOp.Reader`
  `create(DataInputStream in, org.apache.hadoop.hdfs.server.namenode.StreamLimiter limiter, int logVersion)`
  `abstract FSEditLogOp`
  `decodeOp()`
  Read an opcode from the input stream.
  `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 Details

  - ### 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 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 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`