You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/01/22 19:39:55 UTC

[GitHub] markusthoemmes commented on a change in pull request #3196: Fixes #3195 - create config object for docker in the invoker and get ?

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:
users@infra.apache.org


With regards,
Apache Git Services