Class OffsetRestrictionTracker.OffsetRange

    • Field Detail

      • partition

        @Nullable
        private final Partition partition
      • position

        @Nullable
        private final Position position
      • startOffset

        @Nullable
        private final Offset startOffset
      • startInclusive

        private final boolean startInclusive
      • bounded

        private final boolean bounded
      • totalLimit

        private final long totalLimit
      • consumed

        private long consumed
      • endOffsetInclusive

        @Nullable
        private Offset endOffsetInclusive
      • extensible

        private boolean extensible
      • finished

        private transient boolean finished
    • Constructor Detail

      • OffsetRange

        private OffsetRange​(Partition partition,
                            Position position,
                            long totalLimit,
                            boolean bounded)
      • OffsetRange

        private OffsetRange​(@Nullable
                            Offset start,
                            long totalLimit,
                            boolean bounded,
                            long consumed,
                            boolean inclusive)
      • OffsetRange

        private OffsetRange​(long limit,
                            boolean bounded)
      • OffsetRange

        private OffsetRange​(Offset startExclusive,
                            long totalLimit,
                            boolean bounded,
                            long consumed)
      • OffsetRange

        public OffsetRange​(Offset startOffsetExclusive,
                           Offset endOffsetInclusive,
                           long totalLimit,
                           boolean bounded,
                           long consumed)
    • Method Detail

      • initialRestriction

        public static OffsetRestrictionTracker.OffsetRange initialRestriction​(long limit,
                                                                              boolean bounded)
        Parameters:
        limit - total limit to read
        bounded - true if this is bounded restriction
        Returns:
        initial restriction for DoFn.GetInitialRestriction.*
      • claim

        boolean claim​(@Nonnull
                      Offset offset)
      • getPartition

        public Partition getPartition()
      • isLimitConsumed

        public boolean isLimitConsumed()
      • asResidual

        public OffsetRestrictionTracker.OffsetRange asResidual()
        Returns:
        residual of not-yet processed work Note that, at all times the primary + residual should be equivalent to the original (unsplit) range.
      • isInitial

        public boolean isInitial()
      • terminate

        void terminate()
      • isSplittable

        public boolean isSplittable()
        Verify that we can split this restriction. A restriction is not splittable if it has not been yet started - i.e. no offset has been claimed.
      • isFinished

        public boolean isFinished()
        Verify that we have processed the whole restriction.
        Returns:
        true if watermark has arrived to final instant
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object