hlteoh37 commented on code in PR #49: URL: https://github.com/apache/flink-connector-aws/pull/49#discussion_r1193441538
########## flink-connector-aws-kinesis-streams/src/main/java/org/apache/flink/connector/kinesis/source/split/StartingPosition.java: ########## @@ -0,0 +1,94 @@ +/* + * 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; + +import software.amazon.awssdk.services.kinesis.model.ShardIteratorType; + +import javax.annotation.Nullable; + +import java.time.Instant; +import java.util.Objects; + +import static software.amazon.awssdk.services.kinesis.model.ShardIteratorType.AFTER_SEQUENCE_NUMBER; +import static software.amazon.awssdk.services.kinesis.model.ShardIteratorType.AT_TIMESTAMP; +import static software.amazon.awssdk.services.kinesis.model.ShardIteratorType.TRIM_HORIZON; + +/** Data class indicating the starting position for reading a given shard. */ +@Internal +public final class StartingPosition { + + private final ShardIteratorType shardIteratorType; + private final Object startingMarker; + + StartingPosition(ShardIteratorType shardIteratorType, Object startingMarker) { + this.shardIteratorType = shardIteratorType; + this.startingMarker = startingMarker; + } + + public ShardIteratorType getShardIteratorType() { + return shardIteratorType; + } + + @Nullable + public Object getStartingMarker() { + return startingMarker; + } + + public static StartingPosition fromTimestamp(final Instant timestamp) { + return new StartingPosition(AT_TIMESTAMP, timestamp); + } + + public static StartingPosition continueFromSequenceNumber(final String sequenceNumber) { Review Comment: My understanding was that `restartFromSequenceNumber` is only needed when we support aggregated records (then we need to read from `AT_SEQUENCE_NUMBER` rather than `AFTER_SEQUENCE_NUMBER`. So if we support KPL aggregation, we will need to support this. Does this match your understanding ? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
