org.apache.cassandra.db.commitlog

## Class CommitLogReader

- java.lang.Object
- - org.apache.cassandra.db.commitlog.CommitLogReader

-     public class CommitLogReader
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ALL_MUTATIONS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommitLogReader()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Set<java.util.Map.Entry<java.util.UUID,java.util.concurrent.atomic.AtomicInteger>>` | `getInvalidMutations()`
    `void` | `readAllFiles(CommitLogReadHandler handler, java.io.File[] files)` Reads all passed in files with no minimum, no start, and no mutation limit.
    `void` | `readAllFiles(CommitLogReadHandler handler, java.io.File[] files, CommitLogPosition minPosition)` Reads all passed in files with minPosition, no start, and no mutation limit.
    `void` | `readCommitLogSegment(CommitLogReadHandler handler, java.io.File file, boolean tolerateTruncation)` Reads passed in file fully
    `void` | `readCommitLogSegment(CommitLogReadHandler handler, java.io.File file, CommitLogPosition minPosition, int mutationLimit, boolean tolerateTruncation)` Reads mutations from file, handing them off to handler
    `void` | `readCommitLogSegment(CommitLogReadHandler handler, java.io.File file, int mutationLimit, boolean tolerateTruncation)` Reads passed in file fully, up to mutationLimit count
    `protected void` | `readMutation(CommitLogReadHandler handler, byte[] inputBuffer, int size, CommitLogPosition minPosition, int entryLocation, CommitLogDescriptor desc)` Deserializes and passes a Mutation to the ICommitLogReadHandler requested

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

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

- - ### Field Detail

    - #### ALL_MUTATIONS

          public static final int ALL_MUTATIONS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CommitLogReader

          public CommitLogReader()

  - ### Method Detail

    - #### getInvalidMutations

          public java.util.Set<java.util.Map.Entry<java.util.UUID,java.util.concurrent.atomic.AtomicInteger>> getInvalidMutations()

    - #### readAllFiles

          public void readAllFiles(CommitLogReadHandler handler,
                                   java.io.File[] files)
                            throws java.io.IOException

      Reads all passed in files with no minimum, no start, and no mutation limit.
      Throws:
        `java.io.IOException`

    - #### readAllFiles

          public void readAllFiles(CommitLogReadHandler handler,
                                   java.io.File[] files,
                                   CommitLogPosition minPosition)
                            throws java.io.IOException

      Reads all passed in files with minPosition, no start, and no mutation limit.
      Throws:
        `java.io.IOException`

    - #### readCommitLogSegment

          public void readCommitLogSegment(CommitLogReadHandler handler,
                                           java.io.File file,
                                           boolean tolerateTruncation)
                                    throws java.io.IOException

      Reads passed in file fully
      Throws:
        `java.io.IOException`

    - #### readCommitLogSegment

          public void readCommitLogSegment(CommitLogReadHandler handler,
                                           java.io.File file,
                                           int mutationLimit,
                                           boolean tolerateTruncation)
                                    throws java.io.IOException

      Reads passed in file fully, up to mutationLimit count
      Throws:
        `java.io.IOException`

    - #### readCommitLogSegment

          public void readCommitLogSegment(CommitLogReadHandler handler,
                                           java.io.File file,
                                           CommitLogPosition minPosition,
                                           int mutationLimit,
                                           boolean tolerateTruncation)
                                    throws java.io.IOException

      Reads mutations from file, handing them off to handler
      Parameters:
        `handler` - Handler that will take action based on deserialized Mutations
        `file` - CommitLogSegment file to read
        `minPosition` - Optional minimum CommitLogPosition - all segments with id > or matching w/greater position will be read
        `mutationLimit` - Optional limit on # of mutations to replay. Local ALL_MUTATIONS serves as marker to play all.
        `tolerateTruncation` - Whether or not we should allow truncation of this file or throw if EOF found
      Throws:
        `java.io.IOException`

    - #### readMutation

          protected void readMutation(CommitLogReadHandler handler,
                                      byte[] inputBuffer,
                                      int size,
                                      CommitLogPosition minPosition,
                                      int entryLocation,
                                      CommitLogDescriptor desc)
                               throws java.io.IOException

      Deserializes and passes a Mutation to the ICommitLogReadHandler requested
      Parameters:
        `handler` - Handler that will take action based on deserialized Mutations
        `inputBuffer` - raw byte array w/Mutation data
        `size` - deserialized size of mutation
        `minPosition` - We need to suppress replay of mutations that are before the required minPosition
        `entryLocation` - filePointer offset of mutation within CommitLogSegment
        `desc` - CommitLogDescriptor being worked on
      Throws:
        `java.io.IOException`

Copyright © 2018 The Apache Software Foundation