hoshimi
    Preparing search index...

    Class NodeManager

    Class representing a node manager. NodeManager

    Index

    Constructors

    Properties

    manager: Hoshimi

    The manager for the node.

    nodes: Collection<string, Node> = ...

    The nodes for the manager.

    Methods

    • Delete the node.

      Parameters

      Returns boolean

      If the node was deleted.

      const node = manager.nodeManager.get("node1");
      if (node) manager.nodeManager.delete(node.id); // true if the node was deleted
    • Disconnect the nodes.

      Returns void

      const node = manager.nodeManager.get("node1");
      if (node) node.disconnectAll();
    • Get the node by id.

      Parameters

      Returns Node | undefined

      The node or undefined if not found.

      const node = manager.nodeManager.get("node1");
      if (node) {
      console.log(node.id); // node1
      } else {
      console.log("Node not found");
      }
    • Get the least used node.

      Parameters

      Returns Node

      The least used node.

      const node = manager.nodeManager.getLeastUsed();
      if (node) {
      console.log(node.id); // node1
      console.log(node.penalties); // the penalties of the node
      console.log(node.state); // the state of the node
      }