@FunctionalInterface
public static interface GrowableOffsetRangeTracker.RangeEndEstimator
estimate()
is called to give the end offset when GrowableOffsetRangeTracker.trySplit(double)
or GrowableOffsetRangeTracker.getProgress()
is invoked. The end offset is exclusive for the range. The estimated end is not
required to monotonically increase as it will only be taken into consideration when the
estimated end offset is larger than the current position. Returning Long.MAX_VALUE
as
the estimate implies the largest possible position for the range is Long.MAX_VALUE - 1
.
Return Long.MIN_VALUE
if an estimate can not be provided.
Providing a good estimate is important for an accurate progress signal and will impact splitting decisions by the runner.
If estimate()
is expensive to compute, consider wrapping the implementation with
Suppliers.memoizeWithExpiration(org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Supplier<T>, long, java.util.concurrent.TimeUnit)
or equivalent as an optimization.
TODO(BEAM-10032): Also consider using GrowableOffsetRangeTracker.RangeEndEstimator
when the range is not ended
with Long.MAX_VALUE
.
Modifier and Type | Method and Description |
---|---|
long |
estimate() |