use of org.apache.flink.streaming.tests.verify.ValueWithTs in project flink by apache.
the class TtlVerifyUpdateFunction method initializeState.
@Override
public void initializeState(FunctionInitializationContext context) {
states = TtlStateVerifier.VERIFIERS.stream().collect(Collectors.toMap(TtlStateVerifier::getId, v -> v.createState(context, ttlConfig)));
prevUpdatesByVerifierId = TtlStateVerifier.VERIFIERS.stream().collect(Collectors.toMap(TtlStateVerifier::getId, v -> {
checkNotNull(v);
final TypeSerializer<ValueWithTs<?>> typeSerializer = new ValueWithTs.Serializer(v.getUpdateSerializer(), LongSerializer.INSTANCE);
ListStateDescriptor<ValueWithTs<?>> stateDesc = new ListStateDescriptor<>("TtlPrevValueState_" + v.getId(), typeSerializer);
KeyedStateStore store = context.getKeyedStateStore();
return store.getListState(stateDesc);
}));
}
Aggregations