masteryhx commented on code in PR #24651:
URL: https://github.com/apache/flink/pull/24651#discussion_r1562071643


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/v2/internal/InternalKvState.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.runtime.state.v2.internal;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.state.v2.State;
+import org.apache.flink.api.common.state.v2.StateFuture;
+import org.apache.flink.runtime.asyncprocessing.AsyncExecutionController;
+import org.apache.flink.runtime.asyncprocessing.StateRequestType;
+
+/**
+ * The {@code InternalKvState} is the root of the internal state type 
hierarchy, similar to the
+ * {@link State} being the root of the public API state hierarchy.
+ *
+ * <p>The public API state hierarchy is intended to be programmed against by 
Flink applications. The
+ * internal state hierarchy holds all the auxiliary methods that communicates 
with {@link
+ * AsyncExecutionController} and not intended to be used by user applications.
+ *
+ * @param <K> The type of key the state is associated to.
+ * @param <V> The type of values kept internally in state.
+ */
+@Internal
+public abstract class InternalKvState<K, V> implements State {
+
+    private final AsyncExecutionController<?, K> asyncExecutionController;
+
+    private final StateDescriptor<V> stateDescriptor;
+
+    /**
+     * Creates a new InternalKvState with the given asyncExecutionController 
and stateDescriptor.
+     */
+    public InternalKvState(
+            AsyncExecutionController<?, K> asyncExecutionController,
+            StateDescriptor<V> stateDescriptor) {
+        this.asyncExecutionController = asyncExecutionController;
+        this.stateDescriptor = stateDescriptor;
+    }
+
+    /**
+     * Submit a state request to AEC.
+     *
+     * @param stateRequestType the type of this request.
+     * @param payload the payload input for this request.
+     * @return the state future.
+     */
+    protected <IN, OUT> StateFuture<OUT> handleRequest(
+            StateRequestType stateRequestType, IN payload) {
+        return asyncExecutionController.handleRequest(this, stateRequestType, 
payload);
+    }
+
+    /** Return specific {@code StateDescriptor}. */
+    public StateDescriptor<V> getStateDescriptor() {
+        return stateDescriptor;
+    }
+}

Review Comment:
   I have added a method of value serializer and related test.



-- 
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