[ 
https://issues.apache.org/jira/browse/DRILL-7745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17177811#comment-17177811
 ] 

ASF GitHub Bot commented on DRILL-7745:
---------------------------------------

dbw9580 commented on a change in pull request #2084:
URL: https://github.com/apache/drill/pull/2084#discussion_r470676371



##########
File path: 
contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSScanSpec.java
##########
@@ -0,0 +1,217 @@
+/*
+ * 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.drill.exec.store.ipfs;
+
+
+import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import io.ipfs.multihash.Multihash;
+import org.apache.drill.common.PlanStringBuilder;
+import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.exec.store.StoragePluginRegistry;
+import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.security.InvalidParameterException;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+@JsonTypeName("IPFSScanSpec")
+public class IPFSScanSpec {
+  private static final Logger logger = 
LoggerFactory.getLogger(IPFSScanSpec.class);
+
+  public enum Prefix {
+    @JsonProperty("ipfs")
+    IPFS("ipfs"),
+    @JsonProperty("ipns")
+    IPNS("ipns");
+
+    @JsonProperty("prefix")
+    private final String name;
+    Prefix(String prefix) {
+      this.name = prefix;
+    }
+
+    @Override
+    public String toString() {
+      return this.name;
+    }
+
+    @JsonCreator
+    public static Prefix of(String what) {
+      switch (what) {
+        case "ipfs" :
+          return IPFS;
+        case "ipns":
+          return IPNS;
+        default:
+          throw new InvalidParameterException("Unsupported prefix: " + what);
+      }
+    }
+  }
+
+  public enum Format {
+    @JsonProperty("json")
+    JSON("json"),
+    @JsonProperty("csv")
+    CSV("csv");
+
+    @JsonProperty("format")
+    private final String name;
+    Format(String prefix) {
+      this.name = prefix;
+    }
+
+    @Override
+    public String toString() {
+      return this.name;
+    }
+
+    @JsonCreator
+    public static Format of(String what) {
+      switch (what) {
+        case "json" :
+          return JSON;
+        case "csv":
+          return CSV;
+        default:
+          throw new InvalidParameterException("Unsupported format: " + what);
+      }
+    }
+  }
+
+  public static Set<String> formats = ImmutableSet.of("json", "csv");
+  private Prefix prefix;
+  private String path;
+  private Format formatExtension;
+  private final IPFSContext ipfsContext;
+
+  @JsonCreator
+  public IPFSScanSpec (@JacksonInject StoragePluginRegistry registry,
+                       @JsonProperty("IPFSStoragePluginConfig") 
IPFSStoragePluginConfig ipfsStoragePluginConfig,
+                       @JsonProperty("prefix") Prefix prefix,
+                       @JsonProperty("format") Format format,
+                       @JsonProperty("path") String path) {
+    this.ipfsContext = registry.resolve(ipfsStoragePluginConfig, 
IPFSStoragePlugin.class).getIPFSContext();
+    this.prefix = prefix;
+    this.formatExtension = format;
+    this.path = path;
+  }
+
+  public IPFSScanSpec (IPFSContext ipfsContext, String path) {
+    this.ipfsContext = ipfsContext;
+    parsePath(path);
+  }
+
+  private void parsePath(String path) {
+    //FIXME: IPFS hashes are actually Base58 encoded, so "0" "O" "I" "l" are 
not valid

Review comment:
       Removed in d2ea637.




----------------------------------------------------------------
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:
us...@infra.apache.org


> Add storage plugin for IPFS
> ---------------------------
>
>                 Key: DRILL-7745
>                 URL: https://issues.apache.org/jira/browse/DRILL-7745
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Storage - Other
>    Affects Versions: 1.18.0
>            Reporter: Bowen Ding
>            Assignee: Bowen Ding
>            Priority: Major
>
> See introduction here: [https://github.com/bdchain/Minerva]
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to