markusthoemmes commented on a change in pull request #2584: SPI for Loadbalancer URL: https://github.com/apache/incubator-openwhisk/pull/2584#discussion_r132406663
########## 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: What's the rationale for generating a new one (and deduplicate via the SPI) vs. passing it through the `Dependencies` object? (Not necessarily arguing against this, just curiosity) ---------------------------------------------------------------- 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