Module: caf_components/gen_plug

Generic plug component.

A plug is an object that provides an interface to an external or local service.

The plug-in architecture in CAF has three components:

  1. A plug instance that is shared by all the local CAs, implemented by extending gen_plug (this file) and, for example, pools connections to an external service. A plug internal state is ephemeral.

  2. A plug_ca instance for each CA, implemented by extending gen_plug_ca. It maintains CA-specific state that is managed transactionally (see module:caf_components/gen_transactional), and checkpointed with a external service.

  3. A proxy instance for each CA, implemented by extending gen_proxy. Proxies are stateless, frozen objects, that help security by reducing the attack surface.

Application code can only interact with services by using proxies. A plug_ca instance also acts as the root component for the proxy, further limiting access to the hierarchy of components from user code.

Source:

Extends

Members

__ca_isPlug__ :boolean

Run-time type information.

Type:
  • boolean
Source:

Methods

(static) constructor($, spec) → {Object}

Helper constructor method for a plug component.

Description of types in file types.js.

Parameters:
Name Type Description
$ ctxType

A context containing references to other components.

spec specType

Configuration data for this component.

Source:
Throws:

If inputs are invalid.

Type
Error
Returns:

A new generic component.

Type
Object