Class: Node

Serl.Node(given)

Constructor for objects analogous to an OTP node.

Constructor

new Node(given)

Parameters:
Name Type Description
given String

Following OTP convention, a node name, names should be 'given@host'.

Properties:
Name Type Description
nodeIndexFromNodeName function

module:Serl.Node.nodeIndexFromNodeName

spawn function

module:Serl.Node#spawn

host module:Serl.Node#host

Should mirror OTP convention, presumably refer to a hostfile.

name module:Serl.Node#name
procMap Map
nodeMap Map

A map of connected nodes.

cookie

todo/unimplemented

hidden

todo/unimplemented

Source:
To Do:
  • Rename module from Serl to OTP? (Brand reinforcement; possibly conveying a sense of false legitimacy.)
  • Distributed Erlang functionality (we don't need this yet) https://erlang.org/doc/reference_manual/distributed.html

Members

host :String

This custom type exists only in documentation, and must be manually enforced in code, by developers.

Type:
  • String
Properties:
Name Type Description
module:Serl.Node#host
Source:
To Do:
  • Assign from a hostfile.

name :String

Has the form given@host, which is based on the given-name of each call to Node(given). Analogous to an OTP node name

This custom type exists only in documentation, and must be manually enforced in code, by developers.

Type:
  • String
Properties:
Name Type Description
module:Serl.Node#name
Source:
To Do:
  • In OTP convention, this depends on -name vs -sname flags

Methods

(static) nodeIndexFromNodeName(node, nodeName) → {integer}

Utility function, returning a nodeIndex, integers used as keys in module:Serl.Node#nodeMap.

Parameters:
Name Type Description
node module:Serl.Node

An instance of the Node class.

nodeName module:Serl.Node#name
Source:
Returns:
Type
integer

spawn()

Implements various arities of spawn/n. Spawns an instance of Proc on some a certain instance of Node. The keyword this in any fun passed to spawn/n will refer to the spawned proc.

spawn/1
Spawns a Proc object on the parent node, which applies fun to an empty array []. See OTP docs.
Parameters:
Name Type Description
fun Function The function which will run in this process.
spawn/2
(coming soon)
spawn/3
Spawns a Proc object on the parent node, which applies a function (given and accessed via a module) to a list of arguments, in the manner of:
module[funName]( ... funArgs )</code>

See OTP docs.

Parameters:
Name Type Description
module Object An object representing a code Module, with callable methods.
funName String The string name of a method of module.
funArgs Array An array of arguments to pass to module[funName] when the latter is called.
spawn/4
(coming soon)
Source:
To Do:
  • implement the 'undefined function' error
  • refer to 'dynamic module loading' and module objects later
  • When fun returns, Proc should exit formally.
  • Enforce passing objects by value (copy on call).