couchbase

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

Kubemq Couchbase Target Connector

Kubemq couchbase target connector allows services using kubemq server to access couchbase database services.

Prerequisites

The following are required to run the couchbase target connector:

  • kubemq cluster
  • couchbase server
  • kubemq-targets deployment

Configuration

Couchbase target connector configuration properties:

Properties Key Required Description Example
url yes couchbase host address "localhost"
username no couchbase username "couchdb"
password no couchbase password "couchdb"
bucket no set bucket name "bucket"
num_to_replicate no set replication number "1"
num_to_persist no set persistence number "1"
collection no set collection name "collection"

Example:

bindings:
  - name: kubemq-query-couchbase
    source:
      kind: kubemq.query
      name: kubemq-query
      properties:
        address: "kubemq-cluster:50000"
        client_id: "kubemq-query-couchbase-connector"
        auth_token: ""
        channel: "query.couchbase"
        group:   ""
        concurrency: "1"
        auto_reconnect: "true"
        reconnect_interval_seconds: "1"
        max_reconnects: "0"
    target:
      kind: stores.couchbase
      name: target-couchbase
      properties:
        url: "localhost"
        username: "couchbase"
        password: "couchbase"
        bucket: "bucket"
        collection: "test"
        num_to_replicate: "1"
        num_to_persist: "1"

Usage

Get Request

Get request metadata setting:

Metadata Key Required Description Possible values
key yes couchbase key string any string
method yes get "get"

Example:

{
  "metadata": {
    "key": "your-couchbase-key",
    "method": "get"
  },
  "data": null
}
Set Request

Set request metadata setting:

Metadata Key Required Description Possible values
key yes couchbase key string any string
method yes set "set"
cas no set cas value "0"
expiry_seconds no set key expiry in seconds "3600"

Set request data setting:

Data Key Required Description Possible values
data yes data to set for the couchbase key base64 bytes array

Example:

{
  "metadata": {
    "key": "your-couchbase-key",
    "method": "set",
    "cas": "0",
    "expiry_seconds": "3600"
  },
  "data": "c29tZS1kYXRh" 
}
Delete Request

Delete request metadata setting:

Metadata Key Required Description Possible values
key yes couchbase key string any string
method yes set "delete"
cas no set cas value "0"

Example:

{
  "metadata": {
    "key": "your-couchbase-key",
    "method": "delete",
    "cas": "0"
  },
  "data": null
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connector

func Connector() *common.Connector

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New() *Client

func (*Client) Connector

func (c *Client) Connector() *common.Connector

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, meta metadata) (*types.Response, error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *types.Request) (*types.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, meta metadata) (*types.Response, error)

func (*Client) Init

func (c *Client) Init(ctx context.Context, cfg config.Spec, log *logger.Logger) error

func (*Client) Set

func (c *Client) Set(ctx context.Context, meta metadata, data []byte) (*types.Response, error)

func (*Client) Stop

func (c *Client) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL