Class CheckpointedPosition

java.lang.Object
org.apache.flink.connector.file.src.util.CheckpointedPosition
All Implemented Interfaces:
Serializable

@PublicEvolving public final class CheckpointedPosition extends Object implements Serializable
The position of a reader, to be stored in a checkpoint. The position consists of a record offset and a number of records to skip after that offset. The offset is optional, it may take the value NO_OFFSET, in which case only the records-to-skip count is used.

The combination of offset and records-to-skip makes it possible to represent the position of a wide variety of readers. In the simplest case, readers might store no offset and only store how many records they previously returned. On the other hand, readers that can precisely point to each record via a position can store that in the checkpoint. Readers that have occasional addressable positions (like sync markers, block starts, etc.) can store those together with the records skipped after the last marker.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Constant for the offset, reflecting that the position does not contain any offset information.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CheckpointedPosition(long offset, long recordsAfterOffset)
    Creates a new CheckpointedPosition for given offset and records-to-skip.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
    Gets the offset that the reader will seek to when restored from this checkpoint.
    long
    Gets the records to skip after the offset.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NO_OFFSET

      public static final long NO_OFFSET
      Constant for the offset, reflecting that the position does not contain any offset information. It is used in positions that are defined only by a number of records to skip.
      See Also:
  • Constructor Details

    • CheckpointedPosition

      public CheckpointedPosition(long offset, long recordsAfterOffset)
      Creates a new CheckpointedPosition for given offset and records-to-skip.
      Parameters:
      offset - The offset that the reader will seek to when restored from this checkpoint.
      recordsAfterOffset - The records to skip after the offset.
  • Method Details

    • getOffset

      public long getOffset()
      Gets the offset that the reader will seek to when restored from this checkpoint.
    • getRecordsAfterOffset

      public long getRecordsAfterOffset()
      Gets the records to skip after the offset.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object