elek commented on a change in pull request #2256:
URL: https://github.com/apache/ozone/pull/2256#discussion_r635100322



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/stream/DirectoryServerSource.java
##########
@@ -0,0 +1,52 @@
+/*
+ * 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.hadoop.ozone.container.stream;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Streaming files from single directory.
+ */
+public class DirectoryServerSource implements StreamingSource {
+
+  private Path root;
+
+  public DirectoryServerSource(Path root) {
+    this.root = root;
+  }
+
+  @Override

Review comment:
       > Can we add comment on what this "id" field signify?
   
   Sure, I added javadoc comment:
   
   ```
     /**
      * Return logicalNames and real file path to replicate.
      *
      * @param id name of the subdirectory to replitace relative to root.
      */
     public Map<String, Path> getFilesToStream(String id)
   ```
   
   In parent javadoc it's more generic:
   
   ```
     /**
      *
      * @param id: custom identifier
      *
      * @return map of files which should be copied (logical name -> real path)
      */
     Map<String, Path> getFilesToStream(String id) throws InterruptedException;
   ```
   
   > I think, it will be good to add "list of files" as a directory server 
source as well ?
   
   Can you please explain this in more details. I am not fully understand.
   
   The main interface here is the `StreamingSource` which can return a list of 
files + logical names for any logical identifier.
   
   This is a very simple implementation where the logical identifier is the 
subdir and all the files are replicated.
   
   For closed-container replication we need a source where the id is the 
container id and we will have logical names like `container.yaml`,...




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to