hlteoh37 commented on code in PR #49:
URL: 
https://github.com/apache/flink-connector-aws/pull/49#discussion_r1193439564


##########
flink-connector-aws-kinesis-streams/src/main/java/org/apache/flink/connector/kinesis/source/split/KinesisShardSplitState.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.connector.kinesis.source.split;
+
+import org.apache.flink.annotation.Internal;
+
+/**
+ * Stores the metadata around a given {@link KinesisShardSplit}. This class is 
stored in state, and
+ * any changes should be backwards compatible.
+ */
+@Internal
+public class KinesisShardSplitState {
+    private final KinesisShardSplit kinesisShardSplit;
+    private StartingPosition nextStartingPosition;
+    private String nextShardIterator;
+
+    public KinesisShardSplitState(KinesisShardSplit kinesisShardSplit) {
+        this.kinesisShardSplit = kinesisShardSplit;
+        this.nextStartingPosition = kinesisShardSplit.getStartingPosition();
+    }
+
+    public KinesisShardSplit getKinesisShardSplit() {
+        return new KinesisShardSplit(
+                kinesisShardSplit.getStreamArn(),
+                kinesisShardSplit.getShardId(),
+                nextStartingPosition);
+    }
+
+    public String splitId() {
+        return kinesisShardSplit.splitId();
+    }
+
+    public String getStreamArn() {
+        return kinesisShardSplit.getStreamArn();
+    }
+
+    public String getShardId() {
+        return kinesisShardSplit.getShardId();
+    }
+
+    public StartingPosition getNextStartingPosition() {
+        return nextStartingPosition;
+    }
+
+    public void setNextStartingPosition(StartingPosition nextStartingPosition) 
{

Review Comment:
   Good question, but yes, this class needs to be mutable because of the manner 
it's used in the `SourceReaderBase`. On assignment of split, it will be 
created, but on `snapshotState`, the state will be retrieved and we will save 
the `KinesisShardSplit` object returned into a savepoint. 
   
   Because the reference of the `KinesisShardSplitState` is never updated in 
the `SourceReaderBase`, we need to make this mutable.



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