You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/09/14 02:32:03 UTC

[GitHub] ddragosd commented on a change in pull request #2531: Share bookkeeping data across controllers

ddragosd commented on a change in pull request #2531: Share bookkeeping data across controllers
URL: https://github.com/apache/incubator-openwhisk/pull/2531#discussion_r138784709
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/loadBalancer/SharedDataService.scala
 ##########
 @@ -0,0 +1,122 @@
+/*
+ * 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 whisk.core.loadBalancer
+
+import akka.actor.{Actor, ActorLogging, ActorRef, Props}
+import akka.cluster.Cluster
+import akka.cluster.ClusterEvent.{InitialStateAsEvents, MemberEvent, MemberRemoved, MemberUp, UnreachableMember}
+import akka.cluster.ddata.{DistributedData, PNCounterMap, PNCounterMapKey}
+import akka.cluster.ddata.Replicator._
+import whisk.common.AkkaLogging
+import whisk.core.WhiskConfig
+import com.typesafe.config.{Config, ConfigFactory}
+
+case class IncreaseCounter(key: String, value: Long)
+case class DecreaseCounter(key: String, value: Long)
+case class ReadCounter(key: String)
+case class RemoveCounter(key: String)
+case object GetMap
+
+/**
+ * Companion object to specify actor properties from the outside, e.g. name of the shared map
+ */
+object SharedDataService {
+  val requiredProperties = Map(WhiskConfig.controllerSeedNodes -> null)
+
+  def props(storageName: String): Props = Props(new SharedDataService(storageName))
+
+  /**
+   * Add seed nodes if cluster provider is specified, otherwhise return the existing config.
+   * Parse akka seed nodes this way until either of these 2 issues is resolved:
+   * https://github.com/akka/akka/issues/23600
+   * https://github.com/typesafehub/config/issues/69
+   * @return Updated Config
+   */
+  def addAkkaSeedNodesToConf(whiskConf: WhiskConfig): Config = {
+    val conf = ConfigFactory.load()
+
+    val cluster = conf.getString("akka.actor.provider")
+
+    if (cluster == "cluster") {
+      val seedNodes = whiskConf.controllerSeedNodes
 
 Review comment:
   ?  We know Mesos and Kube are in the picture and it's not a big stretch to provide support to automatically discover seed nodes using the APIs they provide. Mesos could come later as 1 PR and so does Kube, but it would be good to design the code with this in mind.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services