Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-51061

Support for function_scope for eventing lifecycle operations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 7.1.0
    • None
    • tools
    • None
    • Untriaged
    • 1
    • No
    • Tools 2022-Feb

    Description

      Eventing started supporting same name under different function scope. With this all the life cycle operation needs to include "bucket" and "scope" name in uri(by default its value is * for backward compatibility)

      Rest api:
      /api/v1/functions/<function name>/<lifecycle operation>?bucket=<function_scope.bucket>&scope=<function_scope.scope>

      Example:
      /api/v1/functions/test/deploy?bucket=b1&scope=s1

      Example schema: https://github.com/couchbase/eventing/blob/master/parser/handler_schema.json

      status api will include "function_scope" value to differentiate between different name

      curl -X GET -u Administrator:password http://localhost:9300/api/v1/status
      {
       "apps": [
        {
         "composite_status": "undeployed",
         "name": "test",
         "function_scope": {
          "bucket": "src_bucket",
          "scope": "_default"
         },
         "num_bootstrapping_nodes": 0,
         "num_deployed_nodes": 0,
         "deployment_status": false,
         "processing_status": false,
         "redeploy_required": false
        }
       ],
       "num_eventing_nodes": 1
      }%  
      

      Export also contains "function_scope" field to differentiate between different scope.

      curl -X GET -u Administrator:password http://localhost:9300/api/v1/export
      [
       {
        "appcode": "function OnUpdate(doc, meta) {\n    log(\"Doc created/updated\", meta.id);\n}\n\nfunction OnDelete(meta, options) {\n    log(\"Doc deleted/expired\", meta.id);\n}",
        "depcfg": {
         "source_bucket": "dst_bucket",
         "source_scope": "_default",
         "source_collection": "_default",
         "metadata_bucket": "metadata",
         "metadata_scope": "_default",
         "metadata_collection": "_default"
        },
        "version": "evt-7.1.0-0000-ee",
        "enforce_schema": false,
        "handleruuid": 154221883,
        "function_instance_id": "xgRSH",
        "appname": "test",
        "settings": {
         "dcp_stream_boundary": "everything",
         "deployment_status": false,
         "description": "",
         "execution_timeout": 60,
         "language_compatibility": "6.6.2",
         "log_level": "INFO",
         "n1ql_consistency": "none",
         "num_timer_partitions": 128,
         "processing_status": false,
         "timer_context_size": 1024,
         "user_prefix": "eventing",
         "worker_count": 1
        },
        "function_scope": {
         "bucket": "src_bucket",
         "scope": "_default"
        }
       }
      ]% 
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              sujay.gad Sujay Gad
              ankit.prabhu Ankit Prabhu
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty