W - BoundedWindow subclass used to represent the windows used.T - TimeTrigger subclass produced by modifying the current TimeTrigger.@Experimental(value=TRIGGER) public abstract class TimeTrigger<W extends BoundedWindow,T extends TimeTrigger<W,T>> extends Trigger.OnceTrigger<W>
Trigger.OnceTrigger<W extends BoundedWindow>, Trigger.OnElementEvent<W>, Trigger.OnMergeEvent<W>, Trigger.OnTimerEvent<W extends BoundedWindow>, Trigger.TimeDomain, Trigger.TriggerContext<W extends BoundedWindow>, Trigger.TriggerId<W extends BoundedWindow>, Trigger.TriggerResult, Trigger.WindowStatus| Modifier and Type | Field and Description |
|---|---|
protected static com.google.common.collect.ImmutableList<SerializableFunction<Instant,Instant>> |
IDENTITY |
| Modifier | Constructor and Description |
|---|---|
protected |
TimeTrigger(com.google.common.collect.ImmutableList<SerializableFunction<Instant,Instant>> timestampMappers) |
| Modifier and Type | Method and Description |
|---|---|
T |
alignedTo(Duration size)
Aligns the time to be the smallest multiple of
size greater than the timestamp
since the epoch. |
T |
alignedTo(Duration size,
Instant offset)
Aligns timestamps to the smallest multiple of
size since the offset greater
than the timestamp. |
protected Instant |
computeTargetTimestamp(Instant time) |
boolean |
isCompatible(Trigger<?> other)
Returns whether this performs the same triggering as the given
Trigger. |
T |
mappedTo(SerializableFunction<Instant,Instant> timestampMapper)
Adjust the time at which the trigger will fire.
|
protected abstract T |
newWith(com.google.common.collect.ImmutableList<SerializableFunction<Instant,Instant>> transform)
Method to create an updated version of this
TimeTrigger modified to use the specified
transform. |
T |
plusDelayOf(Duration delay)
Adds some delay to the original target time.
|
clear, getWatermarkCutoff, onElement, onMerge, onTimer, orFinally, willNeverFinishprotected static final com.google.common.collect.ImmutableList<SerializableFunction<Instant,Instant>> IDENTITY
protected TimeTrigger(com.google.common.collect.ImmutableList<SerializableFunction<Instant,Instant>> timestampMappers)
public T plusDelayOf(Duration delay)
delay - the delay to addpublic T alignedTo(Duration size, Instant offset)
size since the offset greater
than the timestamp.
TODO: Consider sharing this with FixedWindows, and bring over the equivalent of CalendarWindows.
public T alignedTo(Duration size)
size greater than the timestamp
since the epoch.public T mappedTo(SerializableFunction<Instant,Instant> timestampMapper)
The timestampMapper function must have the following properties for all values
a and b:
a = b then timestampMapper(a) = timestampMapper(b)
a < b then timestampMapper(a) <= timestampMapper(b)
timestampMapper - Function that will be invoked on the proposed trigger time to determine
the time at which the trigger should actually fire.public boolean isCompatible(Trigger<?> other)
TriggerTrigger.isCompatible in class Trigger<W extends BoundedWindow>protected abstract T newWith(com.google.common.collect.ImmutableList<SerializableFunction<Instant,Instant>> transform)
TimeTrigger modified to use the specified
transform.transform - The new transform to apply to target times.TimeTrigger.