dgrove-oss commented on a change in pull request #2689: first stage of support 
for dynamic invoker id assignment
URL: 
https://github.com/apache/incubator-openwhisk/pull/2689#discussion_r140779465
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/loadBalancer/InvokerSupervision.scala
 ##########
 @@ -347,3 +350,77 @@ object InvokerActor {
 
   val timerName = "testActionTimer"
 }
+
+/*
+ * Actor to handle invoker registration
+ */
+class Registrar(sendIdToInvoker: (InvokerIdResponseMessage) => 
Future[RecordMetadata],
+                registerConsumer: MessageConsumer,
+                redisClient: RedisClient)
+    extends Actor {
+
+  implicit val transid = TransactionId.registrar
+  implicit val logging = new AkkaLogging(context.system.log)
+  implicit val timeout = Timeout(5.seconds)
+  implicit val ec = context.dispatcher
+
+  def receive = {
+    case m: InvokerIdRequestMessage => {
+      val assignedId =
+        if (m.proposedId != -1) {
+          // static id assignment prototcol -- always accept proposedId
+          logging.info(this, s"invoker with name ${m.instanceName} was 
assigned its proposedId ${m.proposedId}")
+          m.proposedId
+        } else {
+          // dynamic id assignment protocol
+          val priorId = redisClient.hget("controller:registar:idAssignments", 
m.instanceName)
 
 Review comment:
   Good point.  When I changed things to externalize the state to Redis I could 
have eliminated the Actor.  I'll do that.
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to