curcur commented on a change in pull request #15200:
URL: https://github.com/apache/flink/pull/15200#discussion_r645304174



##########
File path: 
flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/KvStateChangeLoggerImpl.java
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.state.changelog;
+
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.core.memory.DataOutputViewStreamWrapper;
+import org.apache.flink.runtime.state.changelog.StateChangelogWriter;
+import org.apache.flink.runtime.state.heap.InternalKeyContext;
+
+import javax.annotation.concurrent.NotThreadSafe;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import static 
org.apache.flink.state.changelog.AbstractStateChangeLogger.StateChangeOperation.MERGE_NS;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+@NotThreadSafe
+class KvStateChangeLoggerImpl<Key, State, Ns> extends 
AbstractStateChangeLogger<Key, State, Ns>
+        implements KvStateChangeLogger<State, Ns> {
+
+    private final TypeSerializer<Ns> namespaceSerializer;
+    protected final TypeSerializer<Key> keySerializer;
+    private final TypeSerializer<State> valueSerializer;
+
+    KvStateChangeLoggerImpl(
+            TypeSerializer<Key> keySerializer,
+            TypeSerializer<Ns> namespaceSerializer,
+            TypeSerializer<State> valueSerializer,

Review comment:
       "AbstractStateChangeLogger<Key, State, Ns>" is confusing as well.
   
   Here the "State" not seems to be a state as well. In its two implementations 
of 
   
   ```
   protected abstract void serializeState(State state, 
DataOutputViewStreamWrapper out)
               throws IOException;
   ```
   
   One is a `valueSerializer` and the other is PtirotyQueue (time) serializer.
   
   Instead of calling it State, they are more like Changelog or Changelog Value 
instead;
   
   So for example, `stateAdded` --> `ChangelogAdded`
   
   What do you think?
   
   I would appreciate the concept of "State" to be consistent. That's very 
important to keep the code readable and maintainable.
   
   




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

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


Reply via email to