Search in sources :

Example 1 with NFAStateSerializer

use of org.apache.flink.cep.nfa.NFAStateSerializer in project flink by apache.

the class CepOperator method initializeState.

@Override
public void initializeState(StateInitializationContext context) throws Exception {
    super.initializeState(context);
    // initializeState through the provided context
    computationStates = context.getKeyedStateStore().getState(new ValueStateDescriptor<>(NFA_STATE_NAME, new NFAStateSerializer()));
    partialMatches = new SharedBuffer<>(context.getKeyedStateStore(), inputSerializer, SharedBufferCacheConfig.of(getOperatorConfig().getConfiguration()));
    elementQueueState = context.getKeyedStateStore().getMapState(new MapStateDescriptor<>(EVENT_QUEUE_STATE_NAME, LongSerializer.INSTANCE, new ListSerializer<>(inputSerializer)));
    if (context.isRestored()) {
        partialMatches.migrateOldState(getKeyedStateBackend(), computationStates);
    }
}
Also used : ValueStateDescriptor(org.apache.flink.api.common.state.ValueStateDescriptor) MapStateDescriptor(org.apache.flink.api.common.state.MapStateDescriptor) NFAStateSerializer(org.apache.flink.cep.nfa.NFAStateSerializer)

Aggregations

MapStateDescriptor (org.apache.flink.api.common.state.MapStateDescriptor)1 ValueStateDescriptor (org.apache.flink.api.common.state.ValueStateDescriptor)1 NFAStateSerializer (org.apache.flink.cep.nfa.NFAStateSerializer)1