tysonnorris commented on a change in pull request #2584: SPI for Loadbalancer
URL: 
https://github.com/apache/incubator-openwhisk/pull/2584#discussion_r132444130
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
 ##########
 @@ -77,16 +82,32 @@ trait LoadBalancer {
      */
     def publish(action: ExecutableWhiskAction, msg: 
ActivationMessage)(implicit transid: TransactionId): 
Future[Future[Either[ActivationId, WhiskActivation]]]
 
+    /**
+     * Return a message indicating the health of the containers and/or 
container pool in general
+     * @return a Future[String] representing the heal response that will be 
sent to the client
+     */
+    def getHealthResponse: Future[JsObject]
+}
+
+class LoadBalancerServiceProvider extends LoadBalancerProvider {
+    override def getLoadBalancer(config: WhiskConfig, instance: InstanceId)
+            (implicit logging: Logging, actorSystem: ActorSystem): 
LoadBalancer = new LoadBalancerService(config, instance)
+}
+
+object LoadBalancerServiceProvider extends SpiFactory[LoadBalancerProvider]{
+    override def apply(dependencies: Dependencies): LoadBalancerProvider = new 
LoadBalancerServiceProvider
 }
 
 class LoadBalancerService(
     config: WhiskConfig,
-    instance: InstanceId,
-    entityStore: EntityStore)(
+    instance: InstanceId)(
         implicit val actorSystem: ActorSystem,
         logging: Logging)
     extends LoadBalancer {
 
+    /** Used to manage an action for testing invoker health */
+    val entityStore =  WhiskEntityStore.datastore(config)
 
 Review comment:
   It is not generating a new one, but acquiring a reference to the singleton 
EntityStore. The reference from LoadBalancerServer -> EntityStore is an impl 
detail (used to create the health action) that doesn't have anything to do with 
the LoadBalancer interface. To pass as Dependencies, the `SpiLoader.get` call 
in Controller would need to "know" this impl detail. 
    
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to