Class: ClusterNode

Clusterluck.ClusterNode(kernel, gossip)

ClusterNode ClusterNode

Constructor

new ClusterNode(kernel, gossip)

Cluster wrapper class. Used to start/load/stop the cluster, both network kernel and gossip ring.

Parameters:
Name Type Description
kernel Clusterluck.NetKernel

Network kernel to use to communicate with other nodes.

gossip Clusterluck.GossipRing

Gossip ring to use to route messages to across a cluster.

Source:

Methods

commandServer(commandServeropt) → {Clusterluck.CommandServer}

Acts as a getter/setter for the command handler of this instance.

Parameters:
Name Type Attributes Description
commandServer Clusterluck.CommandServer <optional>

Command handler to set on this instance.

Source:
Returns:

Command handler of this instance.

Type
Clusterluck.CommandServer

gossip(gossipopt) → {Clusterluck.GossipRing}

Acts as a getter/setter for the gossip ring of this instance.

Parameters:
Name Type Attributes Description
gossip Clusterluck.GossipRing <optional>

Gossip ring to set on this instance.

Source:
Returns:

Gossip ring of this instance.

Type
Clusterluck.GossipRing

load(cb)

Loads gossip state from disk and establishes all node connections derived from
the newly loaded hash ring.

Parameters:
Name Type Description
cb function

Function to call once state has been loaded.

Source:

start(cookie, ringID, cbopt, optsopt) → {Clusterluck.ClusterNode}

Starts a network kernel and gossip ring on this node.

Parameters:
Name Type Attributes Description
cookie String

Distributed cookie to use when communicating with other nodes and signing payloads.

ringID String

Ring ID to start gossip ring on.

cb function <optional>

Optional callback; called when network kernel has been fully started and listening for IPC messages.

opts Object <optional>

Network kernel options.

Properties
Name Type Attributes Description
tokenGenInterval Number <optional>

Interval in which to generate a new reply token for synchronous cluster calls. Defaults to 1 hour.

Source:
Returns:

This instance.

Type
Clusterluck.ClusterNode

stop(forceopt) → {Clusterluck.ClusterNode}

Stops the gossip ring and network kernel, as well as closing all network connections with any external nodes.

Parameters:
Name Type Attributes Description
force Boolean <optional>

Whether to forcibly stop this node or not.

Source:
Fires:
Listens to Events:
  • Clusterluck.CommandServer#CommandServer:stop
  • Clusterluck.GossipRing#GossipRing:stop
Returns:

This instance.

Type
Clusterluck.ClusterNode

Events

ClusterNode:ready

Emitted when the command line server, gossip ring server, and network kernel have all started and are ready to start processing messages.

Source:

ClusterNode:stop

Emitted when the command line server, gossip ring server, and network kernel have all stopped processing messages.

Source: