bdoyle0182 commented on a change in pull request #4986:
URL: https://github.com/apache/openwhisk/pull/4986#discussion_r506724480
##########
File path:
common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala
##########
@@ -346,6 +358,91 @@ case class ExecutableWhiskActionMetaData(namespace:
EntityPath,
}
+case class WhiskActionVersion(id: String, namespace: EntityPath, name:
EntityName, version: SemVer, publish: Boolean)
+
+object WhiskActionVersion {
+ val serdes = jsonFormat(WhiskActionVersion.apply, "_id", "namespace",
"name", "version", "publish")
+}
+
+case class WhiskActionVersionList(namespace: EntityPath, name: EntityName,
versions: Map[SemVer, String]) {
+ def matchedDocId(version: Option[SemVer]): Option[DocId] = {
+ version match {
+ case Some(ver) =>
+ versions.get(ver).map(DocId(_))
+ case None if versions.nonEmpty =>
+ Some(DocId(versions.maxBy(_._1)._2))
+ case _ =>
+ None
+ }
+ }
+}
+
+object WhiskActionVersionList extends
MultipleReadersSingleWriterCache[WhiskActionVersionList, DocInfo] {
+ lazy val viewName = WhiskQueries.entitiesView(collection =
"action-versions").name
Review comment:
nit: should use a constant for `"action-versions"`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]