public class TimestampRangeTracker extends RestrictionTracker<TimestampRange,com.google.cloud.Timestamp> implements RestrictionTracker.HasProgress
RestrictionTracker for claiming positions in a TimestampRange in a
 monotonically increasing fashion.
 The smallest position is Timestamp.MIN_VALUE and the largest position is Timestamp.MAX_VALUE - 1 nanosecond.
RestrictionTracker.HasProgress, RestrictionTracker.IsBounded, RestrictionTracker.Progress, RestrictionTracker.TruncateResult<RestrictionT>| Modifier and Type | Field and Description | 
|---|---|
| protected @Nullable com.google.cloud.Timestamp | lastAttemptedPosition | 
| protected @Nullable com.google.cloud.Timestamp | lastClaimedPosition | 
| protected TimestampRange | range | 
| protected java.util.function.Supplier<com.google.cloud.Timestamp> | timeSupplier | 
| Constructor and Description | 
|---|
| TimestampRangeTracker(TimestampRange range) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | checkDone()Checks if the restriction has been processed successfully. | 
| TimestampRange | currentRestriction()Returns a restriction accurately describing the full range of work the current  DoFn.ProcessElementcall will do, including already completed work. | 
| RestrictionTracker.Progress | getProgress()Returns the progress made within the restriction so far. | 
| RestrictionTracker.IsBounded | isBounded()Return the boundedness of the current restriction. | 
| void | setTimeSupplier(java.util.function.Supplier<com.google.cloud.Timestamp> timeSupplier) | 
| boolean | tryClaim(com.google.cloud.Timestamp position)Attempts to claim the given position. | 
| @Nullable SplitResult<TimestampRange> | trySplit(double fractionOfRemainder)Splits the restriction through the following algorithm: | 
protected TimestampRange range
protected @Nullable com.google.cloud.Timestamp lastAttemptedPosition
protected @Nullable com.google.cloud.Timestamp lastClaimedPosition
protected java.util.function.Supplier<com.google.cloud.Timestamp> timeSupplier
public TimestampRangeTracker(TimestampRange range)
public void setTimeSupplier(java.util.function.Supplier<com.google.cloud.Timestamp> timeSupplier)
public boolean tryClaim(com.google.cloud.Timestamp position)
IllegalArgumentException will be thrown
   IllegalArgumentException will be thrown
   lastAttemptedPosition.tryClaim in class RestrictionTracker<TimestampRange,com.google.cloud.Timestamp>true if the position was successfully claimed, false otherwisepublic @Nullable SplitResult<TimestampRange> trySplit(double fractionOfRemainder)
    currentPosition = lastAttemptedPosition == null ? (from - 1ns) : lastAttemptedPosition
    splitPosition = currentPosition + max(1, (range.to - currentPosition) * fractionOfRemainder)
    primary = [range.from, splitPosition)
    residual = [splitPosition, range.to)
    this.range = primary
 
 If the splitPosition is greater than the range.to, null will be
 returned. For checkpoints the fractionOfRemainder will always be zero.trySplit in class RestrictionTracker<TimestampRange,com.google.cloud.Timestamp>fractionOfRemainder - A hint as to the fraction of work the primary restriction should
     represent based upon the current known remaining amount of work.SplitResult if a split was possible or null if the splitPosition is beyond the end of the range.public void checkDone()
               throws java.lang.IllegalStateException
IllegalStateException.
 The restriction is considered processed successfully if:
range.from == range.to)
   lastAttemptedPosition + 1ns >= range.to
 lastAttemptedPosition + 1ns < range.to
 checkDone in class RestrictionTracker<TimestampRange,com.google.cloud.Timestamp>java.lang.IllegalStateExceptionpublic RestrictionTracker.Progress getProgress()
getProgress in interface RestrictionTracker.HasProgresspublic TimestampRange currentRestriction()
RestrictionTrackerDoFn.ProcessElement call will do, including already completed work.
 The current restriction returned by method may be updated dynamically due to due to
 concurrent invocation of other methods of the RestrictionTracker, For example, RestrictionTracker.trySplit(double).
 
This method is required to be implemented.
currentRestriction in class RestrictionTracker<TimestampRange,com.google.cloud.Timestamp>public RestrictionTracker.IsBounded isBounded()
RestrictionTrackerRestrictionTracker.IsBounded.BOUNDED. Otherwise, it should return
 RestrictionTracker.IsBounded.UNBOUNDED.
 It is valid to return RestrictionTracker.IsBounded.BOUNDED after returning RestrictionTracker.IsBounded.UNBOUNDED
 once the end of a restriction is discovered. It is not valid to return RestrictionTracker.IsBounded.UNBOUNDED after returning RestrictionTracker.IsBounded.BOUNDED.
 
This method is required to be implemented.
isBounded in class RestrictionTracker<TimestampRange,com.google.cloud.Timestamp>