public class ReadChangeStreamPartitionRangeTracker extends TimestampRangeTracker
TimestampRangeTracker. It has a different logic for tryClaim and trySplit methods. It ignores claims for the same timestamp multiple times. This is because several change stream records might have the same timestamp, thus leading to multiple claims of the same
Timestamp. Other than that, it always denies splits for the
InitialPartition.PARTITION_TOKEN, since we only need to perform this query once.
|Constructor and Description|
Receives the partition that will be queried and the timestamp range that belongs to it.
|Modifier and Type||Method and Description|
Attempts to claim the given position.
If the partition token is the
checkDone, currentRestriction, getProgress, isBounded, setTimeSupplier
public ReadChangeStreamPartitionRangeTracker(PartitionMetadata partition, TimestampRange range)
partition- the partition that will use the tracker
range- closed / open range interval for the start / end times of the given partition
public boolean tryClaim(com.google.cloud.Timestamp position)
Must be equal or larger than the last successfully claimed position.
public @Nullable SplitResult<TimestampRange> trySplit(double fractionOfRemainder)
InitialPartition.PARTITION_TOKEN, it does not allow for splits (returns null).
If a split is successful (non-null), then the restriction is updated to the result of the primary.
fractionOfRemainder- A hint as to the fraction of work the primary restriction should represent based upon the current known remaining amount of work.
SplitResultif a split was possible or
splitPositionis beyond the end of the range.