markusthoemmes commented on a change in pull request #3196: Fixes #3195 - 
create config object for docker in the invoker and get ?
URL: 
https://github.com/apache/incubator-openwhisk/pull/3196#discussion_r163046122
 
 

 ##########
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainerFactory.scala
 ##########
 @@ -129,3 +135,15 @@ object DockerContainerFactoryProvider extends 
ContainerFactoryProvider {
                                    parameters: Map[String, Set[String]]): 
ContainerFactory =
     new DockerContainerFactory(config, instanceId, parameters)(actorSystem, 
actorSystem.dispatcher, logging)
 }
+
+case class DockerContainerFactoryConfig(dataroot: Option[String]) {
+  def containerPath: File =
+    Paths
+      .get({
+        if (dataroot.isEmpty)
+          "/containers"
+        else
+          dataroot.get + "/containers"
+      })
+      .toFile
 
 Review comment:
   Some Scala goodness: You can use `Option`s methods to transform this in a 
statically proven way.
   
   ```scala 
   val containerPath: File = Paths.get(dataRoot.getOrElse("") + "/containers")
   ```
   
   Also, I'd use a `val` since this is used quite often in production code and 
doesn't need to be recomputed.

----------------------------------------------------------------
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