Interface Offset

  • All Superinterfaces:
    java.io.Serializable
    All Known Implementing Classes:
    Offset.SimpleOffset

    public interface Offset
    extends java.io.Serializable
    Offset representing a "pointer" to an element within a batch partition.
    • Method Detail

      • of

        static Offset.SimpleOffset of​(Partition partition,
                                      long elementIndex,
                                      boolean last)
        Construct an immutable offset from given values.
        Parameters:
        partition - Batch partition.
        elementIndex - Index of element within the partition.
        last - Flag whether offset is representing the last element in the partition.
        Returns:
        Offset.
      • getPartition

        Partition getPartition()
        Partition the offset belongs to.
        Returns:
        Partition.
      • getElementIndex

        long getElementIndex()
        Index of the element within the partition. Elements are indexed from zero. Value of `-1` means, no element has been consumed from the partition.
        Returns:
        Index of the element or `-1` if no element has been consumed.
      • isLast

        boolean isLast()
        Is there any other element in the partition?
        Returns:
        True if there are no more elements in the partition.