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 97a2b69  1. Split Address, Identifier to its own class. 2. Add 
GroomServer state. 3. Add BSP state. 4. Add keywords ensime and swp to 
.gitignore.
97a2b69 is described below

commit 97a2b6969bb5c2a5754ae365474ed154ff24723d
Author: Chiahung Lin <[email protected]>
AuthorDate: Sat May 11 18:14:38 2019 +0200

    1. Split Address, Identifier to its own class.
    2. Add GroomServer state.
    3. Add BSP state.
    4. Add keywords ensime and swp to .gitignore.
---
 .gitignore                                         |  2 +
 .../main/scala/org/apache/hama/bsp/package.scala   | 15 +++++++
 .../scala/org/apache/hama/membership/Address.scala | 31 +++++++++++++
 .../org/apache/hama/membership/BSPMaster.scala     | 25 -----------
 .../org/apache/hama/membership/GroomServer.scala   | 52 ++++++++++++++++++++++
 .../org/apache/hama/membership/Identifier.scala    | 37 +++++++++++++++
 6 files changed, 137 insertions(+), 25 deletions(-)

diff --git a/.gitignore b/.gitignore
index eb5a316..a537eac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 target
+.ensime*
+*.swp
diff --git a/bsp/src/main/scala/org/apache/hama/bsp/package.scala 
b/bsp/src/main/scala/org/apache/hama/bsp/package.scala
index e1ee846..32feaa6 100644
--- a/bsp/src/main/scala/org/apache/hama/bsp/package.scala
+++ b/bsp/src/main/scala/org/apache/hama/bsp/package.scala
@@ -58,5 +58,20 @@ package object bsp {
 
   }
 
+  object State {
+
+    case object LocalComputation extends State
+
+    trait BarrierSynchronization extends State
+
+    case object Begin extends BarrierSynchronization 
+
+    case object End extends BarrierSynchronization 
+
+    case object Communication extends State
+
+  }
+  sealed trait State extends Product with Serializable
+
 }
 
diff --git a/membership/src/main/scala/org/apache/hama/membership/Address.scala 
b/membership/src/main/scala/org/apache/hama/membership/Address.scala
new file mode 100644
index 0000000..a562b7e
--- /dev/null
+++ b/membership/src/main/scala/org/apache/hama/membership/Address.scala
@@ -0,0 +1,31 @@
+/**
+ * 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.hama.membership
+
+import cats.syntax._
+import cats.implicits._
+import org.apache.hama.util.Utils._
+
+object Address {
+
+  def create(host: String, port: Int): ValidatedResult[Address] = 
+    if(!host.isBlank && port.isValid) Address(host, port).validNel else
+    new RuntimeException(s"Invalid Addrss($host, $port) value!").invalidNel
+
+}
+final case class Address(host: String, port: Int) 
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 ea70d8c..059e6de 100644
--- a/membership/src/main/scala/org/apache/hama/membership/BSPMaster.scala
+++ b/membership/src/main/scala/org/apache/hama/membership/BSPMaster.scala
@@ -20,33 +20,8 @@ package org.apache.hama.membership
 import cats.data.{ State => CatsState, Reader }
 import cats.syntax._
 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 {
-
-  def create(host: String, port: Int): ValidatedResult[Address] = 
-    if(!host.isBlank && port.isValid) Address(host, port).validNel else
-    new RuntimeException(s"Invalid Addrss($host, $port) value!").invalidNel
-
-}
-final case class Address(host: String, port: Int) 
-
-object Identifier {
-
-  def create(host: String, port: Int): ValidatedResult[Identifier] = 
-    if(!host.isBlank && port.isValid) Identifier(hash(host, port)).validNel 
-    else new RuntimeException(s"Invalid Identifier hash values!").invalidNel
-
-  def hash(host: String, port: Int): String = 
-    Hashing.sipHash24().newHasher().putString(host, UTF_8).
-      putInt(port).hash.toString
-
-}
-final case class Identifier(value: String) 
 
 object BSPMaster {
 
diff --git 
a/membership/src/main/scala/org/apache/hama/membership/GroomServer.scala 
b/membership/src/main/scala/org/apache/hama/membership/GroomServer.scala
new file mode 100644
index 0000000..47d4465
--- /dev/null
+++ b/membership/src/main/scala/org/apache/hama/membership/GroomServer.scala
@@ -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
+ *
+ *     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.hama.membership
+
+import org.apache.hama.conf.Setting
+import org.apache.hama.fs.FileSystem
+
+object GroomServer {
+
+  object Event {
+    
+  }
+  trait Event extends Product with Serializable
+
+  object State {
+
+    /* Groom is stopped. */
+    case object Stopped extends State
+
+    /* Groom is running. */
+    case object Running extends State
+
+    /* Disk stale. */
+    case object Stale extends State
+
+    /* Can't connect to Master */
+    case object Denied extends State
+
+    case object ShuttingDown extends State
+
+  }
+  sealed trait State extends Product with Serializable
+
+}
+case class GroomServer (
+  address: Address, id: Identifier, role: Role, fs: FileSystem
+)
diff --git 
a/membership/src/main/scala/org/apache/hama/membership/Identifier.scala 
b/membership/src/main/scala/org/apache/hama/membership/Identifier.scala
new file mode 100644
index 0000000..f943701
--- /dev/null
+++ b/membership/src/main/scala/org/apache/hama/membership/Identifier.scala
@@ -0,0 +1,37 @@
+/**
+ * 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.hama.membership
+
+import cats.syntax._
+import cats.implicits._
+import com.google.common.hash.Hashing
+import com.google.common.base.Charsets._
+import org.apache.hama.util.Utils._
+
+object Identifier {
+
+  def create(host: String, port: Int): ValidatedResult[Identifier] = 
+    if(!host.isBlank && port.isValid) Identifier(hash(host, port)).validNel 
+    else new RuntimeException(s"Invalid Identifier hash values!").invalidNel
+
+  def hash(host: String, port: Int): String = 
+    Hashing.sipHash24().newHasher().putString(host, UTF_8).
+      putInt(port).hash.toString
+
+}
+final case class Identifier(value: String) 

Reply via email to