Github user mjsax commented on a diff in the pull request:
https://github.com/apache/flink/pull/1617#discussion_r52468705
--- Diff:
flink-contrib/flink-statebackend-redis/src/main/java/org/apache/flink/contrib/streaming/state/RedisListState.java
---
@@ -0,0 +1,167 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.contrib.streaming.state;
+
+import org.apache.flink.api.common.state.ListState;
+import org.apache.flink.api.common.state.ListStateDescriptor;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.core.memory.DataInputViewStreamWrapper;
+import org.apache.flink.core.memory.DataOutputViewStreamWrapper;
+import org.apache.flink.runtime.state.AbstractStateBackend;
+import org.apache.flink.runtime.state.KvState;
+import org.apache.flink.runtime.state.KvStateSnapshot;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static java.util.Objects.requireNonNull;
+
+/**
+ * {@link ListState} implementation that stores state in Redis.
+ *
+ * @param <K> The type of the key.
+ * @param <N> The type of the namespace.
+ * @param <V> The type of the values in the list state.
+ * @param <Backend> The type of the backend that snapshots this key/value
state.
+ */
+public class RedisListState<K, N, V, Backend extends AbstractStateBackend>
+ extends AbstractRedisState<K, N, ListState<V>, ListStateDescriptor<V>,
Backend>
+ implements ListState<V> {
+
+ /** The path on the local system where Redis executable file can be
found. */
+ private final String redisExecPath;
+
+ /** The port to start Redis server */
+ private final int port;
+
+ /** Serializer for the values */
+ private final TypeSerializer<V> valueSerializer;
+
+ /** This holds the name of the state and can create an initial default
value for the state. */
+ protected final ListStateDescriptor<V> stateDesc;
+
+ /**
+ * Creates a new {@code RedisListState}.
+ *
+ * @param redisExecPath The path on the local system where Redis
executable file can be found.
+ * @param port The port to start Redis server
+ * @param keySerializer The serializer for the keys.
+ * @param namespaceSerializer The serializer for the namespace.
+ * @param stateDesc The state identifier for the state. This contains
name
+ * and can create a default state value.
+ * @param dbPath The path on the local system where Redis data should
be stored.
+ */
+ protected RedisListState(String redisExecPath, int port,
TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer,
ListStateDescriptor<V> stateDesc, File dbPath, String backupPath) {
+ super(redisExecPath, port, keySerializer, namespaceSerializer,
dbPath, backupPath);
+ this.redisExecPath = redisExecPath;
--- End diff --
Parameter checks missing
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---