Reference Source
public class | source

Node

Extends:

devapt-core-common/dist/js/base/distributed_instance~DistributedInstanceNodeMessaging → Node

Node class: node is an item of a topology and manages a set of servers.

Constructor Summary

Public Constructor
public

constructor(arg_name: string, arg_settings: object, arg_log_context: string): nothing

Create a Node instance.

Member Summary

Public Members
public
public

features: *[]

public

Class type flag.

public
public
public
public
public
public

msg_bus: *

public
public
public

Method Summary

Public Methods
public

Get metrics server instance.

public

TODO get_metrics_server_name

public

get_servers(): Collection

Get Node instance servers collection.

public

get_topology_info(arg_deep: boolean, arg_visited: object): object

Get topology item informations.

public

load(): nothing

Load Node with starting settings.

public

load_features(): nothing

Load Node features.

public

load_topology_settings(arg_settings: object): nothing

Load settings on master node.

public

receive_master_msg(arg_sender: string, arg_payload: object): nothing

Process received message on master node.

public

receive_msg(arg_msg: DistributedMessage): nothing

Process received message.

public

receive_node_msg(arg_sender: string, arg_payload: object): nothing

Process received message not on master node.

public

start(): nothing

Starts node features.

public

stop(): nothing

Stops node features.

public
public

Inherited Summary

From class NodeMessaging
public

Is master flag.

public

Class type flag.

public

Master name.

public

state: *

public

Find master node.

public

get_logs_bus(): BusClient | BusServer

Get metrics bus client or server instance.

public

get_metrics_bus(): BusClient | BusServer

Get metrics bus client or server instance.

public

get_msg_bus(): BusClient | BusServer

Get metrics bus client or server instance.

public

Promote this node to master node.

public

register_to_master(): nothing

Register this node to master node.

public

Revoke this node from master node.

public

send_msg_to_master(arg_payload: object): nothing

Send a message to master node through a bus.

public

switch_state(arg_state: string): nothing

Switch Node state.

public

Unegister this node from master node.

Public Constructors

public constructor(arg_name: string, arg_settings: object, arg_log_context: string): nothing source

Create a Node instance.

Override:

NodeMessaging#constructor

Params:

NameTypeAttributeDescription
arg_name string

resource name.

arg_settings object

resource settings.

arg_log_context string

trace context string (optional, default=context).

Return:

nothing

Public Members

public $settings: * source

public features: *[] source

public is_node: boolean source

Class type flag.

public logs_bus: * source

public logs_bus_feature: * source

public metrics_bus: * source

public metrics_bus_feature: * source

public metrics_feature: * source

public msg_bus: * source

public msg_bus_feature: * source

public remote_nodes: {} source

public servers_feature: * source

Public Methods

public get_metrics_server(): Server source

Get metrics server instance.

Return:

Server

Metrics server.

public get_metrics_server_name(): string source

TODO get_metrics_server_name

Return:

string

public get_servers(): Collection source

Get Node instance servers collection.

Return:

Collection

Node servers.

public get_topology_info(arg_deep: boolean, arg_visited: object): object source

Get topology item informations.

Params:

NameTypeAttributeDescription
arg_deep boolean

get deep sub items information on true (default:false).

arg_visited object

visited items plain object map.

Return:

object

topology informations (plain object).

public load(): nothing source

Load Node with starting settings.

Return:

nothing

public load_features(): nothing source

Load Node features.

Return:

nothing

public load_topology_settings(arg_settings: object): nothing source

Load settings on master node.

Params:

NameTypeAttributeDescription
arg_settings object

master node settings.

Return:

nothing

public receive_master_msg(arg_sender: string, arg_payload: object): nothing source

Process received message on master node.

Params:

NameTypeAttributeDescription
arg_sender string

message emitter name.

arg_payload object

message content.

Return:

nothing

public receive_msg(arg_msg: DistributedMessage): nothing source

Process received message.

Params:

NameTypeAttributeDescription
arg_msg DistributedMessage

message object.

Return:

nothing

public receive_node_msg(arg_sender: string, arg_payload: object): nothing source

Process received message not on master node.

Params:

NameTypeAttributeDescription
arg_sender string

message emitter name.

arg_payload object

message content.

Return:

nothing

public start(): nothing source

Starts node features.

Return:

nothing

public stop(): nothing source

Stops node features.

Return:

nothing

public update_trace_enabled_stage_1() source

public update_trace_enabled_stage_2() source