drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [drill] dbw9580 commented on a change in pull request #2084: DRILL-7745: Add storage plugin for IPFS
Date Sun, 28 Jun 2020 15:39:55 GMT

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



##########
File path: contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSPeer.java
##########
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2018-2020 Bowen Ding, Yuedong Xu, Liang Wang
+ *
+ * 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 io.ipfs.multiaddr.MultiAddress;
+import io.ipfs.multihash.Multihash;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+public class IPFSPeer {
+  private IPFSHelper helper;
+
+  private Multihash id;
+  private List<MultiAddress> addrs;
+  private boolean isDrillReady;
+  private boolean isDrillReadyChecked = false;
+  private Optional<String> drillbitAddress = Optional.empty();
+  private boolean drillbitAddressChecked = false;
+
+
+  public IPFSPeer(IPFSHelper helper, Multihash id) {
+    this.helper = helper;
+    this.id = id;
+  }
+
+  IPFSPeer(IPFSHelper helper, Multihash id, List<MultiAddress> addrs) {
+    this.helper = helper;
+    this.id = id;
+    this.addrs = addrs;
+    this.isDrillReady = helper.isDrillReady(id);
+    this.isDrillReadyChecked = true;
+    this.drillbitAddress = IPFSHelper.pickPeerHost(addrs);
+    this.drillbitAddressChecked = true;
+  }
+
+  public boolean isDrillReady() {
+    if (!isDrillReadyChecked) {
+      isDrillReady = helper.isDrillReady(id);
+      isDrillReadyChecked = true;
+    }
+    return isDrillReady;
+  }
+
+  public boolean hasDrillbitAddress() {

Review comment:
       Changed in 160a909.




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



Mime
View raw message