Module: workers

Members

(static, constant) MAX_WORKERS :Number

Max number of workers in the pool.

Type:
  • Number
Source:

(static, constant) TIMEOUT :Number

Callback timeout.

Type:
  • Number
Source:

Methods

(static) alloc(id) → {ChildProcess}

Allocate a new worker, will not go above MAX_WORKERS and will automatically load balance the workers based on job ID.

Parameters:
Name Type Description
id Number
Source:
Returns:
Type
ChildProcess

(static) call(method, args, callback)

Call a method for a worker to execute.

Parameters:
Name Type Description
method String

Method name.

args Array

Arguments.

callback function

Returns whatever the worker method specifies.

Source:

(static) listen()

Listen for messages from master process (only if worker).

Source:

(static) mine(attempt) → {Block}

Mine a block on worker.

Parameters:
Name Type Description
attempt Object

Naked minerblock.

Source:
Returns:
Type
Block

(static) spawn(index) → {ChildProcess}

Spawn a new worker.

Parameters:
Name Type Description
index Number

Worker ID.

Source:
Returns:
Type
ChildProcess

(static) verify(tx, indexnullable, forcenullable, flagsnullable) → {Boolean}

Execute tx.verify() on worker.

Parameters:
Name Type Attributes Description
tx TX
index Number <nullable>
force Boolean <nullable>
flags VerifyFlags <nullable>
Source:
See:
Returns:
Type
Boolean