Class: NodeManager

Table of contents

Constructors

Methods

Constructors

constructor

new NodeManager(): NodeManager

Creates a new instance of NodeManager.

Returns

NodeManager - The created instance of NodeManager.

Methods

init

init(): void

Initializes the NodeManager instance.

Returns

void

check

check(): void

Checks the validity of the nodes configuration.

Returns

void

add

add(node: INode): void

Adds a new node to the manager.

Parameters

NameTypeDescription
nodeINodeNode configuration.

Returns

void

remove

remove(name: string): boolean

Removes a node from the manager.

Parameters

NameTypeDescription
namestringName or identifier of the node to remove.

Returns

boolean - Indicates whether the node was successfully removed.

get

get(name: string): MoonlinkNode | null

Gets a node by its name or identifier.

Parameters

NameTypeDescription
namestringName or identifier of the node to get.

Returns

MoonlinkNode | null - The node instance, or null if not found.

sortByUsage

sortByUsage(sortType: SortType): MoonlinkNode

Sorts nodes by usage metrics.

Parameters

NameTypeDescription
sortTypeSortTypeType of sorting to perform.

Returns

MoonlinkNode - An array of sorted MoonlinkNode instances.