API Docs for: 0.8.0
Show:

ServerRegistration Class

Service that provides the ability for the process/node to register itself so that other nodes in the system can find it. In addition, it helps with the health monitoring of the system.

Constructor

ServerRegistration

()

Item Index

Methods

Properties

Methods

addItem

(
  • name
  • The
)
Boolean static

Registers a function to be called on every status update. The function should take one parameter: a callback function that accepts two parameters, the first being an error if it occurred and the second being the current value for the information requested.

Parameters:

  • name String

    The name and/or description of the information being gathered

  • The Function

    function to be called to gather the data.

Returns:

Boolean:

TRUE if the function is successfully registered, FALSE if not.

doRegistration

(
  • [cb] A callback that provides two parameters: cb(Error, [RESULT]
)
static

Performs the request for information and persists it through the storage provider.

Parameters:

  • [cb] A callback that provides two parameters: cb(Error, [RESULT] Function optional

    )

flush

(
  • cb
)
static

Removes all entries from the server registry

Parameters:

  • cb Function

    A callback that provides two parameters: cb(Error, [RESULT])

generateKey

() String static

Generates the unique key for the PB process/node.

Returns:

String:

The unique identifier

generateServerKey

() String static

Retrieves a unique key for the server but not for the process

Returns:

String:

server key

getClusterStatus

(
  • cb
)

Retrieves the most recent status from the entire cluster.

Parameters:

  • cb Function

    A callback that provides two parameters: cb(Error, Array)

getInstance

(
  • [provider]
)
ServerRegistration static

Retrieves the singleton instance of the service registry

Parameters:

  • [provider] RegistrationProvider optional

Returns:

getIp

() String static

Retrieves the first IP address found for the node.

Returns:

String:

The first IP address found for the node

init

(
  • cb
)
static

Should only be called once at startup. The function verifies that the registry is enabled and initializes the correct storage provider.

Parameters:

  • cb Function

    A callback that provides two parameters: cb(Error, [RESULT])

logUpdateResult

(
  • key
  • update
  • err
  • result
)
static

Parameters:

  • key String
  • update Object
  • err Error
  • result Boolean

shutdown

(
  • cb
)
static

Called during shutdown. The function is responsible for clearing any scheduled updates and shutting down the storage provider.

Parameters:

  • cb Function

    A callback that provides two parameters: cb(Error, [RESULT])

Properties

INSTANCE

ServerRegistration private static

Singleton instance

ITEM_CALLBACKS

Object private

The default set of functions that gather the default set of information.