You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ch...@apache.org on 2019/03/17 22:44:51 UTC

[hama] branch componentization updated: Add FileSystem to BSPMaster.

This is an automated email from the ASF dual-hosted git repository.

chl501 pushed a commit to branch componentization
in repository https://gitbox.apache.org/repos/asf/hama.git


The following commit(s) were added to refs/heads/componentization by this push:
     new d9f658a  Add FileSystem to BSPMaster.
d9f658a is described below

commit d9f658a0f0c4ed1f730954c4952b3d266be5058f
Author: Chiahung Lin <ch...@apache.org>
AuthorDate: Sun Mar 17 23:41:45 2019 +0100

    Add FileSystem to BSPMaster.
---
 commons.v2/src/main/scala/org/apache/hama/fs/FileSystem.scala     | 4 ++++
 .../src/main/scala/org/apache/hama/membership/BSPMaster.scala     | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/commons.v2/src/main/scala/org/apache/hama/fs/FileSystem.scala b/commons.v2/src/main/scala/org/apache/hama/fs/FileSystem.scala
index cae2503..a8371fd 100644
--- a/commons.v2/src/main/scala/org/apache/hama/fs/FileSystem.scala
+++ b/commons.v2/src/main/scala/org/apache/hama/fs/FileSystem.scala
@@ -35,6 +35,8 @@ trait FileSystem {
 
   def exist(path: Path): Boolean 
 
+  def isLocal: Boolean
+
 }
 
 object FileSystem {
@@ -58,6 +60,8 @@ object FileSystem {
 
     override def exist(path: Path): Boolean = path.toFile.exists
 
+    override def isLocal: Boolean = true
+
   }
 
 }
diff --git a/membership/src/main/scala/org/apache/hama/membership/BSPMaster.scala b/membership/src/main/scala/org/apache/hama/membership/BSPMaster.scala
index 778ae21..ea70d8c 100644
--- a/membership/src/main/scala/org/apache/hama/membership/BSPMaster.scala
+++ b/membership/src/main/scala/org/apache/hama/membership/BSPMaster.scala
@@ -23,6 +23,7 @@ import cats.implicits._
 import com.google.common.hash.Hashing
 import com.google.common.base.Charsets._
 import org.apache.hama.conf.Setting
+import org.apache.hama.fs.FileSystem
 import org.apache.hama.util.Utils._
 
 object Address {
@@ -175,8 +176,11 @@ object BSPMaster {
     val port = setting.get("org.apache.hama.net.port", -1)
     (Address.create(host, port),
     Identifier.create(host, port),
-    Master.validNel).mapN(BSPMaster.apply)
+    Master.validNel,
+    FileSystem.local.validNel).mapN(BSPMaster.apply)
   }
 
 }
-final case class BSPMaster (address: Address, id: Identifier, role: Role)
+final case class BSPMaster (
+  address: Address, id: Identifier, role: Role, fs: FileSystem
+)