Zakelly commented on code in PR #24657:
URL: https://github.com/apache/flink/pull/24657#discussion_r1568147623


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/asyncprocessing/AsyncStateProcessingOperator.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.runtime.operators.asyncprocessing;
+
+import org.apache.flink.api.java.functions.KeySelector;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.util.function.ThrowingRunnable;
+
+/**
+ * A more detailed interface based on {@link AsyncStateProcessing}, which 
gives the essential
+ * methods for an operator to perform async state processing.
+ */
+public interface AsyncStateProcessingOperator extends AsyncStateProcessing {
+
+    /** Get the {@link ElementOrder} of this operator. */
+    ElementOrder getElementOrder();
+
+    /**
+     * Set key context for async state processing.
+     *
+     * @param record the record.
+     * @param keySelector the key selector to select a key from record.
+     * @param <T> the type of the record.
+     */
+    <T> void setAsyncKeyedContextElement(StreamRecord<T> record, 
KeySelector<T, ?> keySelector)
+            throws Exception;
+
+    /** A callback that will be triggered after an element finishes {@code 
processElement}. */
+    void postProcessElement();

Review Comment:
   `setAsyncKeyedContextElement` is borrowed from `setKeyContextElement`, given 
that the stream record and key selector should be passed in as parameters, the 
method is only for set context so I'd keep the name.
   
   The `postProcessElement` is designed to be a callback, which is more 
understandable in callers' perspective of view. For now it just release the 
context, but more might be added (watermark emit or something). I also want to 
introduce the `preProcessElement` but it seems unused currently. It will be 
introduced in need. 
   
   WDYT?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to