You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/08/01 23:02:45 UTC

[GitHub] tysonnorris commented on a change in pull request #2414: SPI approach for pluggable implementations

tysonnorris commented on a change in pull request #2414: SPI approach for pluggable implementations
URL: https://github.com/apache/incubator-openwhisk/pull/2414#discussion_r130750456
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala
 ##########
 @@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database
+
+import akka.actor.ActorSystem
+import spray.json.RootJsonFormat
+import whisk.common.Logging
+import whisk.core.WhiskConfig
+import whisk.spi.Spi
+import whisk.spi.SpiProvider
+
+/**
+ * An Spi for providing ArtifactStore implementations
+ */
+
+trait ArtifactStoreProvider extends Spi {
+    def makeStore[D <: DocumentSerializer](config: WhiskConfig, name: WhiskConfig => String)(
+        implicit jsonFormat: RootJsonFormat[D],
+        actorSystem: ActorSystem,
+        logging: Logging): ArtifactStore[D]
 
 Review comment:
   @rabbah @markusthoemmes I removed the dependency on scaldi. I chatted with Markus briefly and wanted tomention a couple things:
   - not using DI implies that the dependencies are pushed down a layer to the SPI method signatures, this is ok, but implies that all impls have the same args, which may or may not be ok; not pushing them down would work, but requires some more work to remove ServiceLoader usage, I'm not sure it is that important.
   - Markus suggested an alternative way to pass dependencies in a generic object - with the current impl, this would be an option to add as a signature on a specific SPI, but I haven't done that with the current example impls (MessagingProvider + ArtifactStoreProvider)
   - you can see from the current signature in MessagingProvider, it is leaking impl details, so would be a good candidate to move those kafka details (like maxPollInterval) into the SPI impl by way of config (or the dependencies object approach); I mostly left these signatures alone to keep them from drifting too far before this approach is adopted
   - I left some commented code in SpiTest to indicate how some things change removing scaldi, where instead of constructing objects as SPI impls, those now need to be built from some factory layer (which is ok, but if any of this sounds confusing, it might be worth a look)
 
----------------------------------------------------------------
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