Package cz.o2.proxima.beam.direct.io
Class OffsetRestrictionTracker.OffsetRange
- java.lang.Object
-
- cz.o2.proxima.beam.direct.io.OffsetRestrictionTracker.OffsetRange
-
- All Implemented Interfaces:
java.io.Serializable,org.apache.beam.sdk.transforms.splittabledofn.HasDefaultTracker<OffsetRestrictionTracker.OffsetRange,OffsetRestrictionTracker>
- Enclosing class:
- OffsetRestrictionTracker
public static class OffsetRestrictionTracker.OffsetRange extends java.lang.Object implements java.io.Serializable, org.apache.beam.sdk.transforms.splittabledofn.HasDefaultTracker<OffsetRestrictionTracker.OffsetRange,OffsetRestrictionTracker>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanboundedprivate longconsumedprivate OffsetendOffsetInclusiveprivate booleanextensibleprivate booleanfinishedprivate Partitionpartitionprivate Positionpositionprivate static longserialVersionUIDprivate booleanstartInclusiveprivate OffsetstartOffsetprivate longtotalLimit
-
Constructor Summary
Constructors Modifier Constructor Description privateOffsetRange(long limit, boolean bounded)privateOffsetRange(Offset startExclusive, long totalLimit, boolean bounded, long consumed)privateOffsetRange(Offset start, long totalLimit, boolean bounded, long consumed, boolean inclusive)OffsetRange(Offset startOffsetExclusive, Offset endOffsetInclusive, long totalLimit, boolean bounded, long consumed)privateOffsetRange(Partition partition, Position position, long totalLimit, boolean bounded)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OffsetRestrictionTracker.OffsetRangeasPrimary()OffsetRestrictionTracker.OffsetRangeasResidual()(package private) booleanclaim(Offset offset)booleanequals(java.lang.Object o)PartitiongetPartition()inthashCode()static OffsetRestrictionTracker.OffsetRangeinitialRestriction(long limit, boolean bounded)booleanisFinished()Verify that we have processed the whole restriction.booleanisInitial()booleanisLimitConsumed()booleanisSplittable()Verify that we can split this restriction.OffsetRestrictionTrackernewTracker()static OffsetRestrictionTracker.OffsetRangestartingFrom(Partition partition, Position position, OffsetRestrictionTracker.OffsetRange initialRestriction)(package private) voidterminate()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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)
-
-
Method Detail
-
initialRestriction
public static OffsetRestrictionTracker.OffsetRange initialRestriction(long limit, boolean bounded)
- Parameters:
limit- total limit to readbounded-trueif this is bounded restriction- Returns:
- initial restriction for
DoFn.GetInitialRestriction.*
-
startingFrom
public static OffsetRestrictionTracker.OffsetRange startingFrom(Partition partition, Position position, OffsetRestrictionTracker.OffsetRange initialRestriction)
- Returns:
- restriction that reads from given offset (inclusive)
-
claim
boolean claim(@Nonnull Offset offset)
-
getPartition
public Partition getPartition()
-
isLimitConsumed
public boolean isLimitConsumed()
-
asPrimary
public OffsetRestrictionTracker.OffsetRange asPrimary()
- Returns:
- unmodifiable already processed split of the restriction
-
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()
-
newTracker
public OffsetRestrictionTracker newTracker()
- Specified by:
newTrackerin interfaceorg.apache.beam.sdk.transforms.splittabledofn.HasDefaultTracker<OffsetRestrictionTracker.OffsetRange,OffsetRestrictionTracker>
-
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:
trueif watermark has arrived to final instant
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-