zentol commented on code in PR #1:
URL: 
https://github.com/apache/flink-connector-mongodb/pull/1#discussion_r1097291736


##########
flink-connector-mongodb/src/main/java/org/apache/flink/connector/mongodb/source/enumerator/assigner/MongoScanSplitAssigner.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.mongodb.source.enumerator.assigner;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.connector.mongodb.common.config.MongoConnectionOptions;
+import org.apache.flink.connector.mongodb.source.config.MongoReadOptions;
+import 
org.apache.flink.connector.mongodb.source.enumerator.MongoSourceEnumState;
+import 
org.apache.flink.connector.mongodb.source.enumerator.splitter.MongoSplitters;
+import org.apache.flink.connector.mongodb.source.split.MongoScanSourceSplit;
+import org.apache.flink.connector.mongodb.source.split.MongoSourceSplit;
+
+import com.mongodb.MongoNamespace;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/** The split assigner for {@link MongoScanSourceSplit}. */
+@Internal
+public class MongoScanSplitAssigner implements MongoSplitAssigner {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(MongoScanSplitAssigner.class);
+
+    private final MongoConnectionOptions connectionOptions;
+    private final MongoReadOptions readOptions;
+
+    private final LinkedList<String> remainingCollections;
+    private final List<String> alreadyProcessedCollections;
+    private final List<MongoScanSourceSplit> remainingScanSplits;
+    private final Map<String, MongoScanSourceSplit> assignedScanSplits;
+    private boolean initialized;
+
+    private transient MongoSplitters mongoSplitters;
+
+    public MongoScanSplitAssigner(
+            MongoConnectionOptions connectionOptions,
+            MongoReadOptions readOptions,
+            MongoSourceEnumState sourceEnumState) {
+        this.connectionOptions = connectionOptions;
+        this.readOptions = readOptions;
+        this.remainingCollections = new 
LinkedList<>(sourceEnumState.getRemainingCollections());

Review Comment:
   >  Do we need to explicitly declare it as a Queue?
   
   No; my main point is that we use 2 different types of lists although we want 
similar semantics.
   
   Basically: Why is `remainingScanSplits` not also a LinkedList?



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