Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CouchbaseConnection

Couchbase connection using plain couchbase driver.

This is the most basic persistence component that is only able to store data items of any type. Specific CRUD operations over the data items must be implemented in child classes by accessing this._collection or this._model properties.

Configuration parameters

  • bucket: (optional) Couchbase bucket name
  • connection(s):
    • discovery_key: (optional) a key to retrieve the connection from IDiscovery
    • host: host name or IP address
    • port: port number (default: 27017)
    • uri: resource URI or connection string with all parameters in it
  • credential(s):
    • store_key: (optional) a key to retrieve the credentials from ICredentialStore
    • username: (optional) user name
    • password: (optional) user password
  • options:
    • auto_create: (optional) automatically create missing bucket (default: false)
    • auto_index: (optional) automatically create primary index (default: false)
    • flush_enabled: (optional) bucket flush enabled (default: false)
    • bucket_type: (optional) bucket type (default: couchbase)
    • ram_quota: (optional) RAM quota in MB (default: 100)

References

  • *:logger:*:*:1.0 (optional) ILogger components to pass log messages
  • *:discovery:*:*:1.0 (optional) IDiscovery services
  • *:credential-store:*:*:1.0 (optional) Credential stores to resolve credentials

Hierarchy

  • CouchbaseConnection

Implements

  • any
  • any
  • any

Index

Constructors

constructor

  • Creates a new instance of the connection component.

    Parameters

    • Optional bucketName: string

      the name of couchbase bucket

    Returns CouchbaseConnection

Properties

Protected _bucket

_bucket: any

The Couchbase bucket object.

Protected _bucketName

_bucketName: string

The Couchbase bucket name.

Protected _connection

_connection: any

The Couchbase cluster connection object.

Protected _connectionResolver

_connectionResolver: CouchbaseConnectionResolver = new CouchbaseConnectionResolver()

The connection resolver.

Protected _logger

_logger: CompositeLogger = new CompositeLogger()

The logger.

Protected _options

_options: ConfigParams = new ConfigParams()

The configuration options.

Methods

close

  • close(correlationId: string, callback?: function): void
  • Closes component and frees used resources.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • Optional callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

configure

  • configure(config: ConfigParams): void
  • Configures component by passing configuration parameters.

    Parameters

    • config: ConfigParams

      configuration parameters to be set.

    Returns void

getBucket

  • getBucket(): any
  • Returns any

getBucketName

  • getBucketName(): string
  • Returns string

getConnection

  • getConnection(): any
  • Returns any

isOpen

  • isOpen(): boolean
  • Checks if the component is opened.

    Returns boolean

    true if the component has been opened and false otherwise.

open

  • open(correlationId: string, callback?: function): void
  • Opens the component.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • Optional callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

setReferences

  • setReferences(references: IReferences): void
  • Sets references to dependent components.

    Parameters

    • references: IReferences

      references to locate the component dependencies.

    Returns void

Generated using TypeDoc