Introduction

This is meant to introduce versioning management for user's actions, which add `@0.0.x` to the doc id of action, so that one action can have multiple versions exist in the same time.

Users can specify which version he or she want to get/invoke/delete, and also set the default version for actions.

The related PR is: https://github.com/apache/openwhisk/pull/4986


Changes

Database Change

A new design doc is added: `whisks.v2.1.0/action-versions`, with code

action-versions
function (doc) {
  var isAction = function (doc) { return (doc.exec !== undefined) };
  if (isAction(doc)) try {
    var value = {
      _id: doc.namespace + "/" + doc.name + "/default",
      namespace: doc.namespace,
      name: doc.name,
      version: doc.version
    };
    emit([doc.namespace + "/" + doc.name], value);
  } catch (e) {}
}

With this design doc, openwhisk can get the version list and default version for an action, like:

WhiskActionVersionList
case class WhiskActionVersionList(namespace: EntityPath,
                                  name: EntityName,
                                  versions: List[SemVer],
                                  defaultVersion: Option[SemVer])

Code Change

There are some changes for action's create/get/invoke/delete:

  • Create


      

  • Get


  • Invoke(After get action successful, it will pass the doc id to the ActivationMessage, so invoker doesn't need to care about the version, just fetch action using doc id)


  • Delete


  • No labels