Class TriggerManager
java.lang.Object
org.apache.flink.api.common.functions.AbstractRichFunction
org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean,TableChange,Trigger>
  
org.apache.iceberg.flink.maintenance.operator.TriggerManager
- All Implemented Interfaces:
- Serializable,- org.apache.flink.api.common.functions.Function,- org.apache.flink.api.common.functions.RichFunction,- org.apache.flink.streaming.api.checkpoint.CheckpointedFunction
@Internal
public class TriggerManager
extends org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean,TableChange,Trigger>
implements org.apache.flink.streaming.api.checkpoint.CheckpointedFunction  
TriggerManager starts the Maintenance Tasks by emitting 
Trigger messages which are
 calculated based on the incoming TableChange messages. The TriggerManager keeps track of
 the changes since the last run of the Maintenance Tasks and triggers a new run based on the
 result of the TriggerEvaluator.
 The TriggerManager prevents overlapping Maintenance Task runs using TriggerLockFactory.Lock. The current implementation only handles conflicts within a single job.
 Users should avoid scheduling maintenance for the same table in different Flink jobs.
 
The TriggerManager should run as a global operator. KeyedProcessFunction is used, so
 the timer functions are available, but the key is not used.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.flink.streaming.api.functions.KeyedProcessFunctionorg.apache.flink.streaming.api.functions.KeyedProcessFunction.Context, org.apache.flink.streaming.api.functions.KeyedProcessFunction.OnTimerContext
- 
Constructor SummaryConstructorsConstructorDescriptionTriggerManager(TableLoader tableLoader, TriggerLockFactory lockFactory, List<String> maintenanceTaskNames, List<TriggerEvaluator> evaluators, long minFireDelayMs, long lockCheckDelayMs) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()voidinitializeState(org.apache.flink.runtime.state.FunctionInitializationContext context) voidonTimer(long timestamp, org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean, TableChange, Trigger>.org.apache.flink.streaming.api.functions.KeyedProcessFunction.OnTimerContext ctx, org.apache.flink.util.Collector<Trigger> out) voidopen(org.apache.flink.api.common.functions.OpenContext parameters) voidprocessElement(TableChange change, org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean, TableChange, Trigger>.org.apache.flink.streaming.api.functions.KeyedProcessFunction.Context ctx, org.apache.flink.util.Collector<Trigger> out) voidsnapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext context) Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunctiongetIterationRuntimeContext, getRuntimeContext, setRuntimeContext
- 
Constructor Details- 
TriggerManagerpublic TriggerManager(TableLoader tableLoader, TriggerLockFactory lockFactory, List<String> maintenanceTaskNames, List<TriggerEvaluator> evaluators, long minFireDelayMs, long lockCheckDelayMs) 
 
- 
- 
Method Details- 
open- Specified by:
- openin interface- org.apache.flink.api.common.functions.RichFunction
- Overrides:
- openin class- org.apache.flink.api.common.functions.AbstractRichFunction
- Throws:
- Exception
 
- 
snapshotStatepublic void snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext context) throws Exception - Specified by:
- snapshotStatein interface- org.apache.flink.streaming.api.checkpoint.CheckpointedFunction
- Throws:
- Exception
 
- 
initializeStatepublic void initializeState(org.apache.flink.runtime.state.FunctionInitializationContext context) throws Exception - Specified by:
- initializeStatein interface- org.apache.flink.streaming.api.checkpoint.CheckpointedFunction
- Throws:
- Exception
 
- 
processElementpublic void processElement(TableChange change, org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean, TableChange, throws ExceptionTrigger>.org.apache.flink.streaming.api.functions.KeyedProcessFunction.Context ctx, org.apache.flink.util.Collector<Trigger> out) - Specified by:
- processElementin class- org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean,- TableChange, - Trigger> 
- Throws:
- Exception
 
- 
onTimerpublic void onTimer(long timestamp, org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean, TableChange, throws ExceptionTrigger>.org.apache.flink.streaming.api.functions.KeyedProcessFunction.OnTimerContext ctx, org.apache.flink.util.Collector<Trigger> out) - Overrides:
- onTimerin class- org.apache.flink.streaming.api.functions.KeyedProcessFunction<Boolean,- TableChange, - Trigger> 
- Throws:
- Exception
 
- 
close- Specified by:
- closein interface- org.apache.flink.api.common.functions.RichFunction
- Overrides:
- closein class- org.apache.flink.api.common.functions.AbstractRichFunction
- Throws:
- IOException
 
 
-