Class CountingSource

java.lang.Object
org.apache.beam.sdk.io.CountingSource

public class CountingSource extends Object
Most users should use GenerateSequence instead.

A source that produces longs. When used as a BoundedSource, CountingSource starts at 0 and counts up to a specified maximum. When used as an UnboundedSource, it counts up to Long.MAX_VALUE and then never produces more output. (In practice, this limit should never be reached.)

The bounded CountingSource is implemented based on OffsetBasedSource and OffsetBasedSource.OffsetBasedReader, so it performs efficient initial splitting and it supports dynamic work rebalancing.

To produce a bounded source, use createSourceForSubrange(long, long). To produce an unbounded source, use createUnboundedFrom(long).